My approach for my new Philips Hue switch:
alias: Philips Hue Switch
description: ''
trigger:
- platform: device
domain: mqtt
device_id: fbb638b9fbade2db6739a4002bb0f9f3
type: action
subtype: on_press_release
discovery_id: 0x001788010926fed5 action_on_press_release
id: on_press_release
- platform: device
domain: mqtt
device_id: fbb638b9fbade2db6739a4002bb0f9f3
type: action
subtype: up_press_release
discovery_id: 0x001788010926fed5 action_up_press_release
id: up_press_release
- platform: device
domain: mqtt
device_id: fbb638b9fbade2db6739a4002bb0f9f3
type: action
subtype: down_press_release
discovery_id: 0x001788010926fed5 action_down_press_release
id: down_press_release
- platform: device
domain: mqtt
device_id: fbb638b9fbade2db6739a4002bb0f9f3
type: action
subtype: off_press_release
discovery_id: 0x001788010926fed5 action_off_press_release
id: off_press_release
- platform: device
domain: mqtt
device_id: fbb638b9fbade2db6739a4002bb0f9f3
type: action
subtype: on_hold_release
discovery_id: 0x001788010926fed5 action_on_hold_release
id: on_hold_release
- platform: device
domain: mqtt
device_id: fbb638b9fbade2db6739a4002bb0f9f3
type: action
subtype: off_hold_release
discovery_id: 0x001788010926fed5 action_off_hold_release
id: off_hold_release
- platform: device
domain: mqtt
device_id: fbb638b9fbade2db6739a4002bb0f9f3
type: action
subtype: up_hold
discovery_id: 0x001788010926fed5 action_up_hold
id: up_hold
- platform: device
domain: mqtt
device_id: fbb638b9fbade2db6739a4002bb0f9f3
type: action
subtype: down_hold
discovery_id: 0x001788010926fed5 action_down_hold
id: down-hold
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: on_press_release
sequence:
- type: toggle
device_id: 3bd52319e8de1a6106f1b7f729c3ddd8
entity_id: light.bedroom_lamps
domain: light
- conditions:
- condition: trigger
id: up_press_release
sequence:
- device_id: 3bd52319e8de1a6106f1b7f729c3ddd8
domain: light
entity_id: light.bedroom_lamps
type: brightness_increase
- conditions:
- condition: trigger
id: down_press_release
sequence:
- device_id: 3bd52319e8de1a6106f1b7f729c3ddd8
domain: light
entity_id: light.bedroom_lamps
type: brightness_decrease
- conditions:
- condition: trigger
id: off_press_release
sequence:
- service: light.turn_on
target:
entity_id: light.bedroom_lamps
data_template:
color_temp: >
{% if state_attr("light.bedroom_lamps","color_temp")|int > 350 %}
333
{% elif state_attr("light.bedroom_lamps","color_temp")|int > 332 %}
285
{% elif state_attr("light.bedroom_lamps","color_temp")|int > 284 %}
244
{% elif state_attr("light.bedroom_lamps","color_temp")|int > 243 %}
165
{% else %}
370
{% endif %}
- conditions:
- condition: trigger
id: on_hold_release
sequence:
- service: light.toggle
target:
device_id:
- 9ffc5618d5df2d3a408bae4f98c2d2c4
- 3bd52319e8de1a6106f1b7f729c3ddd8
- conditions:
- condition: trigger
id: off_hold_release
sequence:
- service: light.turn_on
target:
entity_id: light.bedroom_lamps
data:
color_temp: 260
brightness_pct: 100
- conditions: []
sequence: []
default: []
mode: queued
max: 10