#Convert sensors into binary sensors that also go unavailable for Alarmo

1 messages · Page 1 of 1 (latest)

gray ledge
#

I meant something like this?

- binary_sensor:
  - name: "Alarmo Front Door State"
    id: sensor.alarmo_front_door_state
    state: >-
      {%- if states("sensor.ttgo_poe_001_zone01_state") == "OK" -%}
        false
      {%- elif states("sensor.ttgo_poe_001_zone01_state") == "ALARM" -%}
        true
      {%- endif -%}
    attributes:
      source_value: "{{states("sensor.ttgo_poe_001_zone01_state")}}"
    availability: > `{{ states("sensor.ttgo_poe_001_zone01_state") in ['OK', 'ALARM'] }}` 
#

Sorry so how do these mesh together like this?...

#
The system cannot restart because the configuration is not valid: Error loading /config/configuration.yaml: while parsing a block mapping in "/config/templates.yaml", line 11, column 7 expected <block end>, but found '<scalar>' in "/config/templates.yaml", line 11, column 32
gray ledge
#
- binary_sensor:
  - name: "Alarmo Zone 01 State"
    device_class: door
    state: >-
      {%- if states("sensor.ttgo_poe_001_zone01_state") == "OK" -%}
        false
      {%- elif states("sensor.ttgo_poe_001_zone01_state") == "Alarm" -%}
        true
      {%- endif -%}
    attributes:
      source_value: >-
        {{states("sensor.ttgo_poe_001_zone01_state")}}
    availability: >-
      {{ states("sensor.ttgo_poe_001_zone01_state") in ['OK', 'Alarm'] }}
ashen magnet
#

You still have quotes around the outside of your template

#

both of t hem

#

multiline >- or single line with quotes '{{ }}'

#

not both

#

@gray ledge

gray ledge
#

Change above like that?

ashen magnet
#

yes

gray ledge
#

Thank you that worked

binary_sensor.alarmo_zone_01_state
Alarmo Zone 01 State: off    
friendly_name: Alarmo Zone 01 State
source_value: OK
#

Should off represent a closed door or open?

#

(OK means the door is closed to the source sensor, Alarm means the door is open)

ashen magnet
#

off will be "OK"

gray ledge
#

Okay thank you so it is correct.

#

Hmm Alarmo doesn't seem to pick it up still

#

Wonder if I have to add a class to it or something

#

Seems to have only picked up things that were binary_sensor "motion" related

ashen magnet
#

no idea what alarmo is, but usually HA requires device classes for things to expose things to other devices

gray ledge
#

"Currently Alarmo supports sensors of type binary_sensor. Alarmo will check the device class of each sensor, and only supports sensors that are related to security."

ashen magnet
#

alright, see what it says there at the end?

#

device class of each sensor, and only supports sensors that are related to security

gray ledge
#

So classify this zone as a door?

ashen magnet
#

go look at the binary_sensor device classes

#

in the doucmentation

#

choose one that relates to security

#

actually, the documentation descirbes what it supports right there in wha tyou just linked, so read that section

gray ledge
gray ledge
#

If I want to add a second binary sensor to this zone 01 that will track both tamper/short states as class tamper would it look something like this?

- binary_sensor:
  - name: "Alarmo Zone 01 Tamper"
    device_class: tamper
    state: >-
      {%- if states("sensor.ttgo_poe_001_zone01_state") == "Tamper" or states("sensor.ttgo_poe_001_zone01_state") == "Short" -%}
        true
      {%- else -%}
        false
      {%- endif -%}
    attributes:
      source_value: >-
        {{states("sensor.ttgo_poe_001_zone01_state")}}
    availability: >-
      {{ states("sensor.ttgo_poe_001_zone01_state") in ['OK', 'Alarm', 'Tamper', 'Short'] }}
gray ledge
#

binary_sensor.alarmo_zone_01_tamper
Alarmo Zone 01 Tamper: off
device_class: tamper
friendly_name: Alarmo Zone 01 Tamper
source_value: OK

binary_sensor.alarmo_zone_02_tamper
Alarmo Zone 02 Tamper: on
device_class: tamper
friendly_name: Alarmo Zone 02 Tamper
source_value: Short