mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Using alert with Hue maintains prior state (#3147)
* When using flash with hue, dont change the on/off state of the light so that it will naturally return to its previous state once flash is complete * ATTR_FLASH not ATTR_EFFECT
This commit is contained in:
parent
22362727e4
commit
0f37d8d8eb
@ -98,6 +98,7 @@ LIGHT_TURN_ON_SCHEMA = vol.Schema({
|
|||||||
LIGHT_TURN_OFF_SCHEMA = vol.Schema({
|
LIGHT_TURN_OFF_SCHEMA = vol.Schema({
|
||||||
ATTR_ENTITY_ID: cv.entity_ids,
|
ATTR_ENTITY_ID: cv.entity_ids,
|
||||||
ATTR_TRANSITION: VALID_TRANSITION,
|
ATTR_TRANSITION: VALID_TRANSITION,
|
||||||
|
ATTR_FLASH: vol.In([FLASH_SHORT, FLASH_LONG]),
|
||||||
})
|
})
|
||||||
|
|
||||||
LIGHT_TOGGLE_SCHEMA = vol.Schema({
|
LIGHT_TOGGLE_SCHEMA = vol.Schema({
|
||||||
|
@ -264,8 +264,10 @@ class HueLight(Light):
|
|||||||
|
|
||||||
if flash == FLASH_LONG:
|
if flash == FLASH_LONG:
|
||||||
command['alert'] = 'lselect'
|
command['alert'] = 'lselect'
|
||||||
|
del command['on']
|
||||||
elif flash == FLASH_SHORT:
|
elif flash == FLASH_SHORT:
|
||||||
command['alert'] = 'select'
|
command['alert'] = 'select'
|
||||||
|
del command['on']
|
||||||
elif self.bridge_type == 'hue':
|
elif self.bridge_type == 'hue':
|
||||||
command['alert'] = 'none'
|
command['alert'] = 'none'
|
||||||
|
|
||||||
@ -290,6 +292,17 @@ class HueLight(Light):
|
|||||||
# 900 seconds.
|
# 900 seconds.
|
||||||
command['transitiontime'] = min(9000, kwargs[ATTR_TRANSITION] * 10)
|
command['transitiontime'] = min(9000, kwargs[ATTR_TRANSITION] * 10)
|
||||||
|
|
||||||
|
flash = kwargs.get(ATTR_FLASH)
|
||||||
|
|
||||||
|
if flash == FLASH_LONG:
|
||||||
|
command['alert'] = 'lselect'
|
||||||
|
del command['on']
|
||||||
|
elif flash == FLASH_SHORT:
|
||||||
|
command['alert'] = 'select'
|
||||||
|
del command['on']
|
||||||
|
elif self.bridge_type == 'hue':
|
||||||
|
command['alert'] = 'none'
|
||||||
|
|
||||||
self.bridge.set_light(self.light_id, command)
|
self.bridge.set_light(self.light_id, command)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
|
@ -60,6 +60,12 @@ turn_off:
|
|||||||
description: Duration in seconds it takes to get to next state
|
description: Duration in seconds it takes to get to next state
|
||||||
example: 60
|
example: 60
|
||||||
|
|
||||||
|
flash:
|
||||||
|
description: If the light should flash
|
||||||
|
values:
|
||||||
|
- short
|
||||||
|
- long
|
||||||
|
|
||||||
toggle:
|
toggle:
|
||||||
description: Toggles a light
|
description: Toggles a light
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user