#Convert sensors into binary sensors that also go unavailable for Alarmo
1 messages · Page 1 of 1 (latest)
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
- 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'] }}
You still have quotes around the outside of your template
both of t hem
multiline >- or single line with quotes '{{ }}'
not both
@gray ledge
Change above like that?
yes
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)
off will be "OK"
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
no idea what alarmo is, but usually HA requires device classes for things to expose things to other devices
"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."
alright, see what it says there at the end?
device class of each sensor, and only supports sensors that are related to security
So classify this zone as a door?
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
device_class: door
That worked! yay https://imgur.com/a/PkYtt5Q
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'] }}
I think that may have worked...
https://imgur.com/a/pXlGw0d
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