Yet Another Monoprice Door Switch thread

Hey everyone,

I’ve got a Monoprice door sensor switch set up but I’m having some troubles setting up a template to show the status.

It shows up just fine at the top of the main HASS page. It toggles between a values 23 for closed and 22 for open.

Capture

The entity_id in the states appears as:

sensor.front_door_sensor_access_control (I renamed it)

customization.yaml:

sensor.front_door_sensor_access_control:
  friendly_name: Front Door Sensor
  icon: mdi:glassdoor

sensors.yaml:

- platform: template
  sensors:
    front_door_sensor_access_control:
    value_template: '{% if is_state("sensor.front_door_sensor_access_control", "23") %}Closed{% else %}Open{% endif %}'
    friendly_name: 'Front Door Status'

For some reason when I use the above template a get a second icon at the top of the home page called “Front Door Status” which always shows as Open and never changes state.

Capture

And a second state, sensor.front_door_sensor_access_control_2 with the same entity_id sensor.front_door_sensor_access_control is created that now shows the correct status of the sensor, 22 or 23.

I can’t figure out what I’m doing wrong.

edit: added pics for clarity

Don’t name your template sensor the same exact thing. That’s why it’s creating the “_2”

Oh wow…speechless. I didn’t even think of something that obvious.

Thanks for scratching my itch, itchaboy :slight_smile:

Happens to the best of us!