- platform: template
sensors:
presence:
friendly_name: "Giannis Home"
value_template: >-
{% if is_state('person.elena', 'not_home') and is_state('person.giannis', 'home') %}
on
{% else %}
off
{% endif %}
Is there anyway to configure the fisrt part of this sensor to be true if person.elena is not at home? I mean like this it works, but as soon as person.elena enters one other zone then it wont be true even if person.elena is not home. I need something like this
- platform: template
sensors:
presence:
friendly_name: "Giannis Home"
value_template: >-
{% if is_state('person.elena', =! 'home') and is_state('person.giannis', 'home') %}
on
{% else %}
off
{% endif %}
That is to say that you have giainis at home, or you have elena at home, or both, or none.
So rather than having 4 template sensors for these eventualities, just use the individual person entities for the first 2, and a group for the latter two.
Yeah I see that, but I’m trying to see where this would be used, and if you had a group with giainis and elena in it, then either both are home (group is home), neither are home (group is not_home), or one person is home (whichever person is). So the 4 template sensors that would otherwise establish these states are redundant imo.
I suppose you could use the sensors as a shortcut for a trigger/condition or two, but realistically for the number of times these sensors are actually going to be used it’s just duplicating data that’s already there.
One template sensor that returns a result of ‘all’, ‘Gianni’, ‘Elena’ or ‘none’ would probably be a better fit if there’s actually likely to be a number of uses.