infra/roles/hass-core/templates/automations-ansible-managed...

58 lines
1.5 KiB
Django/Jinja

---
{% if hass_radiators | length > 0 -%}
- alias: monitor_radiators_reporting
id: monitor_radiators_reporting
description: monitor that the battery-powered radiator knobs are working
trigger:
{% for radiator in hass_radiators -%}
{% if 'status' in radiator -%}
- platform: state
id: "radiator {{ radiator.name }}"
entity_id:
- binary_sensor.radiator_{{ radiator.name }}_is_reporting
to: 'off'
{% endif -%}
{% endfor %}
condition: []
mode: single
action:
- service: notify.persistent_notification
data:
title: 'device not reporting'
message: 'stopped reporting: {%raw%}{{ trigger.id }}{%endraw%}'
- service: notify.notify
data:
title: 'device not reporting'
message: 'stopped reporting: {%raw%}{{ trigger.id }}{%endraw%}'
{% endif %}
{% for linux_tracker in hass_linux_presence_trackers -%}
- alias: "webhook_presence_trackers_{{ linux_tracker.name }}"
unique_id: "webhook_presence_trackers_{{ linux_tracker.name }}"
description: ""
trigger:
- platform: webhook
webhook_id: {{ linux_tracker.name }}-{{ linux_tracker.webhook_key }}
id: webhook
mode: single
action:
- service: >-
{% raw -%}
{% if trigger.json['state'] | default(false) %}
input_boolean.turn_on
{% else %}
input_boolean.turn_off
{% endif %}
{% endraw -%}
data: {}
target:
entity_id: input_boolean.webhook_{{ linux_tracker.name }}_last_state
{% endfor %}