def test_mode_from_knx(self): """Test parsing DPTHVACMode from KNX.""" assert DPTHVACMode.from_knx((0x00,)) == HVACOperationMode.AUTO assert DPTHVACMode.from_knx((0x01,)) == HVACOperationMode.COMFORT assert DPTHVACMode.from_knx((0x02,)) == HVACOperationMode.STANDBY assert DPTHVACMode.from_knx((0x03,)) == HVACOperationMode.NIGHT assert DPTHVACMode.from_knx((0x04,)) == HVACOperationMode.FROST_PROTECTION
def test_mode_from_knx(self): """Test parsing DPTHVACMode from KNX.""" self.assertEqual(DPTHVACMode.from_knx((0x00,)), HVACOperationMode.AUTO) self.assertEqual(DPTHVACMode.from_knx((0x01,)), HVACOperationMode.COMFORT) self.assertEqual(DPTHVACMode.from_knx((0x02,)), HVACOperationMode.STANDBY) self.assertEqual(DPTHVACMode.from_knx((0x03,)), HVACOperationMode.NIGHT) self.assertEqual( DPTHVACMode.from_knx((0x04,)), HVACOperationMode.FROST_PROTECTION )
async def _process_operation_mode(self, telegram): """Process incoming telegram for operation mode.""" 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 = DPTHVACMode.from_knx(telegram.payload.value) await self._set_internal_operation_mode(operation_mode)
def test_mode_from_knx_wrong_code(self): """Test parsing of DPTHVACMode with wrong code.""" with pytest.raises(ConversionError): DPTHVACMode.from_knx((0x05, ))
def test_mode_from_knx_wrong_value(self): """Test parsing of DPTControllerStatus with wrong value).""" with pytest.raises(ConversionError): DPTHVACMode.from_knx((1, 2))
def test_mode_from_knx_wrong_code(self): """Test parsing of DPTHVACMode with wrong code.""" with pytest.raises(CouldNotParseKNXIP): DPTHVACMode.from_knx((0x05,))