I’m very new to Home Assistant. I migrated my house over from SmartThings back in December 2020 and am very happy so far. Through various levels of searching, I have just about everything working the way I want and now I’m down to customizing things - like the dashboard. I recently installed a recessed door/window sensor from Monoprice on my gate outside. It is working and shows its status in HA. However, it reports as either “22” or “23” for open and closed, respectively. Obviously I’d rather it display as the latter on the Entities Card I have set up for all my door sensors. Forgive my “newness” for not knowing how to get this done.
I’ve searched a lot today for a solution, and I think I’m close but I’m just not sure exactly how to proceed. I know I could do an automation with an Boolean helper, but then (I think) I’d have to do two - one for setting it to open and one for closed. I’d rather not do it that way if it’s not necessary.
Can any of you steer me in the right direction and/or hold my hand, please? Any help would be appreciated!
For example, let’s say the Monoprice contact sensor monitor the Front Door and is represented in Home Assistant as sensor.monoprice and it reports its on (open) and off (closed) states as 22 and 23.
The following Template Binary Sensor creates an entity called binary_sensor.front_door and it reports on when the state value of sensor.monoprice is 22 and reports off for any other value.
Having done as Taras suggests, you will have a binary sensor reporting correctly to the system.
But then you need to add “device class: door” you need to read the link Taras gave you.
Once listed as a door. The ‘on’ and ‘off’ states will be read (in the frontend) as ‘open’ and ‘closed’
Though please note; that they are actually still ‘on’ and ‘off’
That worked absolutely perfectly! Thank you so much for your quick responses and help. Hopefully that’s it, but if I run into any further issues I’ll reply here again.
Just a couple of side points.
You as the thread owner (or the OP) you get notifications of any changes to the thread.
I don’t, I only noticed this by accident.
If you reply to me (or to Taras) then the system will notify me (or him) of that reply [using the individual post reply button].
Another means of getting that attention is to tag them e.g. @patchrick84, but be careful doing that as some consider it rude unless you have a relationship with that individual
You can also select (Taras’s post in this case) the post that helped you most with your solution. (It is very rare that the OP solves it on their own (but it does happen) so you pick the post that ‘most’ helped)
This helps others, searching for similar problems / solutions and also reduces people scanning for problems to solve (i.e. Less urgent)
Edit, you should also read the sticky at the top of the forum