blueprint: name: Philips Hue Dimmer MQTT control config description: | # Requirements: - Philips Hue Dimmer Switch 929002398602 - Zigbee2MQTT - MQTT domain: automation input: Remote_MQTT_Topic: name: Remote MQTT Topic description: Philips Hue Dimmer Switch (e.g., zigbee2mqtt/remote_1/action) default: "zigbee2mqtt//action" Target_MQTT_Topic: name: Target MQTT Topic description: Target light (e.g., zigbee2mqtt/light_1/set) default: "zigbee2mqtt//set" off_brightness: name: off_brightness description: Brightness to set when off button is pressed selector: number: min: 0 max: 254 step: 1 mode: slider default: 0 off_state: name: off_state description: State to set when off button is pressed default: "OFF" move_rate: name: Brightness Move Rate [steps/s] description: The rate at which brightness should change on up/down press. default: 50 selector: number: min: 1 max: 255 step: 1 mode: slider color_temp: name: Color Temperature (optional) description: The color temperature to set when turning on the light (in mireds). Leave empty to not set color temperature. default: 454 # Warmest possible selector: text: color: name: Color (optional) description: The color to set when turning on the light (RGB, e.g. [255,0,0] for red). Leave empty to not set color. default: '' selector: text: variables: move_rate: !input move_rate off_brightness: !input off_brightness off_state: !input off_state color_temp: !input color_temp color: !input color remote_topic: !input Remote_MQTT_Topic target_topic: !input Target_MQTT_Topic mode: restart trigger: - platform: mqtt topic: !input Remote_MQTT_Topic # Needs to be set static id: mqtt_action condition: [] action: - choose: - conditions: - condition: template value_template: "{{ trigger.payload == 'on_press' }}" sequence: - service: mqtt.publish data: topic: "{{ target_topic }}" payload: > {"state":"ON", "brightness": 254{% if color_temp != '' %}, "color_temp":{{ color_temp }}{% endif %}{% if color|length > 0 %}, "color": {"rgb": {{ color }} }{% endif %}} qos: 0 retain: false - conditions: - condition: template value_template: "{{ trigger.payload == 'off_press' }}" sequence: - service: mqtt.publish data: topic: "{{ target_topic }}" payload: '{ "brightness": {{ off_brightness }} }' qos: 0 retain: false - service: mqtt.publish data: topic: "{{ target_topic }}" payload: '{ "state": "{{ off_state }}" }' qos: 0 retain: false - conditions: - condition: template value_template: "{{ trigger.payload == 'off_hold' }}" # Long press sequence: - service: mqtt.publish data: topic: "{{ target_topic }}" payload: '{ "brightness": 0 }' qos: 0 retain: false - service: mqtt.publish data: topic: "{{ target_topic }}" payload: '{ "state": "OFF" }' qos: 0 retain: false - conditions: - condition: template value_template: "{{ trigger.payload == 'up_press' }}" sequence: - service: mqtt.publish data: topic: "{{ target_topic }}" payload: '{ "state": "ON" }' qos: 0 retain: false - service: mqtt.publish data: topic: "{{ target_topic }}" payload: '{ "brightness_move": {{ move_rate }} }' qos: 0 retain: false - conditions: - condition: template value_template: "{{ trigger.payload == 'down_press' }}" sequence: - service: mqtt.publish data: topic: "{{ target_topic }}" payload: '{"brightness_move": {{ -move_rate }}}' qos: 0 retain: false - conditions: - condition: template value_template: > {{ trigger.payload in ['up_press_release', 'down_press_release', 'up_hold_release', 'down_hold_release'] }} sequence: - service: mqtt.publish data: topic: "{{ target_topic }}" payload: '{"brightness_move": 0}' qos: 0 retain: false default: []