Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 107006

Syntax for sensor, enum and set mapper

$
0
0

As a binary sensor things are working fine. But I wanted to upgrade my binary sensor to a sensor, device class “enum”. It’s not working, although the syntax is ok. What am I doing wrong?

  - trigger:
      - id: '0'
        platform: event
        event_type: sia_event_12300_100100
        event_data:
            code: 'OP'
      - id: '1'
        platform: event
        event_type: sia_event_12300_100100
        event_data:
            code: 'CG'
      - id: '2'
        platform: event
        event_type: sia_event_12300_100100
        event_data:
            code: 'CL'
    sensor:
      - name: "Area Armed"
        device_class: enum
        icon: mdi:shield-home
        state: >
          {% set mapper =  {
              '0' : 'Disarmed',
              '1' : 'Armed Partial',
              '2' : 'Armed Full'} %}
          {{ mapper[state] if state in mapper else 'Unknown' }}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 107006

Trending Articles