Rfxtrx device update triggers twice

I have a wireless RFXTRX wall switch (remote) that I use to trigger an automation to turn of all (hue) lights. At the end of the automation, a notification is sent. Strangely the notification was sent twice, so I looked at the debug log and noticed the event gets fired twice.

2018-06-04 21:46:04 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Device_id: 099acb612 device_update. Command: On
2018-06-04 21:46:04 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Rfxtrx fired event: (event_type: button_pressed, entity_id: switch.living_wallswitch_right, state: on)
2018-06-04 21:46:04 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Device_id: 099acb612 device_update. Command: On
2018-06-04 21:46:04 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Rfxtrx fired event: (event_type: button_pressed, entity_id: switch.living_wallswitch_right, state: on)

I am wondering if this is the technical physical behavior of the switch or that HA triggers an event 2 times.

This is the relevant config:

logger:
  default: warn
  logs:
    homeassistant.components.rfxtrx: debug

rfxtrx:
  device: !secret rfxtrx_device
  debug: yes

switch:
  - platform: rfxtrx
    automatic_add: false
    devices:
      0b1100250099acb60c010f60: # kaku wandschakelaar rechts
        name: Living Wallswitch Right
        fire_event: true

automation:
  - alias: Turn Off Living Devices
    trigger:
      - platform: event
        event_type: button_pressed
        event_data: 
          entity_id: switch.living_wallswitch_right
          state: 'off'
    action:
      - service: light.turn_off
        entity_id: group.living_lights
      - service: logbook.log
        data:
          name: Woonkamerverlichting
          message: uitgeschakeld
      - service: notify.admin
        data:
          message: 'Woonkamerverlichting uitgeschakeld.'

Who can help me pinpointing this?

Cc @Danielhiversen

I own a rfxtrx too and I vaguely remember there is a setting somewhere on signal repetitions. It’s either in rfxcom or in Homeassistant…

Yes, you can change the signal_repetitions

Or change the automation to listen for state change instead of events

thanks all. i will have a look when i am home.

If I read the docs correctly, this gives me the option to forced repeat the signal:

signal_repetitions (Optional): Because the RFXtrx device sends its actions via radio and from most receivers it’s impossible to know if the signal was received or not. Therefore you can configure the switch to try to send each signal repeatedly.

This is the opposite (I think) of what I need, since it appears that the switch itself is sending the signal twice (both for On and Off). I have not set this, so reducing it is impossible?

This is rather difficult, since the physical switch is basically only used to switch off all (Hue) lights when we go to bed. The state always is Off, so that trigger won’t fire, unless I’m missing something?

How can I see more raw data from the RFXCOM device through HA? (I’m using Hass.io).

If this is impossible I will need to plug the device into another Pi and use the rfxcmd tool to debug.

I have done some more investigation. Any switch I use triggers an event twice. Even for those that I have no specific configuration for. I am starting to think that the component / platform code is causing this.

Am am running Hassio 0.69.1 at the moment and can’t see any commits that might cause this behavior.

2018-06-05 22:02:45 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Device_id: 0bb13621 device_update. Command: On
2018-06-05 22:02:45 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Rfxtrx fired event: (event_type: button_pressed, entity_id: switch.kaku_remote_1, state: on)
2018-06-05 22:02:45 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Device_id: 0bb13621 device_update. Command: On
2018-06-05 22:02:45 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Rfxtrx fired event: (event_type: button_pressed, entity_id: switch.kaku_remote_1, state: on)
2018-06-05 22:02:46 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 0bb13621 Class: LightingDevice Sub: 0, Pkt_id: 0b11003500bb136201000060)
2018-06-05 22:02:46 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Device_id: 0bb13621 device_update. Command: Off
2018-06-05 22:02:46 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Rfxtrx fired event: (event_type: button_pressed, entity_id: switch.kaku_remote_1, state: off)
2018-06-05 22:02:46 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Device_id: 0bb13621 device_update. Command: Off
2018-06-05 22:02:46 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Rfxtrx fired event: (event_type: button_pressed, entity_id: switch.kaku_remote_1, state: off)

Can you clarify what you exactly mean with a switch? Is that a physical switch (suppose you have Kaku), or a switch inside Homeassistant?

I have a physical KaKu switch / remote attached to the wall. An RFXCOM device is connected to HA to listen to 433MHz signals.

I use the wall switch to trigger an automation to switch off my Hue lights.

My HA fires an event when an ON command is sent. The automation triggers on this event.

BTW, the same is happening with my front door bell. I notify the family when the door bell is pressed. This way we know when someone rings, even when we are not home. This ON command is also registered twice by HA. I can see this in the HA debug logs (copy above). Thus we receive 2 notifications in 1 go.

Just to be sure I tested a KaKu motion sensor. The ON command is show 3 (!) times in the HA logs. This is also new.

This did not use to be like this until some weeks (?) ago.

My assumption is that the rfxtrx component puts each event on the event bus twice. I can’t believe my RFXcom device started sending 2 commands or that all remotes start doing so.

I will upgrade from 0.69.1 to 0.70.1 first to see what changes. If still present I will submit an issue at github.

I upgraded to 0.70.1. No change in behavior. So I submitted an issue: