Niko ZGP friends of Hue (EnOcean PTM 215Z, ...) with Zigbee2MQTT

Hello there,

I did something for this switch, hope this help:

First, in mqtt section of my configuration.yaml (mine is in a separated file)
IMPORTANT: Change the topic names to match yours

  - binary_sensor:
      - name: "Niko ZGP - Button A0"
        unique_id: 43f1df9d-287f-4af1-9b6e-43f0280fcb6e
        icon: mdi:grid-large
        state_topic: "zigbee2mqtt/Niko ZGP/action"
        payload_on: "press_1"
        payload_off: "release_1"
        availability:
          - topic: "zigbee2mqtt/Niko ZGP/availability"
            payload_available: "online"
            payload_not_available: "offline"
      - name: "Niko ZGP - Button A1"
        unique_id: be9a9003-1215-4e10-9d9f-023bf2eebd1d
        icon: mdi:grid-large
        state_topic: "zigbee2mqtt/Niko ZGP/action"
        payload_on: "press_2"
        payload_off: "release_2"
        availability:
          - topic: "zigbee2mqtt/Niko ZGP/availability"
            payload_available: "online"
            payload_not_available: "offline"
      - name: "Niko ZGP - Button B0"
        unique_id: d9eb7127-4360-439d-9ead-77b8df877af8
        icon: mdi:grid-large
        state_topic: "zigbee2mqtt/Niko ZGP/action"
        payload_on: "press_3"
        payload_off: "release_3"
        availability:
          - topic: "zigbee2mqtt/Niko ZGP/availability"
            payload_available: "online"
            payload_not_available: "offline"
      - name: "Niko ZGP - Button B1"
        unique_id: 4b38e7ba-3dc5-4c1f-8acf-50b83e59a185
        icon: mdi:grid-large
        state_topic: "zigbee2mqtt/Niko ZGP/action"
        payload_on: "press_4"
        payload_off: "release_4"
        availability:
          - topic: "zigbee2mqtt/Niko ZGP/availability"
            payload_available: "online"
            payload_not_available: "offline"
      - name: "Niko ZGP - Button A0 and B0"
        unique_id: 19de44ef-dce0-4b0d-9489-eee6f16fcc0d
        icon: mdi:grid-large
        state_topic: "zigbee2mqtt/Niko ZGP/action"
        payload_on: "press_1_and_3"
        payload_off: "release_1_and_3"
        availability:
          - topic: "zigbee2mqtt/Niko ZGP/availability"
            payload_available: "online"
            payload_not_available: "offline"
      - name: "Niko ZGP - Button A1 and B1"
        unique_id: f81c7ddc-825a-41e2-8fdd-ae3b25b270b0
        icon: mdi:grid-large
        state_topic: "zigbee2mqtt/Niko ZGP/action"
        payload_on: "press_2_and_4"
        payload_off: "release_2_and_4"
        availability:
          - topic: "zigbee2mqtt/Niko ZGP/availability"
            payload_available: "online"
            payload_not_available: "offline"
      - name: "Niko ZGP - Energy bar"
        unique_id: 3bee94b4-6ae5-4f37-97ec-cd56b7f7ebbd
        icon: mdi:grid-large
        state_topic: "zigbee2mqtt/Niko ZGP/action"
        payload_on: "press_energy_bar"
        off_delay: 1
        availability:
          - topic: "zigbee2mqtt/Niko ZGP/availability"
            payload_available: "online"
            payload_not_available: "offline"

That will create a binary sensor for each of the available buttons (and a special one) : button A0, A1, B0, B1, A0&B0, A1&B1 and “Energy Bar” (click without any button)

You can stop there but to detect short press and long press and multiply the fun and the number of trigger by 2, those templates:

# Niko switch
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_a0
        for:
          seconds: 1
    binary_sensor:
      - name: "Niko ZGP Button A0 - Long Press"
        icon: mdi:grid-large
        unique_id: 191df587-1104-4193-98dd-f671aa51fb1f
        state: "{{ trigger.to_state.state == 'on' }}"
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_a0
    binary_sensor:
      - name: "Niko ZGP Button A0 - Short Press"
        icon: mdi:grid-large
        unique_id: b8e8ffb6-518c-49af-9894-30139fe7ad46
        state: "{{ trigger.to_state.state == 'on' }}"
        auto_off: 1
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_a1
        for:
          seconds: 1
    binary_sensor:
      - name: "Niko ZGP Button A1 - Long Press"
        icon: mdi:grid-large
        unique_id: 41d3280d-751a-4d6e-a921-62895238cb9e
        state: "{{ trigger.to_state.state == 'on' }}"
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_a1
    binary_sensor:
      - name: "Niko ZGP Button A1 - Short Press"
        icon: mdi:grid-large
        unique_id: 03067789-77ef-4bc4-8a8f-0f21dfa752dc
        state: "{{ trigger.to_state.state == 'on' }}"
        auto_off: 1
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_b0
        for:
          seconds: 1
    binary_sensor:
      - name: "Niko ZGP Button B0 - Long Press"
        icon: mdi:grid-large
        unique_id: 8f77581b-c6d7-4f35-bdab-e06232500aef
        state: "{{ trigger.to_state.state == 'on' }}"
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_b0
    binary_sensor:
      - name: "Niko ZGP Button B0 - Short Press"
        icon: mdi:grid-large
        unique_id: aee9d976-0eb1-4f43-a66f-1c86466b744f
        state: "{{ trigger.to_state.state == 'on' }}"
        auto_off: 1
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_b1
        for:
          seconds: 1
    binary_sensor:
      - name: "Niko ZGP Button B1 - Long Press"
        icon: mdi:grid-large
        unique_id: 9c1313e3-c930-4712-9d35-cafeada6f614
        state: "{{ trigger.to_state.state == 'on' }}"
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_b1
    binary_sensor:
      - name: "Niko ZGP Button B1 - Short Press"
        icon: mdi:grid-large
        unique_id: 583cee62-56cf-45e6-8f02-4f060d58ece0
        state: "{{ trigger.to_state.state == 'on' }}"
        auto_off: 1
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_a0_and_b0
        for:
          seconds: 1
    binary_sensor:
      - name: "Niko ZGP Button A0 and B0 - Long Press"
        icon: mdi:grid-large
        unique_id: 37a5abc0-1397-4493-9c6a-318b9c22c68a
        state: "{{ trigger.to_state.state == 'on' }}"
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_a0_and_b0
    binary_sensor:
      - name: "Niko ZGP Button A0 and B0 - Short Press"
        icon: mdi:grid-large
        unique_id: 0c9816a4-0fc3-423f-b74c-3f8a39c9ef35
        state: "{{ trigger.to_state.state == 'on' }}"
        auto_off: 1
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_a1_and_b1
        for:
          seconds: 1
    binary_sensor:
      - name: "Niko ZGP Button A1 and B1 - Long Press"
        icon: mdi:grid-large
        unique_id: 54f4f0a4-267b-4792-a064-d155f592b5dc
        state: "{{ trigger.to_state.state == 'on' }}"
  - trigger:
      - platform: state
        entity_id: binary_sensor.niko_zgp_button_a1_and_b1
    binary_sensor:
      - name: "Niko ZGP Button A1 and B1 - Short Press"
        icon: mdi:grid-large
        unique_id: 1a93b68c-998e-4605-ba48-2ee38c14fc37
        state: "{{ trigger.to_state.state == 'on' }}"
        auto_off: 1

You can reuse my unique_id’s if you want or put yours. Replace Niko with whatever you want, it is because mine is of that brand.

EDIT: I did not do the short/long press for the energy bar as to have this event you already need to dismantle the switch, I think it is quite useless.

1 Like

Salut cher compatriote.
J’ai enfin réussi à faire connaitre les Niko FOH dans Z2M mais je galère un peu.
Moyen de se contacter sur un réseau quelconque pour que tu m’explique un peu ?
Car suis assez néophite