Wall switch toggle on / off automation

I have loads of rfxtrx (433.92) wall switches around the house, each wall switch can send two states; on or off.

Is it possible to make a light / group / scene toggle on off, based on the value that I receive from the switch? Or do I need to create one automation for “Off” state and one automation for “On” state?

I have this now:

  - alias: Livingroom top left switch
    trigger:
      platform: event
      event_type: button_pressed
      event_data: {"state": "on", "entity_id": "switch.livingroom_switch_left"}
    action:
      service: light.turn_on
      entity_id: light.livingroom_dimmer

If you can make one trigger get called for either on or off then you can use service_template in the action to use a template to decide whether to call the light.turn_on service or the light.turn_off one.

Thank you for giving me the right words to search :slight_smile:
I’m obviously new to HA, experienced developer though, but I have a hard time reading docs for this system.

I guess this is how you meant:

service_template: light.{% if is_state('switch.test_switch', 'on') %}turn_on{% else %}turn_off{% endif %}

Yeah that might work. I normally just do the whole name (light.turn_on) after the if/else conditions, but if that works then you’re good to go. If you ever need to test a template you can use the template editor in the webapp.

It would be great if you provided your finished solution so we can all benefit.
Thanks

Not quite wall switches but related mains socket outlets - in NZ I have found that Trust Smart Home brand e.g. https://smarthomenz.nz/collections/sale/products/wireless-switching-set-acd3-2400r 433.92 mhz plug in mains sockets work well with RFXtrx433e transceiver with transceiver configured as Lighting2 AC and controlled through Home Assistant.