67 lines
2.2 KiB
Django/Jinja
67 lines
2.2 KiB
Django/Jinja
{#
|
|
# device attributes:
|
|
# - config_entries
|
|
# - connections
|
|
# - identifiers
|
|
# - manufacturer
|
|
# - model
|
|
# - name
|
|
# - sw_version
|
|
# - hw_version
|
|
# - entry_type
|
|
# - id
|
|
# - via_device_id
|
|
# - area_id
|
|
# - name_by_user
|
|
# - disabled_by
|
|
# - configuration_url
|
|
#}
|
|
|
|
|
|
- binary_sensor:
|
|
{% for radiator in hass_radiators -%}
|
|
{% if 'status' in radiator -%}
|
|
|
|
- name: radiator_{{ radiator.name }}_is_reporting
|
|
icon: "mdi:update"
|
|
availability: >-
|
|
{% raw -%} {{ {%- endraw %} has_value(states("{{ radiator.status}}")) {%- raw %} }}{% endraw %}
|
|
|
|
state: >-
|
|
{% raw %}{%{% endraw %} set status_last_updated = states.{{ radiator.status }}.last_updated {%raw%}%}{%endraw %}
|
|
{% raw %}
|
|
{% set time_since_updated = now() - status_last_updated %}
|
|
{{ time_since_updated.seconds|int <= 3600 }}
|
|
{% endraw %}
|
|
|
|
{% endif -%}
|
|
{% endfor -%}
|
|
|
|
- name: "heating_on"
|
|
icon: "mdi:home-thermometer"
|
|
device_class: heat
|
|
state: >-
|
|
{% raw -%}
|
|
{% set all_radiators = states.climate | selectattr("attributes", "defined") | map(attribute="attributes") | selectattr("temperature", "defined") | map(attribute="temperature") | default([]) | map("float", 0.0) |list %}
|
|
{% set max_radiator_temp = all_radiators | map("float", 0.0) | max | default(0.0) | float(0.0) %}
|
|
{% set target_temp = states('input_number.target_temp_heat') | default(0.0) | float(0.0) %}
|
|
{{ max_radiator_temp >= target_temp }}
|
|
{% endraw %}
|
|
|
|
{% for linux_tracker in hass_linux_presence_trackers -%}
|
|
- name: linux_tracker_{{ linux_tracker.name }}
|
|
icon: "mdi:laptop"
|
|
state: >-
|
|
{% raw -%} {% {% endraw %} set tracker_name = "{{ linux_tracker.name }}" {% raw %} %}
|
|
{% set webhook_state = states("input_boolean.webhook_" ~ tracker_name ~ "_last_state") %}
|
|
{% set since_last_triggered = now() - state_attr("automation.webhook_presence_trackers_" ~ tracker_name, "last_triggered") %}
|
|
{% set last_triggered = since_last_triggered.seconds|default(1800) | int 1800 %}
|
|
{% if last_triggered > 1800 == true %}
|
|
{{ false }}
|
|
{% else %}
|
|
{{ webhook_state }}
|
|
{% endif %}
|
|
{% endraw %}
|
|
|
|
{% endfor %}
|