Like many people here, I started small and have continuted to add and tweak my sensors, binary sensors, template, automation and alerts. I just came across this in my setup and could not remember if I did this on purpose, or never got around to finishing trimming down my sensors,
So I guess my question is would you use the sensor for your alert, the binary sensor(s) for your alerts, both, neither, etc
in my sensors.yaml
downstairs_smoke_detector:
value_template: >-
{%- if is_state("sensor.smoke_detector_downstairs_alarm_type", "0") %}
Idle
{%else%}
{%- elif is_state("sensor.smoke_detector_downstairs_alarm_type", "1") %}
Fire
{%- elif is_state("sensor.smoke_detector_downstairs_alarm_type", "2") %}
C02
{%- elif is_state("sensor.smoke_detector_downstairs_alarm_type", "12") %}
Testing
{%- elif is_state("sensor.smoke_detector_downstairs_alarm_type", "13") %}
Idle
{% else %}
Unknown
{%- endif %}
{%endif%}
friendly_name: 'Downstairs Smoke Alarm'
entity_id: sensor.smoke_detector_downstairs_alarm_type
in my binary sensors
- platform: template
sensors:
downstairs_smoke_detector_smoke:
value_template: "{{ is_state('sensor.smoke_detector_downstairs_alarm_type', '1') }}"
friendly_name: "Smoke Detector - Smoke"
device_class: smoke
entity_id: sensor.smoke_detector_downstairs_alarm_type
- platform: template
sensors:
downstairs_smoke_detector_co2:
value_template: "{{ is_state('sensor.smoke_detector_downstairs_alarm_type', '2') }}"
friendly_name: "Smoke Detector - CO2"
device_class: gas
entity_id: sensor.smoke_detector_downstairs_alarm_type
- platform: template
sensors:
downstairs_smoke_detector_testing:
value_template: "{{ is_state('sensor.smoke_detector_downstairs_alarm_type', '12') }}"
friendly_name: "Smoke Detector - Testing"
entity_id: sensor.smoke_detector_downstairs_alarm_type
my alerts
smoke_detector_smoke:
name: Downstairs Smoke Alarm - Smoke Detected
done_message: Smoke has been cleared
entity_id: binary_sensor.downstairs_smoke_detector_smoke
state: 'on'
repeat: 5
can_acknowledge: True
notifiers:
- ios_pauls_iphone
- ios_tracys_iphone
- sony_tv
smoke_detector_co2:
name: Downstairs Smoke Alarm - CO2 Detected
done_message: CO2 has been cleared
entity_id: binary_sensor.downstairs_smoke_detector_co2
state: 'on'
repeat: 5
can_acknowledge: True
notifiers:
- ios_pauls_iphone
- ios_tracys_iphone
- sony_tv
smoke_detector_test:
name: Downstairs Smoke Alarm - Testing
done_message: Smoke Alarm Testing completed
entity_id: binary_sensor.downstairs_smoke_detector_testing
state: 'on'
repeat: 5
can_acknowledge: True
notifiers:
- ios_pauls_iphone
- ios_tracys_iphone
- sony_tv