How to use a twice switching signal from zwave switch as trigger

Hello everyone,

I’m brand new to Homeassistant.
I’m currently switching from FHEM to Homeassistant.
At FHEM I had a so-called sequence with which I triggered an automatism in which, when I turned on a switch twice in quick succession, I carried out other actions in addition to the lamp that is connected to the switch. Basically like a scene switch.
Is there a solution for this in Homeassistant?
So far I have been too uncreative to solve this with automation by myself.

Thank you

Greetings
Timo

It is possible dependent on what your switch exposes. If it exposes single and double clicks it should be quite straight forward.

It is a fibaro switch and it exposes just a stable status on/off

What you want to accomplish is easily achieved by using scenes which some fibaro products support. Scenes allow your device to report single tap, multi taps, and press and hold to the controller. If your device supports scenes you should see something like this in the Z-Wave JS UI Control Panel. Using scenes as your trigger is easy. You select DEVICE as your trigger type then select your Z-Wave Device from the list then select CENTRAL SCENE ACTION as your trigger. Then you can select KeyPressed2x from the list of triggers.

brave_screenshot (8)

Unfortunately my fibaro switch does not provide a double click event.
So my question again, how can I have Homeassistant check whether an event has occurred twice in a row within a time window? In FHEM there is a sequence for something like this.

What’s the model of your switch.

Thanks for your answer, it is a Fibaro FGS222 Switch.
Do you have an idea for me?

Isn’t here someone who can help me?
I’m just try to use the sequence of switching the switch from off to on to off to on in 3 seconds or less as a trigger.

Before I share with you my solution I just want to say when it comes to automations there is no right or wrong way to accomplish something just more efficient and less efficient. There may be a better way to do this but this way works me.

I have a 300 series Z-Wave key fob that only sends one command no matter how fast or the number of times I press it. I was able to simulate multiple button presses by doing (4) things. If you have used any Z-Wave Scene Controller you will notice that there is a 1 sec delay between when you press a button and when it gets reported. Functionality wise my setup performs and exact same as any other scene controller.

Here’s what I did

  1. I setup a counter helper
  2. Everytime I press the button on my key fob it increments the counter
  3. After 1 second my automation resets the counter to 0 counter
  4. I then have my automation trigger based off the value of the counter helper and it’s duration. For example If my counter is on 3 for 1 sec then execute this action.If I adjust the timings I can make it alot more responsive.

Thank you very much, thats a very good idea and it works very well.

I have combined all the tree trigger into one automation.

This is my code for the automation:

alias: Zentralschalter
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - counter.zentralschalte
    above: 2
    id: Anzahl Schaltvorgänge
  - platform: state
    entity_id:
      - light.lampe_flur
    from: "off"
    to: "on"
    id: Schaltvorgang
  - platform: state
    entity_id:
      - light.lampe_flur
    for:
      hours: 0
      minutes: 0
      seconds: 5
    id: Reset Zähler
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Schaltvorgang
        sequence:
          - service: counter.increment
            metadata: {}
            data: {}
            target:
              entity_id: counter.zentralschalte
      - conditions:
          - condition: trigger
            id:
              - Reset Zähler
        sequence:
          - service: counter.set_value
            metadata: {}
            data:
              value: 0
            target:
              entity_id: counter.zentralschalte
      - conditions:
          - condition: trigger
            id:
              - Anzahl Schaltvorgänge
        sequence:
          - service: light.turn_off
            metadata: {}
            data: {}
            target:
              area_id: wohnzimmer
mode: parallel
max: 5

I have 2 automations. My Aeotec Keyfob 1 automation increments my counter by 1 everytime I press the button on my keyfob. If I wait more than 1 sec the counter resets to 0. My Aeotec Keyfob 2 automation tracks the stat of my counter. If my counter is on 2 for a seconds then it executes the action.

alias: Aeotec Keyfob 1
description: ""
trigger:
  - alias: Keyfob Button Pressed
    platform: event
    event_type: zwave_js_value_notification
    event_data:
      command_class: 43
      value: 1
      value_raw: 1
    id: Keyfob Button Pressed
condition: []
action:
  - service: counter.increment
    metadata: {}
    data: {}
    target:
      entity_id: counter.keyfob
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: counter.reset
    data: {}
    target:
      entity_id: counter.keyfob
mode: restart

alias: Aeotec Keyfob 2
description: ""
trigger:
  - alias: Keyfob Pressed 2x
    platform: state
    entity_id:
      - counter.keyfob
    to: "2"
    id: Keyfob Pressed 2x
    for:
      hours: 0
      minutes: 0
      seconds: 1
  - alias: Keyfob Pressed 3x
    platform: state
    entity_id:
      - counter.keyfob
    to: "3"
    id: Keyfob Pressed 3x
    for:
      hours: 0
      minutes: 0
      seconds: 1
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Keyfob Pressed 2x
        sequence:
          - service: switch.toggle
            metadata: {}
            data: {}
            target:
              entity_id: switch.studio_lights
      - conditions:
          - condition: trigger
            id:
              - Keyfob Pressed 3x
        sequence:
          - service: switch.toggle
            metadata: {}
            data: {}
            target:
              entity_id: switch.mini_plug_with_power_meter
mode: single