Hi everyone.
I have a need to convert the way the home/not_home/other zones status of a person entity is displayed.
Let me explain.
I have a card that displays the home status of me and my partner, but not only that, it also shows us the name of the zone we are in if it has been coded in the zones. So when it’s at work one thing appears, when I’m at the gym another and so on.
What happens?
I have already read the following posts:
And they were helpful in creating a new sensor that would allow me to rename the not_home to Not home (definitely nicer). The problem is that the way I wrote the code this ignores all the other zones. So if my partner is at work instead of seeing “Work” written I see “Not Home” written, and it doesn’t make much sense.
So do you think it is possible to apply a template that says:
If the status of person.a is not_home show Not home, otherwise show the status of person.a whatever it is. Where I put the question marks I think the sensor status should be entered person.xxx but I can’t get it to work.
I also need to rename not_home (which sucks) to Not home (much nicer).
Otherwise yes, I agree with you that entity person already does this. So it’s a matter of having the same functionality but changing the state name not_home to Not home
Yes! That seems to work!
My partner is currently at work and I actually see the correct location in her file.
As soon as she leaves to go home I’ll take a look at how the status changes.
Just for information…
What is the difference between creating a sensor with
value_template: >- (on multiple lines)
rather than with
value_template: '{% (on one line)
P.S. The pictures were just to show more quickly how the sensor status was shown, that’s all.
Mostly readability.
But I had a feeling the ' ' was causing issues since it was read as a string. But I was wrong and I’m quite sure it will work as a one liner also when you use {{ }}.
I also need to translate the sensor status, so basically the first solution is already fine.
However good to know, I think I might use this method for something else