Improve door open alert macro

This commit is contained in:
2024-01-05 14:59:37 -05:00
parent 650f4db5c4
commit 3b6b19b160

View File

@ -1753,14 +1753,25 @@ script:
{%- endmacro -%} {%- endmacro -%}
{%- macro snark_door_open() -%} {%- macro snark_door_open() -%}
{{ [ {% if is_state('binary_sensor.front_door','on') and is_state('binary_sensor.back_door','on') %}
'Would you like me to calulate how much air conditioning is being wasted? Spoiler Alert, you are not going to like the answer.', {% set door = 'front door and back door' %}
'I have detected a large number of insects entering the house.', {% elif is_state('binary_sensor.front_door','on') %}
'Can a human be so kind and close it?', {% set door = 'front door' %}
'The air quality in this house has actually improved.', {% elif is_state('binary_sensor.back_door','on') %}
'Closing the door would improve the security of the house.', {% set door = 'back door' %}
'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.' {% endif %}
] | random }} {% if door is defined %}
{{ [
'Would you like me to calulate how much air conditioning is being wasted? Spoiler Alert, you are not going to like the answer. Close the ' + door + '.',
'I have detected a large number of insects entering the house. You may want to close the ' + door + '.',
'The ' + door + ' is open. Can a human be so kind as to close it?',
'The air quality in this house has actually improved. But you will probably want to close the ' + door + ' anyway.',
'Closing the ' + door + ' would improve the security of the house.',
'Hey. The ' + door + ' was just opened and this is crazy. But now you know. So close it maybe.'
] | random }}
{% else %}
Apparently there is a door open somewhere that should not be. Do not ask me. I just work here.
{% endif %}
{%- endmacro -%} {%- endmacro -%}
{%- macro snark_door_closed() -%} {%- macro snark_door_closed() -%}