Hello!
I tried to integrate Presence simulation according thsi video: https://www.youtube.com/watch?v=OTQu3BMr3EU.
From 5 minutes on he explanis about the trigger IDs.
The problem is that my version looks different.
Can somebody help?
That came out for me but does not work:
I don’t think you need the “persons” attribute. zone.home has a value equal to the number of tracked devices detected. If nobody’s in, it’s 0 - that’s all you need.
remove both lines with the persons attribute. This should not be there because persons is a list of person entity ids and not the number of persons in the zone. You need to t3st for the state alone.
That is because the if has no conditions. It will always do the top part.
Why not just use two automations? The triggers for coming and leaving are different, the actions are different. Why test the same thing twice just to put it inside one automation and make things so complex that you no longer understand why it does not work?
alias: Presence simulation on
description: ""
triggers:
- trigger: state
entity_id: zone.home
to: "0"
conditions: []
actions:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.presence_simulation
mode: single
Note that triggers are about a change, not about what already is. So the right name for the trigger would be: First person arrives rather than Somebody at home.
P.s. If you just want to create a sensor that turns on when everyone is away and off when someone is home, you can also create a template helper for a binary sensor. The state template would be:
Yes, your presence simulation turned on when people left (at least the last yaml you showed) so the template was written as a absence sensor. put not before is_state to reverse it and mke it a presence sensor:
{{ not is_state('zone.home','0') }}
You named it after one person? The template is for any person, so if you are a single person household it a correct name, but it might be confusing if there are more people. If you want the state of one specific person from the household you should test for the state of that person, not the zone.
A state of a person is either a name of a zone that the person is in, or away. Unknown should only be if there is no value known.It is not changeable, other than making more zones. Avoid making overlapping zones though, especially with home.
If what? There’s no if in there… Put something in [] if you are doing it manually.
I suggest however doing this in the UI editor, then looking at the edit-as-YAML to see what actually is happening, and it will be clear how you can do this.
The video is outdated. If it was causing you problems (I assume it;'s the one in the Docs) then click the link at the bottom of the Docs web page and explain that the format is legacy anf you cannot follow it, maybe it will finally go away.