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
  lights:
    garage_light_template_switch:
      friendly_name: "Garage Lights"
      icon_template: mdi:lightbulb-fluorescent-tube
      turn_on:
        service: switch.turn_on
        data:
          entity_id: "switch.garage_lights"
      turn_off:
        service: switch.turn_off
        data:
          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. https://www.home-assistant.io/integrations/light.template/#value_template

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.

light:
  - 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: https://www.home-assistant.io/integrations/light.switch/#configuration-variables

You can add icon: to anything using customize though.

homeassistant:
  customize:
    light.garage_lights:
      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.