Zigbee2MQTT enOcean PTM 215Z (Friends of Hue) switch

Yes, I am still trying to figure out, how to convert this blueprint correctly to work with switch manager. I hope someone beats me to it :wink:

I still don’t know which blueprint I should use. Your blueprint from post #92, or the one, from chris’ repository a few posts above yours?

Erik, the blueprints are quite alike, both using the event trigger. Up to you, based on you need and requirements.

I will maintain my versions as long I have the switches myself, expected to be several years.

1 Like

I have 2 of the PTM 215Z remotes connected via Z2M. What is really annoying about these is there are no entities for these remotes, so i cannot reference them in automations, for example: “When button 1 is pressed, do this” or use them as bypasses in my other automations for controlling lights. How do i get past this obstacle? I’m fairly new to HA, so excuse my amateur-ism.

My switches are listed in the device tab of ZigBee2MQTT and in addition to that under Settings>Devices

This sounds like a problem on your side then. Are you sure, that you paired them correctly?

Thank you. That helps me a lot!

Do you have this setting enabled in Z2M? You need that since the 2.0 update.

You just need to send this payload:

{“brightness_move”: number_value}

number_value could be positive, negative. “stop” or 0 and the brightness move will stop

Zigbee2MQTT - PTM215Z/ZE I have created a blueprint which does not require the elapsed function. It has the same design as the nice work from @vandalon

Erik, sorry. Was not meant as beeing rude, however what do you expect me to answer.

There are 2 people making quite similar blueprints. I could answer that my blueprint was the best, however who am I to state that, never trying the other. I could also claim that someone else blueprint was the best, again would just be a statement.

So, you need to either try or just jump for one of them. They are all described.

And, I was not trying to be rude.

Sorry. Sometimes sentences with a different look seem mean. But that was indeed meant honestly and was not intended as sarcasm.

1 Like

Chris, it was the zigbee command to control the “color temperatur” of the white bulb which was needed, not the brightness. Do you know?

@khvej8

Oups…I read too quickly.

It should be color_temp_move with a positive, negative value. Like the brightness, you should send 0 or stop value to stop

The payload will look {“color_temp_move”: 40}

You may also use a step move. The payload will then be {“color_temp_step”: -40}

1 Like

Thank you!

Now i got an action entity in HA, but as the screenshot implies, it will still be pretty impossible to use this in an automation if the entity just “detected an event”.

@ErikSteiner , you asked whether i have it properly connected. How can i check this? When i got it i reset it and set it to pairing mode, paired it with Z2M and then used this blueprint to configure the buttons. It works, but i only have one entity in HA. Here are some additional screenshots. The switch is called “Badeværelse_Afbryder_Enocean”.

I hope you can help me further with getting more… elaborate entities in HA that i can use in automations. Thanks in advance.

If you go to “settings” - “Devices&Service” - “Devices” and choose the switch, then on the left side there is a “automations box”. There is a small “+”. If you press this, a new automation opens, and you can select the button to automate.

Easier is to use one of the blueprints, like the “simple” in post #92. Will give a select for choosing the switch, and press and release for all 4 buttons.

Erik, some time ago you asked if the blueprint could control the color-temperatur. There is a new version in post #92 which on the right button with bright/warm the color of bulbs supporting this.

All thanks to chris-1243 for the needed zigbee command.

1 Like

So I’m using the original vandalon automation, but I’d like to have scenes for double and possible triple and quadruple presses, anyone can point me in the right direction?

Im pretty new to this, can you send me a complete yaml of your ligth so i can see how you set up the entity ? :blush: (for dimming)

In post no. 92 in this thread, there is a blueprint including dimming. The blueprint have the yaml.

Copy the dimming blueprint to a file, e.g. “Z2M-enocean-dimming.yaml”. Place the file in “config/blueprints/automations’ and restart HA. You should now be able to create a automation from the blueprint.

Year that part i got, but when i set in a light in i can only get it to turn on af off not dim :frowning: using this

The kbltest.yaml is Z2M-enocean-dimming.yaml

alias: køktest
description: ""
use_blueprint:
  path: KBL TEST/kbltest.yaml
  input:
    controller: Køkken kontakt
    switch:
      - event.kokken_kontakt_action
    button_1_short_release:
      - action: light.turn_on
        metadata: {}
        data:
          brightness_step_pct: 10
        target:
          entity_id: light.kokken_3
    button_1_repeat:
      - action: light.turn_on
        metadata: {}
        data:
          brightness_step_pct: 10
        target:
          entity_id: light.kokken_3
    button_3_short_release:
      - action: light.turn_on
        metadata: {}
        data:
          brightness_step_pct: -10
        target:
          entity_id: light.kokken_3
    button_3_repeat:
      - action: light.turn_on
        metadata: {}
        data:
          brightness_step_pct: -10
        target:
          entity_id: light.kokken_3

I think you use the blueprint from post #72 and not from post #92. There is no “repeat” function in the new versions. The new versions use zigbee commands to avoid the “non smooth” dimming, using HA commands.

An example of my blueprint yaml below. The important part is setting the MQTT name of the light or light group. In the below example “Gang All” is a Zigbee2MQTT group, created in Z2M and called “Gand All”. It will also work with the name of a light bulb, if only a single bulb.

alias: Gang Kontakter
description: ""
use_blueprint:
  path: Zigbee2mqtt-Enocean-Dimming-v2.yaml
  input:
    controller: Gang All
    switch:
      - event.gang_nede_kontakt_action
      - event.gang_oppe_kontakt_action
    button_1_short_release:
      - action: scene.turn_on
        metadata: {}
        target:
          entity_id: scene.gang_high
        data: {}
    button_2_short_release:
      - action: scene.turn_on
        metadata: {}
        target:
          entity_id: scene.gang_low
        data: {}
    button_3_short_release:
      - action: scene.turn_on
        metadata: {}
        target:
          entity_id: scene.gang_medium
        data: {}
    button_3_long_release:
      - action: scene.turn_on
        metadata: {}
        target:
          entity_id: scene.gang_medium_2
        data: {}
    button_4_short_release:
      - action: light.turn_off
        metadata: {}
        data: {}
        target:
          area_id: gang
    button_4_long_release:
      - action: scene.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: scene.gang_low_2

And the current version of the dimming blueprint, to avoid misunderstandings.

blueprint:
  name: Z2M - EnOcean PTM215Z (Friends of Hue) switch, Dimming, v2
  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:
      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 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_3_long_release:
      name: Button 3 long release (upper right)
      description: Action to run, when the button 3 is released after long 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_4_long_release:
      name: Button 4 long release (lower right)
      description: Action to run, when the button 4 is released after long 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 == ''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: !input button_3_long_release
        default:
        - choose:
          - conditions: '{{ true }}'
            sequence: !input button_3_short_release

    - conditions: '{{ keypress == ''release_4'' }}'
      sequence:
      - choose:
        - conditions: '{{ timediff > 1 }}'
          sequence: !input button_4_long_release
        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

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