Help: Template for Recessed Door Sensors

Hello all,

I have a couple Monoprice Recessed Zwave Door sensors. They only give you a value of “22” or “23” when opening/closing. I have this currently on (3) of my doors and am attempting to create a group template and sensor that will change based on those two numbers. “22” means open and "23 means closed. I have something similar for all my windows that works perfectly but their binary_sensor output is correct with on/off. Any help is appreciated!

Here is what I have tried and neither works group or sensor template works:

group:
  doors:
    name: doors
    entities:
    - sensor.patio_door_sensor
    - sensor.front_door_sensor
  doors2:
    name: doors_2
    entities:
    - sensor.patio_door_sensor
    - sensor.front_door_sensor  

sensor:
  - platform: template
    sensors:
      open_doors:
        value_template: >
         {{ expand('group.doors')
            | selectattr('state', 'eq', 'on')
            | list | count }}
      open_doors2:
        value_template: >
         {{ expand('group.doors_2')
            | selectattr('state', 'eq', '22')
            | list | count }}

Try this:

      open_doors2:
        value_template: >
         {{ expand('group.doors_2')
            | selectattr('state', 'eq', 22)
            | list | count }}
1 Like

No luck on that. Both group.doors_2 and sensor.open_doors_2 values are either “unknown” or “0” and do not change when opening/closing the door. The sensor.patio_door_sensor changes from 22/23 depending on state.

Lifted from this thread:

binary_sensor:
  - platform: template
    sensors:
      front_door:
        value_template: "{{ is_state('sensor.front_door_recessed_door_sensor_access_control', '22') }}"
        friendly_name: "Front Door"
        device_class: door
      front_door_sensor_tamper:
        value_template: "{{ is_state('sensor.front_door_recesssed_door_sensor_burglar', '3') }}"
        friendly_name: "Front Door Sensor Tamper"
        device_class: safety

Thank you for responding. So how does this template change things to open/closed?

It does if you use the created binary_sensor. In the example above, “binary_sensor.front_door”.

My whole zwave network just took a dump, so I took the opportunity to upgrade to the new OpenZwave (beta) integration. I mention this because the sensors come up automatically as proper binary door/tamper sensors without any additional configuration or templating. Might be worth taking the jump if you haven’t yet.

1 Like