mkjustuk
(mkjustuk)
November 26, 2020, 12:52pm
1
I have the following in a binary sensor, but testing the template, it’s always showing false, even when I am in the zone defined.
- platform: template
sensors:
justin_ingym:
value_template: "{{ is_state('person.Justin', 'zone.The_Gym') }}"
The zone is defined and shows in the system view for me as ‘The Gym’ when I’m there. In the map it’s showing as The Gym with the co-ordinates etc.
finity
November 26, 2020, 1:01pm
2
I’m going to assume that all of the states are as you have them in your template. But just as an FYI “The_Gym”, “The Gym” and “the_gym” aren’t the same. So you need to make sure that the state of your person is entered exactly as shown in your states page.
But here s the correct template:
- platform: template
sensors:
justin_ingym:
value_template: "{{ is_state('person.Justin', 'The_Gym') }}"
mkjustuk
(mkjustuk)
November 26, 2020, 1:56pm
3
Thanks, I think I will make the zones specifically with a _ and no spaces to be sure I’m talking apples and apples then.
So, zone.zonename is not correct, just zonename?
finity
November 26, 2020, 4:12pm
4
you can write them however you want as long as you make sure you put them in the template the same way.
and yes, leave the “zone.” part out.
mkjustuk
(mkjustuk)
November 27, 2020, 10:22am
5
Thanks again, I added an underscore to them all in the map and then kept that in the template and removed zone. and it’s all working perfectly!
1 Like