Light template and Zen26

Just installed a zen26 tonight to control my garage lights. Since it shows up as a switch and not a light I created a template. I’ve since discovered that if I control the light with the physical switch or the actual switch in HA it does not update the state of the light template. However I can control the switch with the template just fine and will update state when using that.

Any Ideas whats going on or what I did wrong?

Here is the template I used:

- platform: template
      friendly_name: "Garage Lights"
      icon_template: mdi:lightbulb-fluorescent-tube
        service: switch.turn_on
          entity_id: "switch.garage_lights"
        service: switch.turn_off
          entity_id: "switch.garage_lights"

Use this this platform instead. It’s what it is for. Much easier:

Also, FYI the reason that your template light did not work is because you did not supply a value_template for home assistant to determine the light state.

Something like this would have done:

value_template: "{{ is_state('switch.garage_lights', 'on') }}"

But as I said use the light switch platform instead. It is much easier.

  - platform: switch
    name: "Garage Lights"
    entity_id: switch.garage_lights

I’ll have to look into the other template. Now as far as this switch template it does work for the most part, and two other templates work perfectly that control other lights. And with this one I can control the actual light using the template. It even updates when using it. It just isn’t being updated when the switch it’s self is used.

Use the switch platform.

does the icon_template work with this aswell?

The available options are here:

You can add icon: to anything using customize though.

      icon: "mdi:lightbulb-fluorescent-tube"

Got it working, thank you.

1 Like

Hi @JakeK, good that you got it working.

If you mark this thread as solved by selecting the answer which gave you the solution, other members will not jump in to try to help (like I just did) AND the topic will be useful for others having a similar issue.

I had passed out shortly after posting that. Didn’t see this until now. Someone checked the solution box before I could get to it.