Z2M Blueprint for EnOcean PTM 215Z Switch On-Off-Dimming

It now works, the “release_3” block can probely be made more simple, but it works.
A input_boolean must be created, named: dimming_occured

blueprint:
  name: zigbee2mqtt - EnOcean PTM 215Z Switch On-Off-Dimming
  description: Control on off and dimming switch
  domain: automation
  input:
    switch:
      name: switch
      description: on/off/dimming switch
      selector:
        entity:
          domain: sensor
    light:
      name: Light
      description: The light to control with top buttons
      selector:
        target:
          entity:
            domain: light
mode: restart
max_exceeded: silent
trigger:
  - platform: state
    entity_id: !input "switch"
    attribute: action
action:
  - variables:
      command: "{{ trigger.to_state.state }}"

  - choose:
      - conditions:
          - "{{ command == 'release_3' }}"
        sequence:
          - choose:
              - conditions:
                  - condition: state
                    entity_id: input_boolean.dimming_occured
                    state: "off"
                sequence:
                  - service: light.turn_off
                    data: {}
                    target: !input "light"

              - conditions:
                  - condition: state
                    entity_id: input_boolean.dimming_occured
                    state: "on"
                sequence:
                  - service: input_boolean.turn_off
                    target:
                      entity_id: input_boolean.dimming_occured
                    data: {}

      - conditions:
          - "{{ command == 'press_3' }}"
        sequence:
          - delay: "0.5"

          - service: input_boolean.turn_on
            target:
              entity_id: input_boolean.dimming_occured
            data: {}

          - repeat:
              count: "15"
              sequence:
                - service: light.turn_on
                  data:
                    brightness_step_pct: -10
                    transition: 1
                  target: !input "light"
                - delay: "0.5"

      - conditions:
          - "{{ command == 'press_1' }}"
        sequence:
          - service: light.turn_on
            target: !input "light"
            data: {}
          - delay: "0.5"
          - repeat:
              count: "15"
              sequence:
                - service: light.turn_on
                  data:
                    brightness_step_pct: 10
                    transition: 1
                  target: !input "light"
                - delay: "0.5"
2 Likes

Thank you so much for sharing this helpful blueprint! I cannot help making this snippet more simple but for my use case I need to be able to control 2 lights using the left and right rocker. Therefore, I extended your blueprint a bit like this:

blueprint:
  name: zigbee2mqtt - EnOcean PTM 215Z Switch On-Off-Dimming
  description: Control on off and dimming switch
  domain: automation
  input:
    switch:
      name: switch
      description: on/off/dimming switch
      selector:
        entity:
          domain: sensor
    left_light:
      name: Light
      description: The light to control with top/bottom left buttons
      selector:
        target:
          entity:
            domain: light
    right_light:
      name: Light
      description: The light to control with top/bottom right buttons
      selector:
        target:
          entity:
            domain: light

mode: restart
max_exceeded: silent
trigger:
  - platform: state
    entity_id: !input "switch"
    attribute: action
action:
  - variables:
      command: "{{ trigger.to_state.state }}"

  - choose:
      - conditions:
          - "{{ command == 'release_2' }}"
        sequence:
          - choose:
              - conditions:
                  - condition: state
                    entity_id: input_boolean.dimming_occured
                    state: "off"
                sequence:
                  - service: light.turn_off
                    data: {}
                    target: !input "left_light"

              - conditions:
                  - condition: state
                    entity_id: input_boolean.dimming_occured
                    state: "on"
                sequence:
                  - service: input_boolean.turn_off
                    target:
                      entity_id: input_boolean.dimming_occured
                    data: {}

      - conditions:
          - "{{ command == 'press_2' }}"
        sequence:
          - delay: "0.5"

          - service: input_boolean.turn_on
            target:
              entity_id: input_boolean.dimming_occured
            data: {}

          - repeat:
              count: "15"
              sequence:
                - service: light.turn_on
                  data:
                    brightness_step_pct: -10
                    transition: 1
                  target: !input "left_light"
                - delay: "0.5"

      - conditions:
          - "{{ command == 'press_1' }}"
        sequence:
          - service: light.turn_on
            target: !input "left_light"
            data: {}
          - delay: "0.5"
          - repeat:
              count: "15"
              sequence:
                - service: light.turn_on
                  data:
                    brightness_step_pct: 10
                    transition: 1
                  target: !input "left_light"
                - delay: "0.5"


      - conditions:
          - "{{ command == 'release_4' }}"
        sequence:
          - choose:
              - conditions:
                  - condition: state
                    entity_id: input_boolean.dimming_occured
                    state: "off"
                sequence:
                  - service: light.turn_off
                    data: {}
                    target: !input "right_light"

              - conditions:
                  - condition: state
                    entity_id: input_boolean.dimming_occured
                    state: "on"
                sequence:
                  - service: input_boolean.turn_off
                    target:
                      entity_id: input_boolean.dimming_occured
                    data: {}

      - conditions:
          - "{{ command == 'press_4' }}"
        sequence:
          - delay: "0.5"

          - service: input_boolean.turn_on
            target:
              entity_id: input_boolean.dimming_occured
            data: {}

          - repeat:
              count: "15"
              sequence:
                - service: light.turn_on
                  data:
                    brightness_step_pct: -10
                    transition: 1
                  target: !input "right_light"
                - delay: "0.5"

      - conditions:
          - "{{ command == 'press_3' }}"
        sequence:
          - service: light.turn_on
            target: !input "right_light"
            data: {}
          - delay: "0.5"
          - repeat:
              count: "15"
              sequence:
                - service: light.turn_on
                  data:
                    brightness_step_pct: 10
                    transition: 1
                  target: !input "right_light"
                - delay: "0.5"  

Nice work guys.
I did not see this before I made my own, so let me share that as well.

The original name of my device is SR-ZGP2801K4-FOH-E, even though it shows up as EnOcean PTM 215Z.

Functionality:

  • Allows for controlling two different lights
  • Long press - dim up or down depending on top/bottom button.
  • Short press - Toggle the light irregardless of direction pressed
  • Configure dimming speed and step size
  • Configure how long before a press is considered a long press

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

3 Likes