mirror of
https://github.com/home-assistant/core.git
synced 2025-08-06 06:05:10 +02:00
Expose hue group 0 to HA #8652
If allow_hue_groups is set expose "All Hue Lights" group for "special group 0". This does add an additional Hue API call for every refresh (approx 30 secs) to get the status of the special group 0 because it's not included in the full API pull that currently occurs.
This commit is contained in:
@@ -206,6 +206,18 @@ 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's not
|
||||
# returned by api.get('groups'), so explicity get it and include it.
|
||||
# See https://developers.meethue.com/documentation/groups-api#21_get_all_groups
|
||||
all_lamps = bridge.get_group(0)
|
||||
if not isinstance(all_lamps, 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_lamps['name'] = "All Hue Lights"
|
||||
api_groups["0"] = all_lamps
|
||||
|
||||
new_lights = []
|
||||
|
||||
api_name = api.get('config').get('name')
|
||||
|
Reference in New Issue
Block a user