Ejemplo n.º 1
0
 def test_set_brightness_not_dimmable(self):
     """Test setting the brightness of a non dimmable Light."""
     # pylint: disable=invalid-name
     xknx = XKNX(loop=self.loop)
     light = Light(xknx,
                   name="TestLight",
                   group_address_switch='1/2/3')
     self.loop.run_until_complete(asyncio.Task(light.set_brightness(23)))
     self.assertEqual(xknx.telegrams.qsize(), 0)  # Nothing should happen
Ejemplo n.º 2
0
 def test_set_brightness_not_dimmable(self):
     """Test setting the brightness of a non dimmable Light."""
     # pylint: disable=invalid-name
     xknx = XKNX()
     light = Light(xknx, name="TestLight", group_address_switch="1/2/3")
     with patch("logging.Logger.warning") as mock_warn:
         self.loop.run_until_complete(light.set_brightness(23))
         self.assertEqual(xknx.telegrams.qsize(), 0)
         mock_warn.assert_called_with("Dimming not supported for device %s",
                                      "TestLight")
Ejemplo n.º 3
0
 def test_set_brightness(self):
     """Test setting the brightness of a Light."""
     xknx = XKNX(loop=self.loop)
     light = Light(xknx,
                   name="TestLight",
                   group_address_switch='1/2/3',
                   group_address_brightness='1/2/5')
     self.loop.run_until_complete(asyncio.Task(light.set_brightness(23)))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(telegram,
                      Telegram(Address('1/2/5'), payload=DPTArray(23)))
Ejemplo n.º 4
0
 def test_set_brightness(self):
     """Test setting the brightness of a Light."""
     xknx = XKNX()
     light = Light(
         xknx,
         name="TestLight",
         group_address_switch="1/2/3",
         group_address_brightness="1/2/5",
     )
     self.loop.run_until_complete(light.set_brightness(23))
     self.assertEqual(xknx.telegrams.qsize(), 1)
     telegram = xknx.telegrams.get_nowait()
     self.assertEqual(telegram,
                      Telegram(GroupAddress("1/2/5"), payload=DPTArray(23)))