Any suggestion for a double click switch

I now get a reply that i should create a feature request

Your issue was poorly explained. I have added a comment. Lets see what happens.

One more thing to try. Remove the stop action at the end of the actions. It does nothing as it is the end of the actions anyway. Also add continue_on_timeout: false.

alias: Slaapkamer dubbelklik is wit
description: ""
trigger:
  - platform: device
    device_id: 5ab7588692eda8af22cdba3ed5ace7f9
    domain: rfxtrx
    type: command
    subtype: "On"
condition: []
action:
  - wait_for_trigger:
      - platform: device
        device_id: 5ab7588692eda8af22cdba3ed5ace7f9
        domain: rfxtrx
        type: command
        subtype: "On"
    timeout:
      hours: 0
      minutes: 1
      seconds: 10
      milliseconds: 0
    enabled: true
    continue_on_timeout: false
  - service: light.turn_on
    data:
      brightness: 255
    target:
      entity_id:
        - light.milight_slaap_bovenspiegel
        - light.milight_slaap_onderspiegel
mode: single

Could it be because it’s device?
What happens if you use event or whatever other possible solutions to trigger this

Thanks:)
I am just a user not a SW develloper and not used to describe such a bug briefly
Your description is clear:)

Certainly worth a try.

1 Like

I have no clue what else could do the doubleclick.
There must be a timeout to finish the “ait for the 2nd click”
Because a single click should just switch the ligt on without any further action.

I also tried this

alias: Slaapkamer dubbelklik is wit
description: ""
trigger:
  - platform: device
    device_id: 871d35e5f69331803efcd124291a3ae2
    domain: rfxtrx
    type: command
    subtype: "On"
condition: []
action:
  - condition: state
    entity_id: switch.ac_0056fc3_10
    state: "on"
    for:
      hours: 0
      minutes: 1
      seconds: 0
  - service: light.turn_on
    data:
      brightness: 255
    target:
      entity_id:
        - light.milight_slaap_bovenspiegel
        - light.milight_slaap_onderspiegel
  - stop: ""
mode: single

but this resulted in:
Triggered by the event ‘rfxtrx_event’ at 6 maart 2023 om 15:18:21
Confirm Slaapkamer Bed is on for 1:00
Aborted at 6 maart 2023 om 15:18:21 (runtime: 0.01 seconds)

I think because the switch action that is seen is an event and not a state

Your logic is correct.
The issue I believe is the device platform.
It has issues and could be the reason.

Do you have a binary sensor for this switch? Or the switch itself as a entity?
Or is there an event? I don’t know what the device is so I’m just guessing here.
I posted pretty much the same automation as a solution yesterday, so the concept works.

@Hellis81 The purpose of your code is a bit different you want probably only to switch the bedligh on and not the rest.
I tried something similar

alias: Slaapkamer dubbelklik is wit
description: ""
trigger:
  - platform: device
    device_id: 871d35e5f69331803efcd124291a3ae2
    domain: rfxtrx
    type: command
    subtype: "On"
condition: []
action:
  - wait_for_trigger:
      - platform: device
        device_id: 871d35e5f69331803efcd124291a3ae2
        domain: rfxtrx
        type: command
        subtype: "Off"
    timeout:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
    continue_on_timeout: false
  - wait_for_trigger:
      - platform: device
        device_id: 871d35e5f69331803efcd124291a3ae2
        domain: rfxtrx
        type: command
        subtype: "On"
    timeout:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
    continue_on_timeout: false
  - service: light.turn_on
    data:
      brightness: 255
    target:
      entity_id:
        - light.milight_slaap_bovenspiegel
        - light.milight_slaap_onderspiegel
  - stop: ""
mode: single

~~~

But again I get this message:

Triggered by the event 'rfxtrx_event' at 6 maart 2023 om 15:25:59
Stopped because only a single execution is allowed at 6 maart 2023 om 15:25:59 (runtime: 0.00 seconds)

Can you please try with something else than the device platform?
I really believe that is the cause of your issue.

So again:

@Hellis81 The device is a 'Klikaan-Klikuit" Switch that is used via RFXcom in HA.
I have no cue how to use anything else:S

You can just open up the device in devices and integrations and have a look at what it exposes.
I have never heard of Klikaan-Klikuit or RFXcom so I don’t know what it exposes

@123 Thanks
Good to see how I can see an event and I tried this:

alias: Slaapkamer dubbelklik is wit
description: ""
trigger:
  - platform: device
    device_id: 871d35e5f69331803efcd124291a3ae2
    domain: rfxtrx
    type: command
    subtype: "On"
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 100
  - wait_for_trigger:
      - platform: event
        event_type: rfxtrx_event
        event_data:
          packet_type: 17
          sub_type: 0
          id_string: 0056fc3:10
          values:
            command: "On"
    timeout:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
    continue_on_timeout: false
  - service: light.turn_on
    data:
      brightness: 255
    target:
      entity_id:
        - light.milight_slaap_bovenspiegel
        - light.milight_slaap_onderspiegel
  - stop: ""
mode: single

but still I get the same error|

Triggered by the event ‘rfxtrx_event’ at 6 maart 2023 om 16:39:05
Stopped because only a single execution is allowed at 6 maart 2023 om 16:39:05 (runtime: 0.00 seconds)

Your still using device platform

1 Like

@Hellis81 you are right but I also tried this:

alias: Slaapkamer dubbelklik is wit
description: ""
trigger:
  - platform: event
    event_type: rfxtrx_event
    event_data:
      packet_type: 17
      sub_type: 0
      type_string: AC
      id_string: 0056fc3:10
      values:
        command: "On"
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 100
  - wait_for_trigger:
      - platform: event
        event_type: rfxtrx_event
        event_data:
          packet_type: 17
          sub_type: 0
          type_string: AC
          id_string: 0056fc3:10
          values:
            command: "On"
    timeout:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
    continue_on_timeout: false
  - service: light.turn_on
    data:
      brightness: 255
    target:
      entity_id:
        - light.milight_slaap_bovenspiegel
        - light.milight_slaap_onderspiegel
  - stop: gewone stop
mode: single

I still get the same result after I klick the 2nd time

Are you sure you are looking at the correct trace?
There should be two traces almost at the same time, one should have this message the other, the one before it is the one you should look at

1 Like

Ahhh now I see what you mean with the two traces
Never realized there was the other one.
I will investigate further but cannot do anymore today.
We have to leave till late
Thanks sofar!!!

This might a bit hacky. But works with my philips hue remote. Had to make it 1 second due to both Zigbee and the remote delay :smiley:
I had the same issue in a KNX installation and could only work with a logic module.
Its very basic in that the first click sets a helper to 1 and if nothing is pressed the delay will set the helper to 0. When you do press again the automation is restarted and first checks if the helper is set to on, when its on it will do the action and reset the helper to 0

Its low tech but works :smiley:

alias: DoubleClick Test
description: ""
trigger:
  - platform: device
    domain: mqtt
    device_id: a26f03d706ce19099bdcbffc3f5c1116
    type: action
    subtype: on-press
    discovery_id: 0x001788010965da9e action_on-press
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.doubleclick
            state: "on"
        sequence:
          - type: toggle
            device_id: 9b6af62963d4d029f3db6d8df5f2c6ca
            entity_id: switch.wcd_kerst_woonkamer
            domain: switch
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.doubleclick
      - conditions:
          - condition: state
            entity_id: input_boolean.doubleclick
            state: "off"
        sequence:
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.doubleclick
          - delay:
              hours: 0
              minutes: 0
              seconds: 1
              milliseconds: 0
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.doubleclick
mode: restart
1 Like

Hi @123 en @Hellis81
I have been trying thing today and I get it somehow working but:
great help also @123

alias: Slaapkamer dubbelklik is wit
description: ""
trigger:
  - platform: event
    event_type: rfxtrx_event
    event_data:
      packet_type: 17
      sub_type: 0
      type_string: AC
      id_string: "0218577:1"
      values:
        command: "On"
condition: []
action:
  - device_id: 871d35e5f69331803efcd124291a3ae2
    domain: rfxtrx
    type: send_command
    subtype: "On"
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: script.slaapkamer_licht_sfeer
    data: {}
  - wait_for_trigger:
      - platform: event
        event_type: rfxtrx_event
        event_data:
          packet_type: 17
          sub_type: 0
          type_string: AC
          id_string: "0218577:1"
          values:
            command: "On"
    timeout:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
    continue_on_timeout: false
  - service: light.turn_on
    data:
      brightness: 255
      color_temp: 153
    target:
      entity_id:
        - light.milight_slaap_bovenspiegel
        - light.milight_slaap_onderspiegel
        - light.milight_slaap_bed_hoofdeind
        - light.milight_slaap_plafond
  - stop: gewone stop
mode: single

The trace also shows what I expect.
I discovered I also had to decouple the Button from the light switch socket and that need so switch the wallplug socker ON and OFF by the automation
I need to do some more testing and optimizing but I think I am getting close

Thanks all sofar for all the help:)

@123
I think it uses pretty much what you suggested.
I tried something from remote (via the app when I was at work) but at that time I had no acces to the forum :woozy_face:
I have replaced the delay by switching on the light in friendly mode So that this is the default if not double clicked.
I think I only missed your

max_exceeded: silent

I added that but what does this line of code do?

But now I need to switch off the lights also from an automation niw HA
And that gives an other problem, a conflict if the double click automation is still running while I press the off button.

I triend something like tis in my light switch off automation:

action:
  - service: automation.turn_off
    data:
      stop_actions: true
    target:
      entity_id: automation.slaapkamer_dubbelklik_is_wit

But that does turn off the whole automation, but I also found I can turn it on again which seems to solve this problem.
I will do some more testing

I am still reading learning and sharing my thoughts/findings