Example #1
0
 def test_process_speed_wrong_payload(self):  # pylint: disable=invalid-name
     """Test process wrong telegrams. (wrong payload type)."""
     xknx = XKNX(loop=self.loop)
     fan = Fan(xknx, name="TestFan", group_address_speed='1/2/3')
     telegram = Telegram(GroupAddress('1/2/3'), payload=DPTBinary(1))
     with self.assertRaises(CouldNotParseTelegram):
         self.loop.run_until_complete(asyncio.Task(fan.process(telegram)))
Example #2
0
 def test_process_fan_payload_invalid_length(self):
     """Test process wrong telegrams. (wrong payload length)."""
     # pylint: disable=invalid-name
     xknx = XKNX(loop=self.loop)
     fan = Fan(xknx, name="TestFan", group_address_speed='1/2/3')
     telegram = Telegram(GroupAddress('1/2/3'), payload=DPTArray((23, 24)))
     with self.assertRaises(CouldNotParseTelegram):
         self.loop.run_until_complete(asyncio.Task(fan.process(telegram)))
Example #3
0
 def test_process_speed_wrong_payload(self):  # pylint: disable=invalid-name
     """Test process wrong telegrams. (wrong payload type)."""
     xknx = XKNX(loop=self.loop)
     fan = Fan(xknx,
               name="TestFan",
               group_address_speed='1/2/3')
     telegram = Telegram(GroupAddress('1/2/3'), payload=DPTBinary(1))
     with self.assertRaises(CouldNotParseTelegram):
         self.loop.run_until_complete(asyncio.Task(fan.process(telegram)))
Example #4
0
 def test_process_speed_wrong_payload(self):  # pylint: disable=invalid-name
     """Test process wrong telegrams. (wrong payload type)."""
     xknx = XKNX()
     fan = Fan(xknx, name="TestFan", group_address_speed="1/2/3")
     telegram = Telegram(
         destination_address=GroupAddress("1/2/3"),
         payload=GroupValueWrite(DPTBinary(1)),
     )
     with self.assertRaises(CouldNotParseTelegram):
         self.loop.run_until_complete(fan.process(telegram))
Example #5
0
    def test_process_speed(self):
        """Test process / reading telegrams from telegram queue. Test if speed is processed."""
        xknx = XKNX(loop=self.loop)
        fan = Fan(xknx, name="TestFan", group_address_speed='1/2/3')
        self.assertEqual(fan.current_speed, None)

        # 140 is 55% as byte (0...255)
        telegram = Telegram(GroupAddress('1/2/3'), payload=DPTArray(140))
        self.loop.run_until_complete(asyncio.Task(fan.process(telegram)))
        self.assertEqual(fan.current_speed, 55)
Example #6
0
 def test_process_fan_payload_invalid_length(self):
     """Test process wrong telegrams. (wrong payload length)."""
     # pylint: disable=invalid-name
     xknx = XKNX(loop=self.loop)
     fan = Fan(xknx,
               name="TestFan",
               group_address_speed='1/2/3')
     telegram = Telegram(GroupAddress('1/2/3'), payload=DPTArray((23, 24)))
     with self.assertRaises(CouldNotParseTelegram):
         self.loop.run_until_complete(asyncio.Task(fan.process(telegram)))
Example #7
0
 def test_process_fan_payload_invalid_length(self):
     """Test process wrong telegrams. (wrong payload length)."""
     # pylint: disable=invalid-name
     xknx = XKNX()
     fan = Fan(xknx, name="TestFan", group_address_speed="1/2/3")
     telegram = Telegram(
         destination_address=GroupAddress("1/2/3"),
         payload=GroupValueWrite(DPTArray((23, 24))),
     )
     with self.assertRaises(CouldNotParseTelegram):
         self.loop.run_until_complete(fan.process(telegram))
Example #8
0
    def test_process_speed(self):
        """Test process / reading telegrams from telegram queue. Test if speed is processed."""
        xknx = XKNX(loop=self.loop)
        fan = Fan(xknx,
                  name="TestFan",
                  group_address_speed='1/2/3')
        self.assertEqual(fan.current_speed, None)

        # 140 is 55% as byte (0...255)
        telegram = Telegram(GroupAddress('1/2/3'), payload=DPTArray(140))
        self.loop.run_until_complete(asyncio.Task(fan.process(telegram)))
        self.assertEqual(fan.current_speed, 55)
Example #9
0
    def test_process_speed(self):
        """Test process / reading telegrams from telegram queue. Test if speed is processed."""
        xknx = XKNX()
        fan = Fan(xknx, name="TestFan", group_address_speed="1/2/3")
        self.assertEqual(fan.current_speed, None)

        # 140 is 55% as byte (0...255)
        telegram = Telegram(
            destination_address=GroupAddress("1/2/3"),
            payload=GroupValueWrite(DPTArray(140)),
        )
        self.loop.run_until_complete(fan.process(telegram))
        self.assertEqual(fan.current_speed, 55)
Example #10
0
    def test_process_oscillation(self):
        """Test process / reading telegrams from telegram queue. Test if oscillation is processed."""
        xknx = XKNX()
        fan = Fan(
            xknx,
            name="TestFan",
            group_address_speed="1/2/3",
            group_address_oscillation="1/2/5",
        )
        self.assertEqual(fan.current_oscillation, None)

        telegram = Telegram(
            destination_address=GroupAddress("1/2/5"),
            payload=GroupValueWrite(DPTBinary(1)),
        )
        self.loop.run_until_complete(fan.process(telegram))
        self.assertTrue(fan.current_oscillation)