Add basement briefing #193

This commit is contained in:
2024-03-29 19:05:24 -04:00
parent b5457a21e1
commit 6cb6e2ef07
5 changed files with 105 additions and 0 deletions

View File

@ -4776,3 +4776,25 @@
alias: Set time night meds were taken
mode: parallel
max: 4
- id: '1711657679853'
alias: Basement Briefing
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.basement_studio_motion
from: 'off'
to: 'on'
id: motion-on
alias: Motion is detected in the basement
condition:
- condition: state
entity_id: input_boolean.basement_briefing
state: 'off'
alias: Basement briefing has not already run for the day
action:
- service: script.basement_briefing
metadata: {}
data: {}
alias: Run basement briefing script
mode: single

View File

@ -303,6 +303,7 @@ influxdb:
- sensor.climate_devices_running
- sensor.bypassed_sensors
- input_boolean.shower_mode
- sensor.services_down
logbook:
include:
@ -461,3 +462,4 @@ prometheus:
- sensor.climate_devices_running
- sensor.bypassed_sensors
- input_boolean.shower_mode
- sensor.services_down

View File

@ -82,6 +82,9 @@ input_boolean:
kallen_nightly_briefing:
name: Kallen Nightly Briefing Ran
icon: mdi:home-analytics
basement_briefing:
name: Basement Briefing Ran
icon: mdi:home-analytics
weather_reports:
name: Weather Info
icon: mdi:weather-cloudy-alert
@ -198,6 +201,17 @@ script:
target:
entity_id: input_boolean.good_morning
basement_briefing:
alias: 'Basement Briefing'
sequence:
- service: script.speech_engine
data:
who: "{{ who|default('basement') }}"
message: !include ../templates/speech/basement_briefing.yaml
- service: input_boolean.turn_on
target:
entity_id: input_boolean.basement_briefing
dinner_is_ready:
alias: 'Dinner Is Ready'
sequence:

View File

@ -453,3 +453,22 @@
{'friendly_name': state_attr('sensor.master_bedroom_illuminance','friendly_name'), 'state': states('sensor.master_bedroom_illuminance') | default(0) | int }] %}
{% set names_list = entity_list | sort(attribute='state',reverse=true) | map(attribute='friendly_name') | list %}
{{ names_list[0] | regex_replace(find='Illuminance', replace='', ignorecase=False) }}
- name: Services Down
unique_id: 1617ede2-c2ee-4159-a0a0-f0ae869325f1
unit_of_measurement: ''
icon: mdi:close-network-outline
state: >
{% set uptimekuma = states.binary_sensor |
selectattr('entity_id','in',integration_entities('uptime_kuma')) |
selectattr('state','eq','off') |
map(attribute='attributes.friendly_name') |
list %}
{{ uptimekuma | count | int }}
attributes:
services: >
{% set uptimekuma = states.binary_sensor |
selectattr('entity_id','in',integration_entities('uptime_kuma')) |
selectattr('state','eq','off') |
map(attribute='attributes.friendly_name') |
list %}
{{ uptimekuma | join(', ') }}

View File

@ -0,0 +1,48 @@
>
{# Basement Briefing #}
{% from 'formatting.jinja' import cleanup %}
{%- macro getReport() -%}
{% from 'speech.jinja' import greeting, today_is %}
{% from 'weather.jinja' import weatherReport %}
{% from 'sports.jinja' import sports_updates %}
<p>
{{ greeting('date') }}
</p>
<p>
{{ today_is() }}
</p>
<p>
{{ weatherReport('full','tts') }}
</p>
<p>
There are {{ states('sensor.services_down') }} services currently offline.
{% if states('sensor.services_down') | int > 0 %}
They are {{ state_attr('sensor.services_down','services') }}.
{% endif %}
</p>
<p>
{% if is_state('input_boolean.sports_updates','on') %}
{{ sports_updates('pregame') }}
{{ sports_updates('main') }}
{% endif %}
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}