Fix emulated hue on/off devices compatibility with alexa (#39063)

This commit is contained in:
J. Nick Koston 2020-08-20 03:27:14 -05:00 committed by GitHub
parent 28a9793a7b
commit 4371068f6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -780,6 +780,7 @@ def entity_to_json(config, entity):
retval["type"] = "On/Off light"
retval["productname"] = "On/Off light"
retval["modelid"] = "HASS321"
retval["state"].update({HUE_API_STATE_BRI: HUE_API_STATE_BRI_MAX})
return retval

View file

@ -22,6 +22,7 @@ from homeassistant.components import (
from homeassistant.components.emulated_hue import Config, hue_api
from homeassistant.components.emulated_hue.hue_api import (
HUE_API_STATE_BRI,
HUE_API_STATE_BRI_MAX,
HUE_API_STATE_CT,
HUE_API_STATE_HUE,
HUE_API_STATE_ON,
@ -282,6 +283,12 @@ async def test_light_without_brightness_supported(hass_hue, hue_client):
assert light_without_brightness_json["state"][HUE_API_STATE_ON] is True
assert light_without_brightness_json["type"] == "On/Off light"
# BRI required for alexa compat
assert (
light_without_brightness_json["state"][HUE_API_STATE_BRI]
== HUE_API_STATE_BRI_MAX
)
async def test_light_without_brightness_can_be_turned_off(hass_hue, hue_client):
"""Test that light without brightness can be turned off."""