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.
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
I’ve updated the blueprint to utilize the new trigger id’s from HA 2021.7 + changed the way it reads the input.
If you disable Home Assistant legacy triggers in Z2M options this makes the sensor.dimmer_action disappear. The new version of the blueprint queries the Z2M mqtt topic directly and utilizes the new HA feature of trigger id’s to toggle actions.
Instead of sensor.dimmer_action entity the blueprint now asks for your MQTT Dimmer topic, which you can find here: Ha / configuration / devices / Your Dimmer MQTT device and click on the MQTT Info -
@lukasberan dimmer_action is obsolete and the blueprint in 1st post is no longer supported. Use the one from 2nd post and configure it with your dimmer mqtt topic instead of dimmer_action
Have a look into logs, it shouldn’t just fail silently. One thing to keep in mind, you have to define an action for EVERY press. For the ones you want to ignore choose Delay of 0 sec as an action. The action on the screenshot looks good, but I can’t see if you defined all the rest.
You can find the log in Configuration, then at bottom Settings, then at top Logs. Press some buttons on the dimmer and then refresh the log and see if anything pops up.
Also another thing I completely forgot about is you can see the trace of how the automation went and why it might have failed in Configuration / Automations, then click the little button here:
Nothing happens in logs, Nothing happens in automations.
Its like the call for the mqtt does not work at all.
I have mqtt and zigb2mqtt installed in docker. It works when I run it as 7 different automations where I call device and then up_press action etc.
I have no clue what I could be doing wrong. I tried restarting home assistant but with no luck at all
Again 1 automation with your blueprint instead of 7 as I have now for each dimmer switch would have been soooo much better
Hmm, strange that nothing is in the logs. Is there nothing at all in the automation trace? I.e. not even the first circle lit up?
Do you maybe have legacy triggers enabled in Zigbee2MQTT? You could try the older version of the blueprint from the 1st post (which requires the legacy trigger). The automation from 2nd post I made after I disabled all the legacy stuff in Z2M configuration.yaml like so:
Can you check if the payload is passed to the action topic with something like MQTT Explorer while pressing the dimmer buttons?
The automations that you made and are working, are they reacting to the same mqtt topic or what do you use as triggers for them?
Sorry for all the questions and not many solutions, but I’ll admit I’m sort of grasping at straws here, the blueprint automation is fairly simple and it should “just work”.
First of all there is no need to be sorry about anything! you are trying to help me with the information I am supplying you! And since I have no idea where to start, its very helpful with your questions to try and circle in on the issue.
I am so grateful for you wasting you’re time trying to help me out!
No Nothing shows up in automation. I dont think the topic thing is working correctly for me but I have no idea why.
all those settings in my zigbee2mqtt configuration.yaml is set to false, still I can try out the old blueprint later and see if that does anything different Not impossible something is setup wrongly there.
I will try installing the mqtt explorer and look into it and let you know results.
4.The ones I made is working yes. for triggers i use “device and “on_press action” in trigger for instance.
Again thank you so much for wasting your time on me and grasping at straws. I will test the suggestions and come back to you later!
I have been messing around a bit with explorer, I dont really know what to look for.
BUT
I think I got working.
I made 1 automation using mqtt topic instead of device, and it worked. So I looked in the yaml and into your script yaml and found that where mine under payload said : on_press your script says on-press
buy changing that in your script it seems to work.
Glad you’re making progress. For me the “on_press action” trigger disappeared when I put all the legacy on false in Z2M config, which is why I made the 2nd blueprint. If you still have the action trigger from the dimmer the older blueprint from 1st post should work.
Not really sure why the payload has underscore instead of dash for you, but if that works, it should be as easy as changing the dash to underscore for every action.
Maybe you have slightly different model of dimmer? You can see here it’s dash for me:
I know there are 2 models of the same dimmer too, I think the newer one has round corners, the other one (like mine) have square corners.
Just can’t stop wondering why of all the people who clicked (and presumably successfully used) the blueprint, only your device sends the payload with underscore instead of dash.
Edit: So far I only have 2 out of 3 dimmer switches in z2m, but they both use the _ instead of -
Ahh sorry
To me you are European
also my dimmer has other stickers then yours on back but same
Model number so no idea then
I thought it might have been because of different part of world