Android Widgets - Binary Sensor

It looks like we can create widgets for Home Assistant on Android but I am having some trouble. I have a binary sensor for my mailbox that shows “Open”, “Closed”, or “Unavailable”. With the entity template I can get the sensor to show “On”, “Off”, or “Unavailable”. How do I get it to show “Open” and “Closed” instead of “On” and “Off”? I tried to make a html template widget and I was able to change the “On” to “Open” and “Off” to “Closed” but it was also showing “Closed” for “Unavailable”. How do I also get it to show “Unavailable”?

I guess I am looking for a html template for a binary sensor that allows me to customize the “On” and “Off” state and also shows when the sensor becomes “Unavailable”.

Here is a screenshot of the html template widget that I am currently using for my mailbox sensor:

1 Like

For simplicity you can do if > elif > else > endif

You need to handle the condition because the current code says if its on show open and anything else show closed. What you want it to do is if on show open, else if off show closed anything else unavailable.

elif is jinja syntax for else if so you can add additional conditions.

1 Like

Thank you I figured it out from your advice!