Update Hue platform to aiohue 1.5.0, and re-implement logic for duplicate scene names. (#14653)
parent
9044a9157f
commit
9a87e62e0e
|
@ -17,7 +17,7 @@ from .bridge import HueBridge
|
||||||
# Loading the config flow file will register the flow
|
# Loading the config flow file will register the flow
|
||||||
from .config_flow import configured_hosts
|
from .config_flow import configured_hosts
|
||||||
|
|
||||||
REQUIREMENTS = ['aiohue==1.3.0']
|
REQUIREMENTS = ['aiohue==1.5.0']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -124,9 +124,21 @@ class HueBridge(object):
|
||||||
(group for group in self.api.groups.values()
|
(group for group in self.api.groups.values()
|
||||||
if group.name == group_name), None)
|
if group.name == group_name), None)
|
||||||
|
|
||||||
scene_id = next(
|
# The same scene name can exist in multiple groups.
|
||||||
(scene.id for scene in self.api.scenes.values()
|
# In this case, activate first scene that contains the
|
||||||
if scene.name == scene_name), None)
|
# the exact same light IDs as the group
|
||||||
|
scenes = []
|
||||||
|
for scene in self.api.scenes.values():
|
||||||
|
if scene.name == scene_name:
|
||||||
|
scenes.append(scene)
|
||||||
|
if len(scenes) == 1:
|
||||||
|
scene_id = scenes[0].id
|
||||||
|
else:
|
||||||
|
group_lights = sorted(group.lights)
|
||||||
|
for scene in scenes:
|
||||||
|
if group_lights == scene.lights:
|
||||||
|
scene_id = scene.id
|
||||||
|
break
|
||||||
|
|
||||||
# If we can't find it, fetch latest info.
|
# If we can't find it, fetch latest info.
|
||||||
if not updated and (group is None or scene_id is None):
|
if not updated and (group is None or scene_id is None):
|
||||||
|
|
|
@ -86,7 +86,7 @@ aiodns==1.1.1
|
||||||
aiohttp_cors==0.7.0
|
aiohttp_cors==0.7.0
|
||||||
|
|
||||||
# homeassistant.components.hue
|
# homeassistant.components.hue
|
||||||
aiohue==1.3.0
|
aiohue==1.5.0
|
||||||
|
|
||||||
# homeassistant.components.sensor.imap
|
# homeassistant.components.sensor.imap
|
||||||
aioimaplib==0.7.13
|
aioimaplib==0.7.13
|
||||||
|
|
|
@ -35,7 +35,7 @@ aioautomatic==0.6.5
|
||||||
aiohttp_cors==0.7.0
|
aiohttp_cors==0.7.0
|
||||||
|
|
||||||
# homeassistant.components.hue
|
# homeassistant.components.hue
|
||||||
aiohue==1.3.0
|
aiohue==1.5.0
|
||||||
|
|
||||||
# homeassistant.components.notify.apns
|
# homeassistant.components.notify.apns
|
||||||
apns2==0.3.0
|
apns2==0.3.0
|
||||||
|
|
Loading…
Reference in New Issue