Last active
April 2, 2026 22:34
-
-
Save sdktr/029822e0c19432ae0adf54c8ea35efc8 to your computer and use it in GitHub Desktop.
hass - ptm215z_dimmer_control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: "EnOcean PTM 215Z - Z2M Persistent Dimmer MQTT v1 (Patched)" | |
| description: > | |
| PTM 215Z automation for Z2M (MQTT) with: | |
| - Short press toggles light | |
| - Long press dims light up/down | |
| - Persistent dim directions using input_text helpers | |
| domain: automation | |
| input: | |
| zigbee_device: | |
| name: PTM 215Z device | |
| selector: | |
| device: | |
| integration: mqtt | |
| hold_delay: | |
| name: Hold Delay (ms) | |
| default: 500 | |
| selector: | |
| number: | |
| min: 100 | |
| max: 1000 | |
| unit_of_measurement: milliseconds | |
| mode: box | |
| step: 10 | |
| hold_repeat_delay: | |
| name: Hold Repeat Delay (ms) | |
| default: 100 | |
| selector: | |
| number: | |
| min: 0 | |
| max: 500 | |
| unit_of_measurement: milliseconds | |
| mode: box | |
| step: 10 | |
| hold_max_duration: | |
| name: Max Hold Duration (seconds) | |
| default: 10 | |
| selector: | |
| number: | |
| min: 2 | |
| max: 30 | |
| unit_of_measurement: seconds | |
| mode: box | |
| step: 1 | |
| light_1: | |
| name: Light 1 | |
| selector: | |
| entity: | |
| domain: light | |
| light_2: | |
| name: Light 2 | |
| selector: | |
| entity: | |
| domain: light | |
| light_3: | |
| name: Light 3 | |
| selector: | |
| entity: | |
| domain: light | |
| light_4: | |
| name: Light 4 | |
| selector: | |
| entity: | |
| domain: light | |
| variables: | |
| light_1_entity: !input light_1 | |
| light_2_entity: !input light_2 | |
| light_3_entity: !input light_3 | |
| light_4_entity: !input light_4 | |
| helper_1: input_text.ptm215z_dimdir_1 | |
| helper_2: input_text.ptm215z_dimdir_2 | |
| helper_3: input_text.ptm215z_dimdir_3 | |
| helper_4: input_text.ptm215z_dimdir_4 | |
| mode: single | |
| max_exceeded: silent | |
| triggers: | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: press_1 | |
| id: press_1 | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: press_2 | |
| id: press_2 | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: press_3 | |
| id: press_3 | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: press_4 | |
| id: press_4 | |
| actions: | |
| - choose: | |
| - conditions: [{ condition: trigger, id: press_1 }] | |
| sequence: | |
| - variables: | |
| release_received: false | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ not states(helper_1) }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_1 }}" | |
| value: up | |
| - wait_for_trigger: | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: release_1 | |
| timeout: | |
| milliseconds: "{{ hold_delay | int }}" | |
| continue_on_timeout: true | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ wait.trigger is not none }}" | |
| sequence: | |
| - service: light.toggle | |
| target: | |
| entity_id: "{{ light_1_entity }}" | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ wait.trigger is none }}" | |
| sequence: | |
| - repeat: | |
| until: | |
| - condition: template | |
| value_template: "{{ release_received }}" | |
| sequence: | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ light_1_entity }}" | |
| data: | |
| brightness_step_pct: > | |
| {% if states(helper_1) == 'up' %}10{% else %}-10{% endif %} | |
| - wait_for_trigger: | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: release_1 | |
| timeout: | |
| milliseconds: "{{ hold_repeat_delay | int }}" | |
| continue_on_timeout: true | |
| - variables: | |
| release_received: "{{ wait.trigger is not none }}" | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ state_attr(light_1_entity, 'brightness') | int >= 255 }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_1 }}" | |
| value: down | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ state_attr(light_1_entity, 'brightness') | int <= 1 }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_1 }}" | |
| value: up | |
| # BUTTONS 2, 3, 4 follow the exact same pattern as BUTTON 1 | |
| - conditions: [{ condition: trigger, id: press_2 }] | |
| sequence: | |
| - variables: | |
| release_received: false | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ not states(helper_2) }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_2 }}" | |
| value: up | |
| - wait_for_trigger: | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: release_2 | |
| timeout: | |
| milliseconds: "{{ hold_delay | int }}" | |
| continue_on_timeout: true | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ wait.trigger is not none }}" | |
| sequence: | |
| - service: light.toggle | |
| target: | |
| entity_id: "{{ light_2_entity }}" | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ wait.trigger is none }}" | |
| sequence: | |
| - repeat: | |
| until: | |
| - condition: template | |
| value_template: "{{ release_received }}" | |
| sequence: | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ light_2_entity }}" | |
| data: | |
| brightness_step_pct: > | |
| {% if states(helper_2) == 'up' %}10{% else %}-10{% endif %} | |
| - wait_for_trigger: | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: release_2 | |
| timeout: | |
| milliseconds: "{{ hold_repeat_delay | int }}" | |
| continue_on_timeout: true | |
| - variables: | |
| release_received: "{{ wait.trigger is not none }}" | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ state_attr(light_2_entity, 'brightness') | int >= 255 }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_2 }}" | |
| value: down | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ state_attr(light_2_entity, 'brightness') | int <= 1 }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_2 }}" | |
| value: up | |
| # BUTTON 3 | |
| - conditions: [{ condition: trigger, id: press_3 }] | |
| sequence: | |
| - variables: | |
| release_received: false | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ not states(helper_3) }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_3 }}" | |
| value: up | |
| - wait_for_trigger: | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: release_3 | |
| timeout: | |
| milliseconds: "{{ hold_delay | int }}" | |
| continue_on_timeout: true | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ wait.trigger is not none }}" | |
| sequence: | |
| - service: light.toggle | |
| target: | |
| entity_id: "{{ light_3_entity }}" | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ wait.trigger is none }}" | |
| sequence: | |
| - repeat: | |
| until: | |
| - condition: template | |
| value_template: "{{ release_received }}" | |
| sequence: | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ light_3_entity }}" | |
| data: | |
| brightness_step_pct: > | |
| {% if states(helper_3) == 'up' %}10{% else %}-10{% endif %} | |
| - wait_for_trigger: | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: release_3 | |
| timeout: | |
| milliseconds: "{{ hold_repeat_delay | int }}" | |
| continue_on_timeout: true | |
| - variables: | |
| release_received: "{{ wait.trigger is not none }}" | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ state_attr(light_3_entity, 'brightness') | int >= 255 }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_3 }}" | |
| value: down | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ state_attr(light_3_entity, 'brightness') | int <= 1 }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_3 }}" | |
| value: up | |
| # BUTTON 4 | |
| - conditions: [{ condition: trigger, id: press_4 }] | |
| sequence: | |
| - variables: | |
| release_received: false | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ not states(helper_4) }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_4 }}" | |
| value: up | |
| - wait_for_trigger: | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: release_4 | |
| timeout: | |
| milliseconds: "{{ hold_delay | int }}" | |
| continue_on_timeout: true | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ wait.trigger is not none }}" | |
| sequence: | |
| - service: light.toggle | |
| target: | |
| entity_id: "{{ light_4_entity }}" | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ wait.trigger is none }}" | |
| sequence: | |
| - repeat: | |
| until: | |
| - condition: template | |
| value_template: "{{ release_received }}" | |
| sequence: | |
| - service: light.turn_on | |
| target: | |
| entity_id: "{{ light_4_entity }}" | |
| data: | |
| brightness_step_pct: > | |
| {% if states(helper_4) == 'up' %}10{% else %}-10{% endif %} | |
| - wait_for_trigger: | |
| - platform: device | |
| device_id: !input zigbee_device | |
| domain: mqtt | |
| type: action | |
| subtype: release_4 | |
| timeout: | |
| milliseconds: "{{ hold_repeat_delay | int }}" | |
| continue_on_timeout: true | |
| - variables: | |
| release_received: "{{ wait.trigger is not none }}" | |
| - choose: | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ state_attr(light_4_entity, 'brightness') | int >= 255 }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_4 }}" | |
| value: down | |
| - conditions: | |
| - condition: template | |
| value_template: "{{ state_attr(light_4_entity, 'brightness') | int <= 1 }}" | |
| sequence: | |
| - service: input_text.set_value | |
| data: | |
| entity_id: "{{ helper_4 }}" | |
| value: up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment