deCONZ - Philips Friends of Hue Smart Switch (4 buttons)

i did a deCONZ blueprint of PTM 215ZE enocean like senic smart switch

Link to blueprint: deconz_friends_of_hue_smart_switch_fourfold_button.yaml

blueprint:
  name: deCONZ - Philips Friends of Hue Smart Switch (4 buttons)
  description: >
    Philips Friends of Hue Smart Switch (4 buttons), like senic https://de.senic.com based on PTM 215ZE EnOcean Alliance
  domain: automation
  source_url: https://github.com/myGithub-Markus/home-assistant_blueprints/blob/main/deconz_friends_of_hue_smart_switch_fourfold_button.yaml
  input:
    remote:
      name: Remote
      description: Senic remote
      selector:
        device:
          integration: deconz
          manufacturer: PhilipsFoH
          model: FOHSWITCH
    button_one_single_press:
      name: 1 button - Single press
      description: Action to run on a single press of the button 1
      default: []
      selector:
        action: {}
    button_one_hold_in:
      name: 1 button - Hold in
      description: Action to run when button 1 held in
      default: []
      selector:
        action: {}
    button_one_hold_release:
      name: 1 button - Hold release
      description:  Action to run when button 1 was held in and released
      default: []
      selector:
        action: {}
    button_two_single_press:
      name: 2 button - Single press
      description: Action to run on a single press of the button 2
      default: []
      selector:
        action: {}
    button_two_hold_in:
      name: 2 button - hold in
      description: Action to run when button 2 held in
      default: []
      selector:
        action: {}
    button_two_hold_release:
      name: 2 button - Hold release
      description:  Action to run when button 2 was held in and released
      default: []
      selector:
        action: {}
    button_three_single_press:
      name: 3 button - Single press
      description: Action to run on a single press of the button 3
      default: []
      selector:
        action: {}
    button_three_hold_in:
      name: 3 button - hold in
      description: Action to run when button 3 held in
      default: []
      selector:
        action: {}
    button_three_hold_release:
      name: 3 button - Hold release
      description:  Action to run when button 3 was held in and released
      default: []
      selector:
        action: {}
    button_four_single_press:
      name: 4 button - Single press
      description: Action to run on a single press of the button 4
      default: []
      selector:
        action: {}
    button_four_hold_in:
      name: 4 button - hold in
      description: Action to run when button 4 held in
      default: []
      selector:
        action: {}
    button_four_hold_release:
      name: 4 button - Hold release
      description: Action to run when button 4 was held in and released
      default: []
      selector:
        action: {}
    both_buttons_one_and_two_single_press:
      name: Both buttons 1 + 2 - Single press
      description: Action to run on a single press of both buttons 1 + 2
      default: []
      selector:
        action: {}
    both_buttons_one_and_two_hold_in:
      name: Both buttons 1 + 2 - hold in
      description: Action to run when both buttons 1 + 2 held in
      default: []
      selector:
        action: {}
    both_buttons_one_and_two_hold_release:
      name: Both buttons 1 + 2 - Hold release
      description: Action to run when both buttons 1 + 2 were held in and released
      default: []
      selector:
        action: {}
    both_buttons_three_and_four_single_press:
      name: Both buttons 3 + 4 - Single press
      description: Action to run on a single press of both buttons 3 + 4
      default: []
      selector:
        action: {}
    both_buttons_three_and_four_hold_in:
      name: Both buttons 3 + 4 - hold in
      description: Action to run when both buttons 3 + 4 held in
      default: []
      selector:
        action: {}
    both_buttons_three_and_four_hold_release:
      name: Both buttons 3 + 4 - Hold release
      description: Action to run when both buttons 3 + 4 were held in and released
      default: []
      selector:
        action: {}
        
mode: restart
max_exceeded: silent

trigger:
- platform: event
  event_type: deconz_event
  event_data:
    device_id: !input 'remote'

action:
- variables:
    event: '{{ trigger.event.data.event }}'
- choose:
  - conditions:
    - '{{ event == 1001 }}'
    sequence: !input 'button_one_hold_in'
  - conditions:
    - '{{ event == 1002 }}'
    sequence: !input 'button_one_single_press'
  - conditions:
    - '{{ event == 1003 }}'
    sequence: !input 'button_one_hold_release'
  - conditions:
    - '{{ event == 2001 }}'
    sequence: !input 'button_two_hold_in'
  - conditions:
    - '{{ event == 2002 }}'
    sequence: !input 'button_two_single_press'
  - conditions:
    - '{{ event == 2003 }}'
    sequence: !input 'button_two_hold_release'
  - conditions:
    - '{{ event == 3001 }}'
    sequence: !input 'button_three_hold_in'
  - conditions:
    - '{{ event == 3002 }}'
    sequence: !input 'button_three_single_press'
  - conditions:
    - '{{ event == 3003 }}'
    sequence: !input 'button_three_hold_release'
  - conditions:
    - '{{ event == 4001 }}'
    sequence: !input 'button_four_hold_in'
  - conditions:
    - '{{ event == 4002 }}'
    sequence: !input 'button_four_single_press'
  - conditions:
    - '{{ event == 4003 }}'
    sequence: !input 'button_four_hold_release'
  - conditions:
    - '{{ event == 5001 }}'
    sequence: !input 'both_buttons_one_and_two_hold_in'
  - conditions:
    - '{{ event == 5002 }}'
    sequence: !input 'both_buttons_one_and_two_single_press'
  - conditions:
    - '{{ event == 5003 }}'
    sequence: !input 'both_buttons_one_and_two_hold_release'
  - conditions:
    - '{{ event == 6001 }}'
    sequence: !input 'both_buttons_three_and_four_hold_in'
  - conditions:
    - '{{ event == 6002 }}'
    sequence: !input 'both_buttons_three_and_four_single_press'
  - conditions:
    - '{{ event == 6003 }}'
    sequence: !input 'both_buttons_three_and_four_hold_release'  
2 Likes

Thanks for sharing, very nice!

I checked my FoH switches, but my have no double click event (event==XXX4).
Each switch provides only 4 events, like written in the documentation https://www.home-assistant.io/integrations/deconz/

Switch code Description
1XXX Button #1 up to #6
XXX1 Button hold
XXX2 Button short release
XXX3 Button long release

@pawlizio thanks, your are right. I updated the blueprint to the following actions for each button and button combinations:

  • Single press (XXX2)
  • Hold in (XXX1)
  • Hold release (XXX3)

The code on github still says double press xxx4

the link was directly to the previous commit. Now I changed the link to main branch on my GitHub repo.

1 Like

Do you have any idea if this works with the Hue Tap-components too?

I’ve build my own ‘Friends of Hue’ switches a while ago, with the innards (Enocean switch) from a Hue Tap and Gira front.

It certainly looks the same as the PTM 215ZE but I’m not sue if it is.

1 Like

I don’t know but if it is the same platform from enocean model PTM 215ZE it should be fine.

It appears that it isn’t the same module. There are no long-press events when I use the deconz_event listener. Bummer.

I might buy one of the Scenic switches though, as I need one more anyway.

Thanks for your work :slight_smile:

1 Like

When I try to create an automation, there are no devices found to be selected as the switch. However, I do have a device “On/off switch (GreenPower_On_Off_Switch) - Firmware: Zigbee2MQTT 1.18.1”

Thanks, cant get the dim to work correctly though. Putting “increase” og “decrease” intensity does only do this in incremental terms when adding theese under “hold”. I would be preferable if holding down the buttons dimms or increases the intensity until you let go.

Hello,

Does this blueprint still work?
I always get an error.

Running core-2021.11.4

When i add an automation with this blueprint and when checking trace
Executed: 22. November 2021, 21:43:24

Error: UndefinedError: ‘dict object’ has no attribute ‘event’

id: '1637613785932'
alias: kuechemuh
description: ''
use_blueprint:
  path: myGithub-Markus/deconz_friends_of_hue_smart_switch_fourfold_button.yaml
  input:
    remote: 891857a839a6032d4bbca405c4e6f102
    button_one_single_press:
      - type: toggle
        device_id: eda9038576f9db44fdf4cf41d57f9978
        entity_id: light.shellyrgbw2_25c2a5
        domain: light
    button_two_single_press:
      - type: turn_off
        device_id: eda9038576f9db44fdf4cf41d57f9978
        entity_id: light.shellyrgbw2_25c2a5
        domain: light
    button_three_single_press:
      - type: turn_on
        device_id: eda9038576f9db44fdf4cf41d57f9978
        entity_id: light.shellyrgbw2_25c2a5
        domain: light
        brightness_pct: 100