def test_to_process_error(self): """Test process errornous telegram.""" xknx = XKNX() remote_value = RemoteValueControl(xknx, group_address=GroupAddress("1/2/3"), value_type="stepwise") with self.assertRaises(CouldNotParseTelegram): telegram = Telegram( destination_address=GroupAddress("1/2/3"), payload=GroupValueWrite(DPTArray(0x01)), ) self.loop.run_until_complete(remote_value.process(telegram)) with self.assertRaises(ConversionError): telegram = Telegram( destination_address=GroupAddress("1/2/3"), payload=GroupValueWrite(DPTBinary(0x10)), ) self.loop.run_until_complete(remote_value.process(telegram)) # pylint: disable=pointless-statement remote_value.value
def test_process(self): """Test process telegram.""" xknx = XKNX() remote_value = RemoteValueControl(xknx, group_address=GroupAddress("1/2/3"), value_type="stepwise") telegram = Telegram( destination_address=GroupAddress("1/2/3"), payload=GroupValueWrite(DPTBinary(0xB)), ) self.assertEqual(remote_value.value, None) self.loop.run_until_complete(remote_value.process(telegram)) self.assertEqual(remote_value.value, 25)