Create virtual switch for events that are pressed on remote RFXCOM

Hello,

I’ve capturedtwo events form an physical remote with the RFXCOM integration
The two events are both displayed in the always ON state.

image
For the On button it looks like its always ON modus

for the off button that i captured also, the ON state is active

image

On both when I press the ON button again, it fires the correct commands.

How can ik make a virtual switch in HA that captures if the remote is used? or when i use an automation to fire the ON command, but then displays de latest state ON or OFF on the dasboard.

Take a look at Template Switch:

can you help me a litte ahead with this template switch?

switch:
  - platform: template
    switches:
      my_remote_switch:
        value_template: "{{ is_state('switch.remote1','on') }}"
        turn_on:
          service: switch.turn_on
            target:
              entity_id: switch.remote1
        turn_off:
          service: switch.turn_on
            target:
              entity_id: switch.remote2

Something like that.

You’ll probably need to create an automation though that will react to those 2 switches being turned on, because if remote1 is turned on, then you need to turn off remote2 and if remote2 is turned on you need to turn off remote1 - so that the switch will have the right state.

Also you should be aware that the switches that you posted pictures of, are not in the always on status - they are in the indeterminate status, where Home Assistant does not know if the switch is on or off - so it shows both.