Light template, toggle button does not function

Hello everybody,

After hours of research, I am at the point of giving up. Hope you guys can help me.

I have a dumb RF outlet. This outlet is connected to hassio via a sonoff RF bridge.
This outlet is connected to my living room light
I have a script to turn on my light and an other script to turn it off.
The toggle button works fine, but my problem: this light turns also on and off based on automation (for example when the sun sets).
When the light switches on based on this automation, I do not see it toggle on in the UI (like a normal lamp does). Hope anyone can help me.

light:
  - platform: template
    lights:
      lightlivingtest:
        friendly_name: "lamp living test"
        turn_on:
          service: script.turn_on
          entity_id: script.1595744094783
        turn_off:
          service: script.turn_on
          entity_id: script.1595744120814

That’s to be expected because the light’s configuration has no value_template.

It’s purpose is to represent the current state of the controlled device. When you turn it on, it should report its new status via value_template.

If the device is incapable of reporting its status, you can use a “proxy” (a stand-in for the actual device). For example, your two scripts that are used to turn the device on and off can also set an input_boolean to on or off. The value_template can be set to monitor this input_boolean’s state.

ok thanks for the reply, which I read maybe 8 times:)
I do some research today (if my wife lets me) and try to make an input_boolean.

ok, I think I got it. Maybe not the most straight forward way, but it works:

  1. I let my automation run on scripts (I didn’t do that earlier)
  2. I created an input_boolean “lamplivingtest”
  3. I added this input boolean in my scripts. In this case, the input_boolean turned on, when the script of the lamp turns on and the other way arround
  4. in config.yaml I added:
light:
  - platform: template
    lights:
      lightlivingtest:
        friendly_name: "lamp living test"
         value_template: >
        {{ is_state('input_boolean.lamplivingtest', 'on') }}
      turn_on:
        - service: input_boolean.turn_on
          entity_id: input_boolean.lamplivingtest
        - service: script.1596095133552
      turn_off:
        - service: input_boolean.turn_off
          entity_id: input_boolean.lamplivingtest
        - service: script.1596095168180

Pobably not the most efficient way, because now I have 2 dummy switches: the input_boolean and the switch I created in configuration yaml.

Thanks for the help