USE the BLUEPRINT from 2nd POST
leaving this up for whomever might prefer the legacy version
This blueprint is for Hue Dimmer Switch (Philips 324131092621 control via MQTT | Zigbee2MQTT) and Zigbee2MQTT. I found other blueprints that control just lights, but I wanted one that allows you to choose your own action (which can also be a control of light) for each of the following events: on-press, on-hold, up-press, up-hold, down-press, down-hold, off-press, off-hold.
My personal setup uses the button presses/holds to do amongst others the following: Ceiling lamp On/Off, All lights On/Off, Projector/Media Player play/pause, Some lamp toggle on hold etc.
github gist here & import button:
blueprint:
name: Zigbee2Mqtt Hue Dimmer Switch control
description: ''
domain: automation
input:
dimmer_action:
name: Dimmer Switch Action sensor
description: 'Select your "sensor.dimmer_action" entity that will control this automation.'
selector:
entity:
domain: sensor
integration: mqtt
action_on_press:
name: on-press
description: select action to run when you press I
selector:
action:
action_off_press:
name: off-press
description: select action to run when you press O
selector:
action:
action_up_press:
name: up-press
description: select action to run when you press UP
selector:
action:
action_down_press:
name: down-press
description: select action to run when you press DOWN
selector:
action:
action_on_hold:
name: on-hold
description: select action to run when you hold I
selector:
action:
action_off_hold:
name: off-hold
description: select action to run when you hold O
selector:
action:
action_up_hold:
name: up-hold
description: select action to run when you hold UP
selector:
action:
action_down_hold:
name: down-hold
description: select action to run when you hold DOWN
selector:
action:
trigger:
- platform: state
entity_id: !input dimmer_action
attribute: action
to: on-press
- platform: state
entity_id: !input dimmer_action
attribute: action
to: off-press
- platform: state
entity_id: !input dimmer_action
attribute: action
to: up-press
- platform: state
entity_id: !input dimmer_action
attribute: action
to: down-press
- platform: state
entity_id: !input dimmer_action
to: up-hold
attribute: action
- platform: state
entity_id: !input dimmer_action
to: down-hold
attribute: action
- platform: state
entity_id: !input dimmer_action
to: on-hold
attribute: action
- platform: state
entity_id: !input dimmer_action
attribute: action
to: off-hold
action:
- choose:
- conditions:
- condition: state
entity_id: !input dimmer_action
state: on-press
attribute: action
sequence:
!input action_on_press
- conditions:
- condition: state
entity_id: !input dimmer_action
state: off-press
attribute: action
sequence:
!input action_off_press
- conditions:
- condition: state
entity_id: !input dimmer_action
state: up-press
attribute: action
sequence:
!input action_up_press
- conditions:
- condition: state
entity_id: !input dimmer_action
state: down-press
attribute: action
sequence:
!input action_down_press
- conditions:
- condition: state
entity_id: !input dimmer_action
state: on-hold
attribute: action
sequence:
!input action_on_hold
- conditions:
- condition: state
entity_id: !input dimmer_action
state: off-hold
attribute: action
sequence:
!input action_off_hold
- conditions:
- condition: state
entity_id: !input dimmer_action
state: up-hold
attribute: action
sequence:
!input action_up_hold
- conditions:
- condition: state
entity_id: !input dimmer_action
state: down-hold
attribute: action
sequence:
!input action_down_hold
default: []
mode: restart
You have to pick action for each event.If you don’t want to react to an event choose Delay of 0sec.
This is my very 1st blueprint, let me know how/if it does/doesn’t work for you