Thanks, but why this exsample is made so, that editing in UI is impossible? I can’t figure how to add another light to target… Adding entity_id like UI do to next two lines won’t work. Separating entities with comma won’t work. How it should be done? I’ll try to get two lights stay on when there is movement in the area, and when it stops, then lights go off.
action:
- service: "light.turn_{{ trigger.to_state.state }}"
target:
entity_id:
- light.your_1st_light_here
- light.your_2nd_light_here
Or make a light group and use that entity.
That way not work. Generates error, entity is none… As i wrote earlier.
Yeah it does. I use it you are doing some thing wrong. And without seeing your config it is impossible to say what.
I already tried as you suggest, many times. It removes that following lines and says entity can’t be none.
When i put only one light as original says, it work nicely.
Now i added the another light via UI, and it looks like this, and seems work…
You’re not making a lot of sense.
Yes, so it seems be. But this won’t accept two entities in any way to that code… Have to do more tests. The Yaml is not my thing, i have heard it first time with this HA. And don’t like write some code, if there is other options available.
you haven’t got two light entities in there.
But worked fine almost a day. Then lights go out of sync perhaps due some temporary missfire.
Now i test this way.
I’m trying to avoid any code writing, as i said before. In your quote is really main reasons. I don’t like if the syntax correctness is critical.
That is why, it is only picture of what i tried. Now it seems to work correctly, perhaps the real code can be published, when it is really noted working.
It’s only you that has an issue with it and we are still not sure why because you refuse to listen to what we are telling you. I’m done, Good luck.
I’m pretty sure, that i’m not only one.
And could you specify, what you told to me? I don’t speak english, or Yaml very well, so you can’t throw some hints without detailed explanation.
Then do it in the UI.
Ok. You have a nice inner circle in here. Sorry, if i disturbed your space. Fine community, yes.
The advice you received is correct.
What we haven’t seen until this point is a copy of the exact error you’re getting.
We can understand that challenge, but we still cannot guess accurately what you’re trying to say, unfortunately. You need to try again.
The reason the forum asks for YAML is that we can fix it then for you. You can then copy and paste it back. This is way simpler than writing UI instructions.
You don’t have to use YAML to write anything. You can use the UI and export the generated YAML for use here — and back (at least from what I understand, since I avoid the UI for config as much as possible).
There may been communication problem at both ways. The original problem was, that the example from which i took that base, was not able to modify in UI. And suggested way to add another light won’t work as should. Yaml editor didn’t accept it.
Now i have two separate light instances, and seems working.
alias: Käpyvalotesti
description: Liiketunnistin
trigger:
- platform: state
entity_id:
- light.slim_multi_sensor_basic
to: "on"
- platform: state
entity_id:
- light.slim_multi_sensor_basic
to: "off"
for:
hours: 0
minutes: 15
seconds: 0
condition:
- condition: numeric_state
entity_id: sensor.5_in_1_pir_motion_sensor_illuminance
below: 100
action:
- service: light.turn_{{ trigger.to_state.state }}
target:
entity_id: light.zigbee_1_valo
- service: light.turn_{{ trigger.to_state.state }}
target:
entity_id: light.flush_2_relays_2
mode: single
I don’t think so. Reading your first post again, nothing is really clear. The actual example you’re referring to isn’t stated and it’s hard to understand what “next two lines” you’re referring to, etc.
Is it the example here? Light - Home Assistant (home-assistant.io)
You must’ve gotten an error doing this, which is why I said:
I’m emphasising all of this, because there’s a learning opportunity here.
Anyway, if you’re talking about turning on multiple entities with one service call, this is what it looks like in YAML:
- service: light.turn_{{ trigger.to_state.state }}
target:
entity_id:
- light.zigbee_1_valo
- light.flush_2_relays_2
The alternative, but uncommon:
- service: light.turn_{{ trigger.to_state.state }}
target:
entity_id: [light.zigbee_1_valo, light.flush_2_relays_2]
So, you cannot just add a comma: It either needs to be a YAML list (each dash is a list item) or a bracketed notation list, in which case you can separate the entities with commas.
Also, doing it through the UI is simple as well. You simply press the “+ Choose entity” button and select from the drop-down list.
Yup, but nobody actually knows what the OP did – step by step…