Friends of Hue (ABB) switch reporting two events on long button press

I’m using this ABB friend of Hue switch paired to Philips Hue bridge:
https://new.abb.com/low-voltage/products/residential-product/friends-of-hue-smart-switch

On HA, I’m using ‘Event sensor’ HACS add-on to track the switch events.
When I, for example, hold both lower buttons to generate event ‘98’, immediately after that there comes event ‘99’ which means the lower buttons were shortly pressed (not holded). So holding first generates correct ‘hold’ event ‘99’, but immediately also ‘press’ event ‘99’.

I’m trying to catch these events to automate stuff in HA, but getting that ‘hold’ event is impossible when ‘press’ event overrides it. Those 2 events come 1s - 2s apart from each other.

Is there a bug somewhere or is it a feature?

Did you figure out a way to deal with this?

I am using the RunLessWire Friends of Hue switch, but get the same behavior; every long press also triggers the short press.

When configuring the switch via Hue app you can configure separate actions for short press versus long press, but in HA EventSensor history shows presses and releases.

Hi jusxon!

I really don’t recall this issue anymore, but I guess I just worked my way around it.
Could you try my code below? First there’s an automation to catch the initial button press. The automation then calls a script that will catch the actual action user wanted to execute. First create “input_text.abb_switch_action” that will catch the button action.

You have to figure out what states your buttons will generate. Mine will generate:
recall_scene_0
recall_scene_1
recall_scene_2

recall_scene_7
press_1_of_2
press_2_of_2
release_1_of_2
release_2_of_2

automation:
- id: actions_friends_of_hue_abb
    alias: 'Actions - Friends of Hue ABB'
    initial_state: on
    mode: single
    max_exceeded: silent
    trigger:
      - platform: state
        entity_id: 
        - sensor.0x000000000171037d_action
        - sensor.abb_katkaisija_keittio_action
        - sensor.abb_katkaisija_kylpyhuone_action
        to:
        - 'recall_scene_0'
        - 'recall_scene_1'
        - 'recall_scene_2'
        - 'recall_scene_3'
        - 'press_1_of_2'
        - 'press_2_of_2'
    action:
      - service: script.abb_switch_action        # Script called directly (not via script.turn_on), so execution waits for script to finish
      - condition: template
        value_template: "{{states('input_text.abb_switch_action') != 'Timeout'}}"
      ****  YOUR ACTIONS START HERE *****

script:
  abb_switch_action:   # Possible outcomes: "Single", "Double", "Triple", "Long"
    sequence:
      - wait_for_trigger:
          - platform: state
            entity_id: 
            - sensor.0x000000000171037d_action
            - sensor.abb_katkaisija_keittio_action
            - sensor.abb_katkaisija_kylpyhuone_action
            to:
            - 'recall_scene_4'
            - 'recall_scene_5'
            - 'recall_scene_6'
            - 'recall_scene_7'
            - 'release_1_of_2'
            - 'release_2_of_2'
        timeout:
          seconds: 0.5
        continue_on_timeout: true
      - choose:
          - conditions:
              - condition: template
                value_template: "{{ wait.trigger == None }}"
            sequence: 
              - wait_for_trigger:
                 - platform: state
                   entity_id: 
                   - sensor.0x000000000171037d_action
                   - sensor.abb_katkaisija_keittio_action
                   - sensor.abb_katkaisija_kylpyhuone_action
                   to:
                   - 'recall_scene_4'
                   - 'recall_scene_5'
                   - 'recall_scene_6'
                   - 'recall_scene_7'
                   - 'release_1_of_2'
                   - 'release_2_of_2'
                timeout:
                  seconds: 2
                continue_on_timeout: true
              - choose:
                  - conditions:
                    - condition: template
                      value_template: "{{ wait.trigger == None }}"
                    sequence: 
                      - service: input_text.set_value
                        data:
                          value: Timeout 
                        target:
                          entity_id: input_text.abb_switch_action
                default:
                  - service: input_text.set_value
                    data:
                      value: Long 
                    target:
                      entity_id: input_text.abb_switch_action
        default:
          - wait_for_trigger:
            - platform: state
              entity_id: 
              - sensor.0x000000000171037d_action
              - sensor.abb_katkaisija_keittio_action
              - sensor.abb_katkaisija_kylpyhuone_action
              to:
              - 'recall_scene_4'
              - 'recall_scene_5'
              - 'recall_scene_6'
              - 'recall_scene_7'
              - 'release_1_of_2'
              - 'release_2_of_2'
            timeout:
              seconds: 0.4
            continue_on_timeout: true
          - choose:
              - conditions:
                  - condition: template
                    value_template: "{{ wait.trigger == None }}"
                sequence: 
                  - service: input_text.set_value
                    data:
                      value: Single 
                    target:
                      entity_id: input_text.abb_switch_action
            default:
              - wait_for_trigger:
                - platform: state
                  entity_id: 
                  - sensor.0x000000000171037d_action
                  - sensor.abb_katkaisija_keittio_action
                  - sensor.abb_katkaisija_kylpyhuone_action
                  to:
                  - 'recall_scene_4'
                  - 'recall_scene_5'
                  - 'recall_scene_6'
                  - 'recall_scene_7'
                  - 'release_1_of_2'
                  - 'release_2_of_2'
                timeout:
                  seconds: 0.4
                continue_on_timeout: true
              - choose:
                  - conditions:
                      - condition: template
                        value_template: "{{ wait.trigger == None }}"
                    sequence: 
                      - service: input_text.set_value
                        data:
                          value: Double 
                        target:
                          entity_id: input_text.abb_switch_action
                default:
                  - service: input_text.set_value
                    data:
                      value: Triple 
                    target:
                      entity_id: input_text.abb_switch_action
1 Like

I have create an issue in the aiohue github repo because I was also seeing this. Workaround is great, but…

Friends of hue - always short_release before long_release · Issue #135 · home-assistant-libs/aiohue (github.com)

1 Like