From 4371068f6a7bebd2c48c9e43e268ebc812e9fffa Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 20 Aug 2020 03:27:14 -0500 Subject: [PATCH] Fix emulated hue on/off devices compatibility with alexa (#39063) --- homeassistant/components/emulated_hue/hue_api.py | 1 + tests/components/emulated_hue/test_hue_api.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/homeassistant/components/emulated_hue/hue_api.py b/homeassistant/components/emulated_hue/hue_api.py index 7bba23b4b78..0dd3d212dad 100644 --- a/homeassistant/components/emulated_hue/hue_api.py +++ b/homeassistant/components/emulated_hue/hue_api.py @@ -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 diff --git a/tests/components/emulated_hue/test_hue_api.py b/tests/components/emulated_hue/test_hue_api.py index 95b4374e11e..a23296308f6 100644 --- a/tests/components/emulated_hue/test_hue_api.py +++ b/tests/components/emulated_hue/test_hue_api.py @@ -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."""