Files
Home-Assistant-Configs/custom_templates/lighting.jinja
2024-03-25 15:57:50 -04:00

13 lines
626 B
Django/Jinja

{% macro get_brightness_pct(entity_id) %}
{% set current = state_attr(entity_id,'brightness') %}
{{ ((current / 255) * 100) | float | round(2) }}
{% endmacro %}
{% macro lights_on(type,method) %}
{% set lights = states('sensor.current_lights_on') %}
{% if method == 'tts' %}
Around the house, there {% if lights == '1' %}is {% else %}are {% endif %}currently {{ lights }} {% if lights == '1' %}light {% else %}lights {% endif %}on.
{% elif method == 'text' %}
There {% if lights == '1' %}is {% else %}are {% endif %}currently {{ lights }} {% if lights == '1' %}light {% else %}lights {% endif %}on.
{% endif %}
{% endmacro %}