From f9b32252883e3285dfeff64babbc8156d81152b3 Mon Sep 17 00:00:00 2001 From: Mahasri Kalavala Date: Tue, 29 Nov 2022 21:12:30 -0500 Subject: [PATCH] clean up & fixes --- lovelace/08_multimedia_view.yaml | 10 ------ templates/away_status.yaml | 61 +++++++++----------------------- 2 files changed, 16 insertions(+), 55 deletions(-) diff --git a/lovelace/08_multimedia_view.yaml b/lovelace/08_multimedia_view.yaml index a50a1df..cd6fe95 100644 --- a/lovelace/08_multimedia_view.yaml +++ b/lovelace/08_multimedia_view.yaml @@ -2,16 +2,6 @@ title: Multi Room Audio & TTS icon: mdi:television cards: - - type: entities - title: Raspberry Pi Scripts - show_header_toggle: false - entities: - - script.query_disk_info - - script.query_wifi_info - - script.restart_all_raspberrypis - - script.restart_all_snapclients - - script.shutdown_all_raspberrypis - - type: entities title: Text To Speech show_header_toggle: false diff --git a/templates/away_status.yaml b/templates/away_status.yaml index ea9c419..d8e84f4 100644 --- a/templates/away_status.yaml +++ b/templates/away_status.yaml @@ -1,46 +1,18 @@ > - {% macro weather_update() -%} - Outside temperature is {{ states('sensor.dark_sky_apparent_temperature') | round(0) }} degrees. - {%- endmacro -%} + {% macro door_status() -%} + {%- for x in states if x.domain == 'binary_sensor' and 'door_window_sensor' in x.entity_id and x.state == "on" %} + {{ x.name }} is open. + {%- endfor %} + {%- endmacro %} - {%- macro uv_levels() -%} - {%- set uv = states('sensor.pws_uv') | int -%} - {%- if uv >= 6 and uv <= 7 -%} - Current UV index is high. Please be careful outdoors. - {%- elif uv >= 8 and uv <= 10 -%} - Current UV index is very high. It is not advised to go out. - {%- elif uv >= 11 -%} - Current UV index is extremely high. It is highly advised to stay indoors. - {%- else -%} - Good UV levels. - {%- endif -%} - {%- endmacro -%} + {% macro motion_sensor_status() -%} + {% for x in states if x.domain == 'binary_sensor' and 'motion_sensor' in x.entity_id and x.state == "on" %} + {{ x.name }} motion detected + {%- endfor %} + {%- endmacro %} - {%- macro USPS() -%} - {%- if states('sensor.usps_mail') | int > 0 -%} - USPS is going to deliver {{ states('sensor.usps_mail') }} mails today. - {%- endif -%} - {%- endmacro -%} - - {%- macro alert_battery_levels() %} - {% for item in states if 'battery_level' in item.attributes and item.attributes.battery_level | int > 0 and item.attributes.battery_level | float <= 10.0 -%}{{- item.attributes.friendly_name ~ " battery is less than 10 percent" -}} - {%- if loop.first %}, {% elif loop.last %}, {% else %}, {% endif -%} - {%- endfor -%} - {%- endmacro -%} - - {%- macro tesla_status() -%} - {%- if states("sensor.tesla_model_3_range_sensor") != "unknown" -%} - Your Tesla car battery is at {{ states('sensor.tesla_model_3_battery_sensor') }} percent ({{ (states('sensor.tesla_model_3_range_sensor') | int) | round(0) }} miles). - {%- endif -%} - {%- endmacro -%} - - {%- macro humidity_status() -%} - Home humidity is {{ states('sensor.dining_room_thermostat_humidity') }} percent. - {%- endmacro -%} - - {%- macro alarm_status() -%} - Your home is {{ "SECURED!" if states('alarm_control_panel.home') == "armed_away" or states('alarm_control_panel.home') == "armed_home" else "UNSECURED!" -}} - . Your Home Away Status is set to {{ states('input_boolean.home_mode_away') |upper }} + {% macro alarm_status() -%} + Your home security is set to: {{ states('alarm_control_panel.home') | upper }} {%- endmacro -%} {%- macro single_car_garage_door_status() -%} @@ -87,13 +59,12 @@ {%- endfor -%} {%- endmacro -%} - {%- macro mother_of_all_macros() -%} + {% macro mother_of_all_macros() -%} {{ alarm_status() }} + {{ door_status() }} + {{ motion_sensor_status() }} {{ garage_status() }} - {{ weather_update() }} - {{ humidity_status() }} - {{ uv_levels() }} {{ light_switch_status() }} {%- endmacro -%} - {{- cleanup(mother_of_all_macros()) -}} + {{- cleanup(mother_of_all_macros()) -}} \ No newline at end of file