Ejemplo n.º 1
0
 def test_controller_status_from_knx_other_bits_set(self):
     """Test parsing DPTControllerStatus from KNX."""
     self.assertEqual(DPTControllerStatus.from_knx((0x21, )),
                      HVACOperationMode.COMFORT)
     self.assertEqual(DPTControllerStatus.from_knx((0x23, )),
                      HVACOperationMode.STANDBY)
     self.assertEqual(DPTControllerStatus.from_knx((0x27, )),
                      HVACOperationMode.NIGHT)
     self.assertEqual(DPTControllerStatus.from_knx((0x2F, )),
                      HVACOperationMode.FROST_PROTECTION)
Ejemplo n.º 2
0
 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()
     operation_mode = DPTControllerStatus.from_knx(telegram.payload.value)
     yield from self._set_internal_operation_mode(operation_mode)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 def test_controller_status_from_knx_wrong_value(self):
     """Test parsing of DPTControllerStatus with wrong value)."""
     with self.assertRaises(ConversionError):
         DPTControllerStatus.from_knx((1, 2))
Ejemplo n.º 6
0
 def test_controller_status_from_knx_wrong_code(self):
     """Test parsing of DPTControllerStatus with wrong code."""
     with self.assertRaises(CouldNotParseKNXIP):
         DPTControllerStatus.from_knx((0x00,))
Ejemplo n.º 7
0
 def test_controller_status_from_knx_wrong_value(self):
     """Test parsing of DPTControllerStatus with wrong value)."""
     with self.assertRaises(ConversionError):
         DPTControllerStatus.from_knx((1, 2))
Ejemplo n.º 8
0
 def test_controller_status_from_knx_other_bits_set(self):
     """Test parsing DPTControllerStatus from KNX."""
     self.assertEqual(DPTControllerStatus.from_knx((0x21,)), HVACOperationMode.COMFORT)
     self.assertEqual(DPTControllerStatus.from_knx((0x23,)), HVACOperationMode.STANDBY)
     self.assertEqual(DPTControllerStatus.from_knx((0x27,)), HVACOperationMode.NIGHT)
     self.assertEqual(DPTControllerStatus.from_knx((0x2F,)), HVACOperationMode.FROST_PROTECTION)
Ejemplo n.º 9
0
 def test_controller_status_from_knx_wrong_code(self):
     """Test parsing of DPTControllerStatus with wrong code."""
     with self.assertRaises(CouldNotParseKNXIP):
         DPTControllerStatus.from_knx((0x00, ))