Switch with status with binary_sensor

I`m trying for a few days to make an switch with the real status of an light.

I tried to make an switch template with an binary_sensor, the switch works but the icon doesn’t change from color.

Can anybody say me what I’m doing wrong

  - platform: template
    switches:
      skylight:
        friendly_name: "Skylight"
        value_template: "{{ is_state('binary_sensor.keukenkast.state', 'on') }}"
        turn_on:
          service: switch.turn_on
          data:
            entity_id: switch.keukenkast
        turn_off:
          service: switch.turn_off
          data:
            entity_id: switch.keukenkast

What do you mean the icon doesn’t change from color? Are you saying the switch doesn’t get the state correct from the binary sensor or you are hoping the icon changes color when you have it on vs off?

I’m hoping that the icon changes color when the binary sensor is on :slight_smile:

It should turn colour when it’s on but I find even some of my lights when on don’t properly load the colour. It may be a bug with HA.

So what I have made should work ?

Yeah it should in theory. The colour should change when true or false. When I get time I may try to troubleshoot and submit a bug if I can figure out why it doesn’t always change.

Thx for the help. And youre time. This would be very helpfull.

Any progress about this?

No, haven’t had a chance to troubleshoot yet. But all of mine seem to change to the color lately

OK, I think the problem is, that I’m using the Hasbian version because the ADS component doesn’t work with the hass.io

Still struggling here with this feature.
I’m using an ADS communication with an Beckhoff PLC

I use switches an binary sensors to control my lights.
when I put on the switch, I directly write it to 0 in my PLC so I get an button mode.

But I want an switch that turn ons the light. (this is working propaly) with an lightbulb that change of color by the binarySensor state. because there a lot of other logics to control my lights in the PLC.

I can’t imagine that nobody whants to know the real state is of the light you put on or off.