So i wanna be able to select which camera that i pan (either camone or camtwo). input_select.cctvlist is either ‘camone’ or ‘camtwo’.
But the one below doesnt work. How can i achieve this?
Looked at what the service expects in the data: block (aka Service data) and noted that entity_id is expected/valid in there. Experience tells me that often it’s also valid outside that, however…
Templating takes place in the service and data sections (and in other places where explicitly mentioned in the docs). That means that to have your template for entity_id parsed, it needs to be in the data section.
Unfortunately point (2) is no longer clearly called out in the docs, so it’s not obvious to newcomers.
Yes, that s what i have trouble figuring out. I couldnt understand the structure. i notice that entity_id is on the same level (indent?) of the service calls, while the rest “pan data” is one level below (indented) the service call. I’d nvr figure out that entity_id can be of the same level (indent) of the pan data.
Most of the times, i need to find the codes (examples on the net) that matches what i wanna do, and then just replace the code line by line accordingly. Once it isnt of the same structure, i ll be lost.
Yeah, getting your head around yaml structure is a must for these things. Yaml structure is not specifically a homeassistant thing, but homeassistant uses yaml for configuration so you’re going to need it.
So in your script you have sequence, and then each thing you want to do listed.
Each thing you want to do has a service, and then some data that defines how the service acts
sequence:
- service: THE SERVICE YOU WANT TO RUN FIRST
data:
option1: YOUR FIRST SERVICE OPTION
ETC
- service: THE NEXT SERVICE YOU WANT TO RUN
data:
option1: YOUR SECOND SERVICE OPTION
Thusly, if you want to turn a light on to 20%, wait 20 seconds, then turn a switch on, you will use:
the light.turn_on service with data of which light and the brightness level
the delay service with the seconds option set to 20
the switch.turn_on service with the data being which switch