Conversion to binary

Dear all, I tried de create a new sensor in order to convert the status provided by this Zwave detector which provides only a status 23 (for closed) and 22 (for open). My YAML is :slight_smile:

‘’’

  • platform: template
    sensors:
    chattiere_etat:
    friendly_name: “Chattiere Etat”
    entity_id: sensor.vision_security_sensor_access_control
    # value_template: “{{ is_state(‘sensor.vision_security_sensor_access_control’, ‘22’) }}”
    device_class: Door
    icon_template: >
    {% if is_state(‘sensor.vision_security_sensor_access_control’) %}
    mdi:door-open
    {% else %}
    mdi:door-closed
    {% endif %}
    value_template: >
    {% if is_state(‘sensor.vision_security_sensor_access_control’, ‘22’) %}
    True
    {% elif is_state(‘sensor.vision_security_sensor_access_control’, ‘23’) %}
    False
    {% else %}
    Error
    {% endif %}
    ‘’’
    but this sensor did not provide the information needed (always closed)

Thank you in advance for your support