mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Expose hue group 0 (#8663)
* Tado Fix #8606
Handle case where 'mode' and 'fanSpeed' are missing JSON. Based on
changes in commit
adfb608f86
* 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.
* Revert "Expose hue group 0 to HA #8652"
This reverts commit db7fe47ec72a4907f8a59ebfb47bc4a6dfa41e89.
* 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.
* Changes per review by balloob
1) Use all_lights instead of all_lamps
2) Fix line lengths and trailing whitespace
3) Move "All Hue Lights" to GROUP_NAME_ALL_HUE_LIGHTS constant
* Make "All Hue Lights" a constant
* Fix trailing whitespace
This commit is contained in:
parent
968ed6ef5b
commit
0b1677de6d
@ -83,6 +83,7 @@ SCENE_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
ATTR_IS_HUE_GROUP = "is_hue_group"
|
ATTR_IS_HUE_GROUP = "is_hue_group"
|
||||||
|
GROUP_NAME_ALL_HUE_LIGHTS = "All Hue Lights"
|
||||||
|
|
||||||
|
|
||||||
def _find_host_from_config(hass, filename=PHUE_CONFIG_FILE):
|
def _find_host_from_config(hass, filename=PHUE_CONFIG_FILE):
|
||||||
@ -203,6 +204,21 @@ def setup_bridge(host, hass, add_devices, filename, allow_unreachable,
|
|||||||
_LOGGER.error("Got unexpected result from Hue API")
|
_LOGGER.error("Got unexpected result from Hue API")
|
||||||
return
|
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 explicity 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 = []
|
new_lights = []
|
||||||
|
|
||||||
api_name = api.get('config').get('name')
|
api_name = api.get('config').get('name')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user