Example #1
0
 def test_set(self):
     """Test setting value."""
     xknx = XKNX()
     remote_value = RemoteValueColorRGBW(
         xknx, group_address=GroupAddress("1/2/3"))
     self.loop.run_until_complete(remote_value.set((100, 101, 102, 103)))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(
         telegram,
         Telegram(
             destination_address=GroupAddress("1/2/3"),
             payload=GroupValueWrite(
                 DPTArray((0x64, 0x65, 0x66, 0x67, 0x00, 0x0F))),
         ),
     )
     self.loop.run_until_complete(remote_value.set((100, 101, 104, 105)))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(
         telegram,
         Telegram(
             destination_address=GroupAddress("1/2/3"),
             payload=GroupValueWrite(
                 DPTArray((0x64, 0x65, 0x68, 0x69, 0x00, 0x0F))),
         ),
     )
 def test_set(self):
     """Test setting value."""
     xknx = XKNX(loop=self.loop)
     remote_value = RemoteValueColorRGBW(
         xknx, group_address=GroupAddress("1/2/3"))
     self.loop.run_until_complete(
         asyncio.Task(remote_value.set((100, 101, 102, 103))))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(
         telegram,
         Telegram(GroupAddress('1/2/3'),
                  payload=DPTArray((0x64, 0x65, 0x66, 0x67, 0x00, 0x0f))))
     self.loop.run_until_complete(
         asyncio.Task(remote_value.set((100, 101, 104, 105))))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(
         telegram,
         Telegram(GroupAddress('1/2/3'),
                  payload=DPTArray((0x64, 0x65, 0x68, 0x69, 0x00, 0x0f))))