def test_set(self):
     """Test setting value."""
     xknx = XKNX()
     remote_value = RemoteValueUpDown(xknx,
                                      group_address=GroupAddress("1/2/3"))
     self.loop.run_until_complete(remote_value.down())
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(
         telegram,
         Telegram(
             destination_address=GroupAddress("1/2/3"),
             payload=GroupValueWrite(DPTBinary(1)),
         ),
     )
     self.loop.run_until_complete(remote_value.up())
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(
         telegram,
         Telegram(
             destination_address=GroupAddress("1/2/3"),
             payload=GroupValueWrite(DPTBinary(0)),
         ),
     )
Esempio n. 2
0
 def test_set(self):
     """Test setting value."""
     xknx = XKNX(loop=self.loop)
     remote_value = RemoteValueUpDown(xknx,
                                      group_address=GroupAddress("1/2/3"))
     self.loop.run_until_complete(asyncio.Task(remote_value.down()))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(telegram,
                      Telegram(GroupAddress('1/2/3'), payload=DPTBinary(1)))
     self.loop.run_until_complete(asyncio.Task(remote_value.up()))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(telegram,
                      Telegram(GroupAddress('1/2/3'), payload=DPTBinary(0)))