Magnet door switch customization

Hi,

This is the second of my long term niggles I’ve not been able to sort, I’m hoping someone could possibly point me in the right direction with…

I have an RF magnetic door sensor configured with an automation and basic script to turn on a light when the door is opened - all good, works well. But in HA, the magnetic door sensor shows with the standard switch icon and allows it to be turned on and off - clearly as its a door, it can’t remotely be turned on and off, so I’ve been trying to find a way of making it show either ‘read-only’ so it can’t be switched or, even better, its status displayed as open or closed, not appearing as switchable from the frontend.

I’ve fiddled with using a customization and mdi icon, but it still displays the switch as something that can be ‘switched’.

Thanks for any help.

How about just hiding it using customization/not showing in a group? You can create a template sensor to show the status instead. That takes care of it being ‘read only’.

1 Like

Ah, OK, thanks. Not used template sensors before.

Sounds like thats what I need to be looking at.

Thanks for the pointer.

Something like this might work:

-  platform: template
   sensors:
     magnetic_door_status:
       value_template: "{% if is_state('switch.yourdoorentity', 'on') %}closed{% else %}open{% endif %}"
1 Like

Perfect!!! Many thanks for that.:smiley:

1 Like