From ded3fcb72d1b5e081f886033836132bd3876cc88 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sun, 18 Jun 2023 16:45:52 -0400 Subject: [PATCH] Add climate devices report to the house status report macro --- custom_templates/status.jinja | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/custom_templates/status.jinja b/custom_templates/status.jinja index afeb966..9b5aeee 100644 --- a/custom_templates/status.jinja +++ b/custom_templates/status.jinja @@ -3,6 +3,24 @@ {% from 'lighting.jinja' import lightsOn %} {% set ct = ct() | int %} +{% macro climateDevices(type,method) %} +{% set total = states('sensor.climate_devices_running') | int %} +{% set fans = states('sensor.fans_running') | int %} +{% set aircons = states('sensor.aircons_running') | int %} +{% if total > 0 %} + {% if fans > 0 and aircons > 0 %} + There are currently {{ fans }} {% if fans > 1 %}fans {% else %}fan {% endif %}running and {{ aircons }} {% if aircons > 1 %}air conditioners {% else %}air conditioner {%endif%}running. + {% else %} + {% if fans > 0 %} + There {% if fans > 1 %}are {% else %}is {% endif %}{{ fans }} {% if fans > 1 %}fans {% else %}fan {% endif %}running. + {% endif %} + {% if aircons > 0 %} + There {% if aircons > 1 %}are {% else %}is {% endif %}{{ aircons }} {% if aircons > 1 %}air conditioners {% else %}air conditioner {% endif %}running. + {% endif %} + {% endif %} +{% endif %} +{% endmacro %} + {% macro airLeaks(type,method) %} {% set windows = states('sensor.windows_open') %} {% set doors = states('sensor.doors_open') %} @@ -39,11 +57,14 @@ {% endmacro %} {% macro houseStatusReport(type,method) %} -{% if type == 'airleaks' %} +{% if type == 'climate_devices' %} +{{ climateDevices(type,method) }} +{% elif type == 'airleaks' %} {{ airLeaks(type,method) }} {% elif type == 'lights' %} {{ lightsOn(type,method) }} {% elif type == 'full' %} +{{ climateDevices(type,method) }} {{ lightsOn(type,method) }} {{ airLeaks(type,method) }} {% endif %}