Switch template not calling turn_on / turn_off

I have defined a very simple template switch (switch.home_appliances), based on some sensor state (sensor.home_appliances), and turning on/off the LED diode ( switch.status5_red):

  - platform: template
    switches:
      home_appliances:
        value_template: "{{ is_state('sensor.home_appliances', 'on') }}"
        turn_on:
          service: switch.turn_on
          data:
            entity_id: switch.status5_red
        turn_off:
          service: switch.turn_off
          data:
            entity_id: switch.status5_red

The state of the switch changes correctly to on / off depending on the sensor’s state, but services under turn_on and turn_off are never executed. Have no idea what’s wrong.

I know that I could do this using automations (I have done this and it’s working perfectly, indeed), but I try to simiplify things, by using this template switch, which just “copies” sensor state and calls the proper service. But it looks like the switch is not able to recognize that it was turned on/off, thus never firing the proper actions (I have also tried different services).

Would you tell me, what’s going on?

I am using Hass.io on Raspberry Pi 3B+, 0.86.4 version.

(I have found topic with similar subject, but the overall problem was completely different)

Same problem. Template switch. Error: “Failed to call service switch/turn_on. Service not found.”.
HASS 0.93.2