Any idea how to do this ? There is no option in the GUI that I can see.
AFAIK, they are YAML-only, using the old group domain.
You will need to use the generic actions to turn a group entity on and off.
Thank you for the link
Three other options are:
You can use multiple "Template Switch"s to map your "Input Toggle"s to switches. Then you can create a group of switches - this is most useful if you have real switches that you want to include in the group too.
You can use a “Template Binary Sensor”, if you just want to read the value from a set of Input Toggles - you won’t have any way to update the underlying toggles through the sensor with this approach.
You can also use a single “Template Switch” to read all the Input Toggles (as you would in the previous option) then for each action (on & off) set the state of all the toggles.
The suggestion from @Didgeridrew is fairly simple to execute and avoids all the hoops you have to go through with the methods you described.
I am looking for a helper group so when on click on it I can get the individual toggles to set the lights individually. I don’t think labels help here.
The main reason for my suggestion, was that I have a preference is to:
- Edit using the GUI when possible.
- Use the GUI to edit the YAML.
- Log on to the box and edit the config directly when there is no other way.
A nice feature request, may be to create a “binary switch group” for any item that has “switch like” properties i.e it has state and can be turned on and off.
If that existed, it would be possible to add any combination of: switches, input toggles, fans, AC’s lights, etc to the group and turn them all on and off together.
I understand the need for more specific groups - for example lights, so you set other attributes like brightness or color, but I don’t think that should preclude also having generic “binary switch” group.
I just tested out one other option (it doesn’t fit in with my preference to not edit yaml files), but it might work for you.
If you are already using an MQTT broker you can create a “fake” MQTT Switch by setting the state and command topics to the same value, i.e.:
mqtt:
- switch:
unique_id: example_switch
name: "example switch"
state_topic: "home/example/switch1"
command_topic: "home/example/switch1"
payload_on: "ON"
payload_off: "OFF"
state_on: "ON"
state_off: "OFF"
qos: 0
retain: true
That way whenever HA sends the message to update the “remote” switch it just loops back confirming that the state has changed.
The advantages of this are that:
- Since Home Assistant thinks that it’s a real switch, you can simply create a switch group and add this directly to it.
- Visually it show up the same as a toggle in the UI.
- You can change how it shows up to a light or fan, etc…
- You can add automations / set the state the same as you would for a toggle.
Note: The first time the switch shows up it will be in a weird “unavailable” state, however once you change the state once, the state will be retained in the broker so that won’t happen again.
Thanks I’ll try that