def test_controller_status_from_knx_other_bits_set(self): """Test parsing DPTControllerStatus from KNX.""" assert DPTControllerStatus.from_knx((0x21,)) == HVACOperationMode.COMFORT assert DPTControllerStatus.from_knx((0x23,)) == HVACOperationMode.STANDBY assert DPTControllerStatus.from_knx((0x27,)) == HVACOperationMode.NIGHT assert ( DPTControllerStatus.from_knx((0x2F,)) == HVACOperationMode.FROST_PROTECTION )
def test_controller_status_from_knx(self): """Test parsing DPTControllerStatus from KNX.""" self.assertEqual(DPTControllerStatus.from_knx((0x21, )), HVACOperationMode.COMFORT) self.assertEqual(DPTControllerStatus.from_knx((0x22, )), HVACOperationMode.STANDBY) self.assertEqual(DPTControllerStatus.from_knx((0x24, )), HVACOperationMode.NIGHT) self.assertEqual(DPTControllerStatus.from_knx((0x28, )), HVACOperationMode.FROST_PROTECTION)
async def _process_controller_status(self, telegram): """Process incoming telegram for controller status.""" if not isinstance(telegram.payload, DPTArray) \ or len(telegram.payload.value) != 1: raise CouldNotParseTelegram("invalid payload", payload=telegram.payload, device_name=self.name) operation_mode = DPTControllerStatus.from_knx(telegram.payload.value) await self._set_internal_operation_mode(operation_mode)
def test_controller_status_from_knx_wrong_code(self): """Test parsing of DPTControllerStatus with wrong code.""" with pytest.raises(ConversionError): DPTControllerStatus.from_knx((0x00, ))
def test_controller_status_from_knx_wrong_value(self): """Test parsing of DPTControllerStatus with wrong value).""" with pytest.raises(ConversionError): DPTControllerStatus.from_knx((1, 2))
def test_controller_status_from_knx_wrong_code(self): """Test parsing of DPTControllerStatus with wrong code.""" with pytest.raises(CouldNotParseKNXIP): DPTControllerStatus.from_knx((0x00,))