Persistent state of RF-controlled plugs with input_boolean

Hello!

I’ve just gotten started with Home Assistant: installed it on my Raspberry Pi 3 with the pre-cooked VM image on an SD card (version 0.107.6). First of all, kudos to the developers, maintainers, and community. Home Assistant is quite impressive!

I have 5 RF-controlled (433 MHz) plugs distributed in my apartment, each controlling a light, which I switch on and off with a transceiver connected to the GPIO pins of my Raspberry Pi. The following lines in my configuration.yaml do the magic, e.g.:

switch:
  - platform: rpi_rf
    gpio: 17
    switches:
        # 1 in the remote control
        llum_peu_tele:
            code_on:  XXXXXXX # Actual number here...
            code_off: XXXXXXX # Actual number here...
            pulselength:  170
            signal_repetitions: 15

Works beautifully. The only annoying problem is that when I reboot the Raspberry Pi, the state is gone: all switches reset to off.

After searching left and right in the forum, I have the following alternative (maintaining the switch lines above):

input_boolean:
    testbool:
        name: Test1
        icon: mdi:floor-lamp

automation:
    - alias: 'Test input_boolean'
      trigger:
        platform: state
        entity_id: input_boolean.testbool
        to: 'on'
      action:
        service: switch.turn_on
        entity_id: switch.llum_peu_tele

With this scheme I can turn the light on/off and, additionally, the input_boolean maintains the state after reboots (the switch does not).

I could add one such block for every switch (power plug) and every trigger (on/off), but it strikes me as too cumbersome. Also, with this scheme I see both the input boolean and the switch in my Lovelace interface, but that’s a minor issue (and can probably be solved easily once I have a bit more experience).

Is there a straightforward way to add the input_boolean functionality to a switch so as to retain its state under reboots? Is the input_boolean my only hope?

Many thanks in advance for any pointer you may provide!

PS: I’ve searched extensively in the forum and did not manage to find an obvious solution. Apologies in advance in case I failed to find the right post.