automations/devices/bed_effect.yaml
#
# Change bed underglow lights based on LIFX Cloud scenes
#
# The LIFX strips have some effects programmed with the LIFX mobile app and
# stored on their servers. Each effect mentions which device will receive which
# colour pattern. Also, each effect has a UUID that can be used to load the
# effect from the servers and program the LIFX devices accordingly.
#
# @subscribe variable.bed_effect
#
# @see /automations/devices/bed_schedule.yaml
# @see /automations/devices/bed_select.yaml
# @see /scenes/lifx_cloud.yaml
#
- id: bed_effect
alias: "Bed EFFECT"
trigger:
# When an effect is changed.
- platform: state
entity_id: variable.bed_effect
action:
# Send the effect's UUID to the LIFX Cloud scenes service.
- service: shell_command.activate_lifx_cloud_scene
data_template:
uuid: >-
{% set effects = {
'Neon': '2910cd6c-1644-4b6b-b2bf-8eb26f254288',
'Reading': '444b1097-1e26-40f7-a1a8-7f68a161550c',
'Relaxing': '48c32539-48f8-4bcc-826a-e88b2b0c9b8e',
'Warming': '33975782-8725-4b27-a96b-d87018da999b',
} %}
{% set selected = states('variable.bed_effect') %}
{% if effects[selected] %}
{{ effects[selected] }}
{% endif %}
duration: 5
key: !secret lifx_cloud_token