One switch to control multiple devices

Coming from a number of other home automation systems, I’m finding that most of my (small) struggles moving to Home Assistant have come from thinking of things in another way, and not getting the ‘HA’ way of thinking.

One thing I haven’t found a way to do is set things up such that one zwave switch not only controls the light attached to it, but other lights. The exact use case I have here is a zwave switch that controls a light fixture in the room, and two zigbee bulbs in lamps around that room. If the switch goes on, I want the bulbs on. If the switch goes off, I want the bulbs off.

Yes, I could do this in automation, and I could do this in node-red. Both feel like overkill. Typically there’s a way to group, gang, scene, or whatnot, but what’s the HA ‘best practice’ way of doing this?

Or is something like that still automation?

To control a bunch of lights as one light, use a light group:

If you want to control the light group from a switch use a template light:

2 Likes

Thanks. Really not sure how I missed that.

Actually, I probably jumped to the harder stuff and skipped the basics. Darn.

Actually reading your question again, the Light Group is appropriate but the Template Light is not.

To control a light from a switch you do really need an automaton. This can be made reasonably compact using templates, e.g:

automation:
  alias: your_light_control
  intital_state: true
  trigger: 
    platform: state
    entity_id: switch.your_switch
  action:
    service_template: >
      {% if trigger.to_state.state == 'on' %}
        light.turn_on
      {% else %}
        light.turn_off
      {% endif %}
    entity_id: light.your_light

Thanks for thinking it through, and the example. I reached the same conclusion. Ganging lights together seems like it ought to be very easy, but as you said the automation is pretty simple and compact. Either way, I’ve got it working as I wanted now. Thanks again.

This was relevant to me: if you’re second light is controlled using a smart plug or similar (i.e. not the light itself is connected via ZigBee) you can change the device type of this plug or switch to Light. This way, you can add it to a light group as well:

Settings → Devices & Services → Helpers → Create Helper → Change device type of a switch. Select “Light” for “New Type”