Fix name collision when using multiple Hue bridges (#10486)

* Fix name collision when using multiple Hue bridges

See https://github.com/home-assistant/home-assistant/issues/9393

* Use new style of string formatting

* Removed creating of "All Hue Lights" group
This commit is contained in:
Bart S 2017-11-24 02:26:36 +01:00 committed by Paulus Schoutsen
parent 1a7522a594
commit b03c024f74

View File

@ -83,7 +83,6 @@ SCENE_SCHEMA = vol.Schema({
})
ATTR_IS_HUE_GROUP = "is_hue_group"
GROUP_NAME_ALL_HUE_LIGHTS = "All Hue Lights"
CONFIG_INSTRUCTIONS = """
Press the button on the bridge to register Philips Hue with Home Assistant.
@ -210,21 +209,6 @@ def setup_bridge(host, hass, add_devices, filename, allow_unreachable,
_LOGGER.error("Got unexpected result from Hue API")
return
if not skip_groups:
# Group ID 0 is a special group in the hub for all lights, but it
# is not returned by get_api() so explicitly get it and include it.
# See https://developers.meethue.com/documentation/
# groups-api#21_get_all_groups
_LOGGER.debug("Getting group 0 from bridge")
all_lights = bridge.get_group(0)
if not isinstance(all_lights, dict):
_LOGGER.error("Got unexpected result from Hue API for group 0")
return
# Hue hub returns name of group 0 as "Group 0", so rename
# for ease of use in HA.
all_lights['name'] = GROUP_NAME_ALL_HUE_LIGHTS
api_groups["0"] = all_lights
new_lights = []
api_name = api.get('config').get('name')