crillux
(Christian)
January 7, 2020, 11:07pm
1
I am trying to learn how to script in HA but here is something I don’t understand. This script does not work and it seems that it has to do with the two entities in the switch.turn_on service call. Is it not possible to have more than 1 entity in a service call?
twilight_lights:
sequence:
- service: homeassistant.turn_on
data:
entity_id: group.fonsterbelysning
- service: switch.turn_on
data:
- entity_id: switch.vardagsrum_skap
- entity_id: switch.allrum_bordslampa
- service: light.turn_on
data:
entity_id: light.hall_garderob
brightness_pct: 2
Fuzzysteve
(FuzzySteve)
January 7, 2020, 11:19pm
2
Afraid not.
But you can have the service multiple times.
Or you could have a group. Or a scene.
It’s definitely possible to have more than one entity ID in a service call.
- service: light.turn_on
entity_id:
- light.light1
- light.light2
...
or
- service: light.turn_on
entity_id: light.light1, light.light2 ...
Fuzzysteve
(FuzzySteve)
January 7, 2020, 11:41pm
5
gah.
My bad there.
Requires slightly different formatting from what OP said.
Personally, I’d still suggest a group or scene, but that’s mostly to simplify my automations file. But yes, I was wrong.
crillux
(Christian)
January 7, 2020, 11:53pm
6
Ah! So it was my formatting… Thanks!