I’ve created a Zigbee2MQTT blueprint for Friends Of Hue switches based on the enOcean PTM 215Z switches (Like Senic Gira, NIKO, Bush Jeager, EcoDim and others alike) This blueprint is based on the great work of Nick but based on MQTT instead of the legacy sensor created by z2m. Also using mode restart instead of single for easier dimming. Make sure you enable Elapsed in the z2m advanced settings. This is used to prevent a release after a short press to restart the automation prematurely.
Could I ask you a different question, related to adding the Niko FOH switch to Z2M? I see you have the options ‘button_1_held’. I’m currently adding mine to Z2M and only see “press_1” and “release_1”. Nothing like held / long press. Do you have any chance why this is?
This is because the switch (via z2m at least) does not send a held button command. Because of that i use a timer that times how long the “press_1” active before receiving the “release_1” that is then considered a “held_1”
Hey @vandalon
ich have bought three “Friends of Hue” (PTM 215Z) but I have some challanges to configurate them.
Light turn on and off works perfekt. But the hold/held don´t work. If I press the Button (1 or 2) for long time the brightnes change once for 10% up or down . But it will not be repeated. I have to push 10 times the button for a long time…
Elapsed is aktivated
I have try to add the mode „resart“ into yaml, becaus I cant take the option into your blueprint. Is that correct?
Because the PTM 215Z devices do not support “held” in itself , this is emulated by the blueprint.
The switch only send button press and release. The held is emulated by counting the time when the press command is received without being followed by the release command.
The held commands do not repeat automatically, you will have to do that your self with a loop. See the example in the top post. When creating a loop, the loop will automatically be interrupted when a new commands is received (the release command).
Okay, I understand.
I don’t like the follow sentence, but: In Hue (app) and iConnectHue (app) with Philips Hue Bridge it works. Therefore I am almost certain, there is somewhere a solution.
What’s are your opinion to the following? If you get the signal “press_1” and you do not get the information “release_1” under certain conditions (like less than 500ms) the operator wants to fade the light. (The light will be dimed). If you get the information “release_1” you stop the dim process.
For switch light on/off: If you get the command “press_1” and the command “release_1” under certain conditions (within 500ms) the lights switch on or off.
I don’t know if the hue bridge emulates the same behavior or if z2m missing the held signal. I’m guessing the FoH switches don’t send repeating signals or even a held signal because of the extra power needed for that. It makes more sense to me that the hue bridge works in the same way as the script above.
If you want dimming to work you can just use my example.
The hold delay is set in the blueprint. (default 500ms).
Meaning that if you hold the button for less then 500ms it’s considered a single press, anything longer is seen as a long press.
button_1_pressed:
- service: light.turn_on
target:
entity_id: light.woonkamer
button_2_pressed:
- service: scene.turn_off
target:
entity_id: light.woonkamer
button_1_held:
- repeat:
count: 11 #stop loop after 11 times because 11*24 > 255, 255 beging the max brightness
sequence:
- service: light.turn_on
data:
transition: 0.6
brightness_step: 24
target:
entity_id: light.woonkamer
- delay:
milliseconds: 300 #this delay is just to keep the loop from dimming to fast
button_2_held:
- repeat:
count: 11 #stop loop after 11 times because 11*24 > 255, 255 beging the max brightness and thus 255-(11*24) will always be 0.
sequence:
- service: light.turn_on
data:
transition: 0.6
brightness_step: -24
target:
entity_id: light.woonkamer
- delay:
milliseconds: 300 #this delay is just to keep the loop from dimming to fast
The above is what I use at home for dimming lights.
alias: TEST kl. Flur Lichtschalter 3
description: ''
use_blueprint:
path: vandalon/z2m EnOcean PTM 215Z (Friends of Hue) switch.yaml
input:
controller: kl. Flur Lichtschalter
button_1_pressed:
- type: turn_on
target:
entity_id: light.hue_lightstrip_arbeitszimmer
button_2_pressed:
- service: light.turn_off
target:
entity_id: light.hue_lightstrip_arbeitszimmer
button_1_held:
- repeat:
count: 11 #stop loop after 11 times because 11*24 > 255, 255 beging the max brightness
sequence:
- service: light.turn_on
data:
transition: 0.6
brightness_step: 24
target:
entity_id: light.hue_lightstrip_arbeitszimmer
- delay:
milliseconds: 300 #this delay is just to keep the loop from dimming to fast
button_2_held:
- repeat:
count: 11 #stop loop after 11 times because 11*24 > 255, 255 beging the max brightness and thus 255-(11*24) will always be 0.
sequence:
- service: light.turn_on
data:
transition: 0.6
brightness_step: -24
target:
entity_id: light.hue_lightstrip_arbeitszimmer
- delay:
milliseconds: 300 #this delay is just to keep the loop from dimming to fast
Would it theoretically be feasible to include the loops in the blueprint?
I have several of these switches that I want to migrate from Hue to z2m, and editing the automations manually seems a bit cumbersome and error-prone… By just looking at the blueprint it’s not immediately obvious to me how the templating mechanism works… :-/
Yes I do understand how to add loops manually. It’s just that I have several switches where I want to control lights in a consistent way (always on/dim/off). Having a “higher level” abstraction for this (probably common) case would be very convenient. For me, it’s kind of moot now because I have copied the loops everywhere manually. From looking at the blueprints, it wasn’t obvious for me how the template mechanism works / if this would be possible at all in a blueprint (opposed to the instances).
I am hoping someone can point me in the right direction. I have some PTM 216Z switches which should be similar to the 215Z.
When I press the button, action changes to “press_1” then “” then “release” (note no _1) and then “” again I am getting the feeling that the two stages where the thae action is Blank “” is what is causing my issue?
When I press a button I can see the automation being triggered but all the cases fail for some reason.
If I write a simple automation I can get the light to toggle