Fix homekit handling of 0 light brightness and fan speed (#29962)

* Fix homekit handling of 0 light brightness and fan speed

* Update homekit tests for new initial brightness/speed value
This commit is contained in:
Fazli Sapuan authored and Paulus Schoutsen committed 2019-12-20 11:00:21 +01:00
1 parent eb0aed3653
commit 92fd3e3ad5
4 files changed
+46 -6

No files matched your search

+4 -1
View File
@@ -197,7 +197,10 @@ async def test_fan_speed(hass, hk_driver, cls, events):
)
await hass.async_block_till_done()
acc = cls.fan(hass, hk_driver, "Fan", entity_id, 2, None)
assert acc.char_speed.value == 0
# Initial value can be anything but 0. If it is 0, it might cause HomeKit to set the
# speed to 100 when turning on a fan on a freshly booted up server.
assert acc.char_speed.value != 0
await hass.async_add_job(acc.run)
assert (
+3 -1
View File
@@ -101,7 +101,9 @@ async def test_light_brightness(hass, hk_driver, cls, events):
await hass.async_block_till_done()
acc = cls.light(hass, hk_driver, "Light", entity_id, 2, None)
assert acc.char_brightness.value == 0
# Initial value can be anything but 0. If it is 0, it might cause HomeKit to set the
# brightness to 100 when turning on a light on a freshly booted up server.
assert acc.char_brightness.value != 0
await hass.async_add_job(acc.run)
await hass.async_block_till_done()