Friedi
January 30, 2025, 10:52am
125
Hi all. I tried out this blueprint but unfortunately it doesn’t work for me. The automation always stops due tue a template condition:
condition: template
value_template: |
{{
('release_' in trigger.payload_json.action and trigger.payload_json.elapsed is defined)
or 'press_' in trigger.payload_json.action
}}
The automation I tested is as following:
- id: "1738233416304"
alias: Schalter Schlafzimmer
description: ""
use_blueprint:
path: vandalon/z2m EnOcean PTM 215Z (Friends of Hue) switch.yaml
input:
controller: Lichtschalter Schlafzimmer
button_1_pressed:
- action: light.turn_on
target:
entity_id: light.schlafzimmerschrank_group
data:
kelvin: 2700
brightness_pct: 100
I have had the same issue - you need to enable Home Assistant experimental event entities
in Zigbee2MQTT > Settings > Home Assistant integration
Maybe someone has use for this. I needed support for dimming two different lights (depending on left or right buttons).
Left Buttons control corridor lights (incl. dimming)
Right Buttons control toilet lights (incl. dimming)
I updated the blueprint from @khvej8 to support dimming on all four buttons + add support for two different controllers.
Blueprint:
blueprint:
name: Z2M - EnOcean PTM215Z (Friends of Hue) switch, Dimming, v2.1
description: |
This blueprint is focusing on easy setting scenes and easy dimming of lights
The button on the left will dim+/dim- on one light (or a Z2M light group) when hold
Works with Zigbee2MQTT 2.0 and up
domain: automation
input:
controller_left:
name: (Zigbee2MQTT) Device Name (Left)
description: The name of the device as defined in z2m (e.g. Livingroom lamp). Important, If more lights are to be controlled, make a group in Z2M
default: ''
controller_right:
name: (Zigbee2MQTT) Device Name (Right)
description: The name of the device as defined in z2m (e.g. Livingroom lamp). Important, If more lights are to be controlled, make a group in Z2M
default: ''
base_topic:
name: (Zigbee2MQTT) Base mqtt topic
description: The base topic as configured in z2m. The standard is zigbee2mqtt
default: zigbee2mqtt
switch:
name: HA device name, action entity
description: The entity from HA
selector:
entity:
filter:
- integration: mqtt
domain: event
multiple: true
dim_speed:
name: Dimming Speed
description: The speed of the dimming effect.
default: 50
selector:
number:
min: 1
max: 500
step: 1
button_1_short_release:
name: Button 1 short release (upper left)
description: Action to run, when the button 1 is released after short pres.
default: []
selector:
action: {}
button_2_short_release:
name: Button 2 short release (lower left)
description: Action to run, when the button 2 is released after short press.
default: []
selector:
action: {}
button_3_short_release:
name: Button 3 short release (upper right)
description: Action to run, when the button 3 is released after short press.
default: []
selector:
action: {}
button_4_short_release:
name: Button 4 short release (lower right)
description: Action to run, when the button 4 is released after short press.
default: []
selector:
action: {}
button_13_short_release:
name: Button 1 and 3 short release (both upper)
description: Action to run, when the button 1 and 3 is released after short press.
default: []
selector:
action: {}
button_13_long_release:
name: Button 1 and 3 long release (both upper)
description: Action to run, when the button 1 and 3 is released after long press.
default: []
selector:
action: {}
button_24_short_release:
name: Button 2 and 4 short release (both lower)
description: Action to run, when the button 1 and 3 is released after short press.
default: []
selector:
action: {}
button_24_long_release:
name: Button 2 and 4 long release (both lower)
description: Action to run, when the button 1 and 3 is released after long press.
default: []
selector:
action: {}
mode: restart
max_exceeded: silent
triggers:
- trigger: state
entity_id: !input 'switch'
attribute: event_type
to:
- release_1
- release_2
- release_3
- release_4
- release_1_and_3
- release_2_and_4
- press_1
- press_2
- press_3
- press_4
- press_1_and_3
- press_2_and_4
variables:
base_topic: !input base_topic
controller_left: !input controller_left
controller_right: !input controller_right
dimspeed_p: !input 'dim_speed'
keypress: '{{ trigger.to_state.attributes.event_type }}'
timediff: >-
{{ (trigger.to_state.last_changed -
trigger.from_state.last_changed).total_seconds() }}
action:
- variables:
dimspeed_n: '{{ dimspeed_p | int * -1 }}'
- choose:
- conditions: '{{ keypress == ''press_1'' }}'
sequence:
- delay:
seconds: 1
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller_left ~ ''/set''}}'
payload: "{\"brightness_move_onoff\": {{ dimspeed_p }} }"
- conditions: '{{ keypress == ''press_2'' }}'
sequence:
- delay:
seconds: 1
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller_left ~ ''/set''}}'
payload: "{\"brightness_move_onoff\": {{ dimspeed_n }} }"
- conditions: '{{ keypress == ''press_3'' }}'
sequence:
- delay:
seconds: 1
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller_right ~ ''/set''}}'
payload: "{\"brightness_move_onoff\": {{ dimspeed_p }} }"
- conditions: '{{ keypress == ''press_4'' }}'
sequence:
- delay:
seconds: 1
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller_right ~ ''/set''}}'
payload: "{\"brightness_move_onoff\": {{ dimspeed_n }} }"
- conditions: '{{ keypress == ''release_1'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence:
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller_left ~ ''/set''}}'
payload: "{\"brightness_move\": \"stop\"}"
default:
- choose:
- conditions: '{{ true }}'
sequence: !input button_1_short_release
- conditions: '{{ keypress == ''release_2'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence:
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller_left ~ ''/set''}}'
payload: "{\"brightness_move\": \"stop\"}"
default:
- choose:
- conditions: '{{ true }}'
sequence: !input button_2_short_release
- conditions: '{{ keypress == ''release_3'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence:
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller_right ~ ''/set''}}'
payload: "{\"brightness_move\": \"stop\"}"
default:
- choose:
- conditions: '{{ true }}'
sequence: !input button_3_short_release
- conditions: '{{ keypress == ''release_4'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence:
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller_right ~ ''/set''}}'
payload: "{\"brightness_move\": \"stop\"}"
default:
- choose:
- conditions: '{{ true }}'
sequence: !input button_4_short_release
- conditions: '{{ keypress == ''release_1_and_3'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence: !input button_13_long_release
default:
- sequence: !input button_13_short_release
- conditions: '{{ keypress == ''release_2_and_4'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence: !input button_24_long_release
default:
- sequence: !input button_24_short_release
My Automation (YAML)
alias: Toilet Switch
description: ""
use_blueprint:
path: friends-of-hue-switch/friends-of-hue-switch-dim.yaml
input:
controller_left: Small Corridor
controller_right: Toilet
switch:
- event.toilet_switch_action
dim_speed: 100
button_1_short_release:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.small_corridor
button_3_short_release:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.toilet
button_4_short_release:
- action: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.toilet
button_2_short_release:
- action: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.small_corridor
My Automation (Visual)
Kudos to @khvej8 and @vandalon for their amazing work here!
2 Likes
khvej8
(Khvej8)
February 8, 2025, 1:47pm
128
@Friedi , think you use the blueprint in post #1 . This is a old version no working any more. Use one of the blueprints in post number 92.
I though that “post number 92” refered to the “92” in the URL when hovering the date in a post, but URL=community.home-assistant.io/t/zigbee2mqtt-enocean-ptm-215z-friends-of-hue-switch/429770/92 is this post:
, which contains no blueprint.
Lend a hand?
khvej8
(Khvej8)
February 25, 2025, 5:34am
130
When I mention #92 , then it is the number shown on the left side. There are 123 posts in all, and when on number92, it says 92/123… Hence, I assumed it was post 92.
However, you are right, if put into the URL, then it should say 95 in the end, like this
3 new versions, now based on Zigbee2MQTT version 2.0 and newer. It used the event trigger.
If you already use the blueprints, then just replace the code, reload automations or restart. Then open the automation and choose the “event.xxxx” instead of the old “sensor.xxx”
Simple version for setting scenes etc.
Dimming version, with smooth dimming
Advanced with all functions
Remember to enable Home Assistant experimental event entities in Z2M settings
Simpel Version:
blueprint:
name: Z2M - E…
1 Like
I got the blueprint iin #92 working now!
Thank you khvej8
1 Like
Langballen
(Mikkel Dam Junker)
March 23, 2025, 10:25am
132
Hi there.
Huge kudos for continuing this work - really appriciate it for my swtiches.
Wonder if it would be possible to have the Brightness_move AND color_temp_move run at the same time
I would like to imitate the “old” flouroscent bulb effect, witch gets more yellow when you dim it?
Maybe even calculate the color_temp as a function of the brightness?
Does that make sence?
atnas
April 15, 2025, 10:29pm
133
Nice work! Any plans to make the dimming buttons configurable? I’d like to use the top row for dimming instead, and just editing the blueprint seems too simple
khvej8
(Khvej8)
April 16, 2025, 5:30am
134
@Langballen , I have earlier made a version where the color temperature is controlled on the right buttoms. Will this work?
blueprint:
name: Z2M - EnOcean PTM215Z (Friends of Hue) switch, Dimming and Color-temp, v2
description: |
This blueprint is focusing on easy setting scenes and easy dimming and color-temp of lights
The button on the left will dim+/dim- on one light (or a Z2M light group) when hold
The button on the right will bright/warm the white color if the bulb ssupports this. Only on one light (or a Z2M light group) when hold
Works with Zigbee2MQTT 2.0 and up
domain: automation
input:
controller:
name: (Zigbee2MQTT) Device Name
description: The name of the device as defined in z2m (e.g. Livingroom lamp). Important, If more lights are to be controlled, make a group in Z2M
default: ''
base_topic:
name: (Zigbee2MQTT) Base mqtt topic
description: The base topic as configured in z2m. The standard is zigbee2mqtt
default: zigbee2mqtt
switch:
name: HA device name, action entity
description: The entity from HA
selector:
entity:
filter:
- integration: mqtt
domain: event
multiple: true
dim_speed:
name: Dimming Speed
description: The speed of the dimming/color-temp effect.
default: 50
selector:
number:
min: 1
max: 500
step: 1
button_1_short_release:
name: Button 1 short release (upper left)
description: Action to run, when the button 1 is released after short pres.
default: []
selector:
action: {}
button_2_short_release:
name: Button 2 short release (lower left)
description: Action to run, when the button 2 is released after short press.
default: []
selector:
action: {}
button_3_short_release:
name: Button 3 short release (upper right)
description: Action to run, when the button 3 is released after short press.
default: []
selector:
action: {}
button_4_short_release:
name: Button 4 short release (lower right)
description: Action to run, when the button 4 is released after short press.
default: []
selector:
action: {}
button_13_short_release:
name: Button 1 and 3 short release (both upper)
description: Action to run, when the button 1 and 3 is released after short press.
default: []
selector:
action: {}
button_13_long_release:
name: Button 1 and 3 long release (both upper)
description: Action to run, when the button 1 and 3 is released after long press.
default: []
selector:
action: {}
button_24_short_release:
name: Button 2 and 4 short release (both lower)
description: Action to run, when the button 1 and 3 is released after short press.
default: []
selector:
action: {}
button_24_long_release:
name: Button 2 and 4 long release (both lower)
description: Action to run, when the button 1 and 3 is released after long press.
default: []
selector:
action: {}
mode: restart
max_exceeded: silent
triggers:
- trigger: state
entity_id: !input 'switch'
attribute: event_type
to:
- release_1
- release_2
- release_3
- release_4
- release_1_and_3
- release_2_and_4
- press_1
- press_2
- press_3
- press_4
- press_1_and_3
- press_2_and_4
variables:
base_topic: !input base_topic
controller: !input controller
dimspeed_p: !input 'dim_speed'
keypress: '{{ trigger.to_state.attributes.event_type }}'
timediff: >-
{{ (trigger.to_state.last_changed -
trigger.from_state.last_changed).total_seconds() }}
action:
- variables:
dimspeed_n: '{{ dimspeed_p | int * -1 }}'
- choose:
- conditions: '{{ keypress == ''press_1'' }}'
sequence:
- delay:
seconds: 1
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller ~ ''/set''}}'
payload: "{\"brightness_move_onoff\": {{ dimspeed_p }} }"
- conditions: '{{ keypress == ''press_2'' }}'
sequence:
- delay:
seconds: 1
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller ~ ''/set''}}'
payload: "{\"brightness_move_onoff\": {{ dimspeed_n }} }"
- conditions: '{{ keypress == ''press_3'' }}'
sequence:
- delay:
seconds: 1
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller ~ ''/set''}}'
payload: "{\"color_temp_move\": {{ dimspeed_p }} }"
- conditions: '{{ keypress == ''press_4'' }}'
sequence:
- delay:
seconds: 1
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller ~ ''/set''}}'
payload: "{\"color_temp_move\": {{ dimspeed_n }} }"
- conditions: '{{ keypress == ''release_1'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence:
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller ~ ''/set''}}'
payload: "{\"brightness_move\": \"stop\"}"
default:
- choose:
- conditions: '{{ true }}'
sequence: !input button_1_short_release
- conditions: '{{ keypress == ''release_2'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence:
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller ~ ''/set''}}'
payload: "{\"brightness_move\": \"stop\"}"
default:
- choose:
- conditions: '{{ true }}'
sequence: !input button_2_short_release
- conditions: '{{ keypress == ''release_3'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence:
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller ~ ''/set''}}'
payload: "{\"color_temp_move\": \"stop\"}"
default:
- choose:
- conditions: '{{ true }}'
sequence: !input button_3_short_release
- conditions: '{{ keypress == ''release_4'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence:
- action: mqtt.publish
data:
topic: '{{ base_topic ~ ''/'' ~ controller ~ ''/set''}}'
payload: "{\"color_temp_move\": \"stop\"}"
default:
- choose:
- conditions: '{{ true }}'
sequence: !input button_4_short_release
- conditions: '{{ keypress == ''release_1_and_3'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence: !input button_13_long_release
default:
- sequence: !input button_13_short_release
- conditions: '{{ keypress == ''release_2_and_4'' }}'
sequence:
- choose:
- conditions: '{{ timediff > 1 }}'
sequence: !input button_24_long_release
default:
- sequence: !input button_24_short_release
khvej8
(Khvej8)
April 16, 2025, 5:33am
135
@atnas , no plans, and even it is possible it will just complicate the blueprint. So, I will not make a version like that.
As you mention, it is just a few needed changes. If you can not make it work, write.