From 36ee9ff58f3f77bd7d4e8f6b3fb049a522dc0d27 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Mon, 20 Jul 2020 18:33:56 +1000 Subject: [PATCH] Don't advertise switch devices as dimmable lights (#37978) This issue has been corrected and then reverted multiple times. It seems that the core issue was a casing one (On/off vs On/Off) ; for better matching with a real Hue hub, also add the productname. Tested to work with echo 2 and echo 5. --- homeassistant/components/emulated_hue/hue_api.py | 11 +++++------ tests/components/emulated_hue/test_hue_api.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/emulated_hue/hue_api.py b/homeassistant/components/emulated_hue/hue_api.py index 5eb32939d51..739baf0c425 100644 --- a/homeassistant/components/emulated_hue/hue_api.py +++ b/homeassistant/components/emulated_hue/hue_api.py @@ -744,12 +744,11 @@ def entity_to_json(config, entity): retval["modelid"] = "HASS123" retval["state"].update({HUE_API_STATE_BRI: state[STATE_BRIGHTNESS]}) else: - # Dimmable light (Zigbee Device ID: 0x0100) - # Supports groups, scenes, on/off and dimming - # Reports fixed brightness for compatibility with Alexa. - retval["type"] = "Dimmable light" - retval["modelid"] = "HASS123" - retval["state"].update({HUE_API_STATE_BRI: HUE_API_STATE_BRI_MAX}) + # On/Off light (ZigBee Device ID: 0x0000) + # Supports groups, scenes and on/off control + retval["type"] = "On/Off light" + retval["productname"] = "On/Off light" + retval["modelid"] = "HASS321" return retval diff --git a/tests/components/emulated_hue/test_hue_api.py b/tests/components/emulated_hue/test_hue_api.py index 4ffc7cd7f0e..99940e47133 100644 --- a/tests/components/emulated_hue/test_hue_api.py +++ b/tests/components/emulated_hue/test_hue_api.py @@ -252,7 +252,7 @@ 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"] == "Dimmable light" + assert light_without_brightness_json["type"] == "On/Off light" async def test_light_without_brightness_can_be_turned_off(hass_hue, hue_client):