New idea for status report macros

This commit is contained in:
2023-05-19 14:14:26 -04:00
parent a4158862a0
commit 686934fd78
2 changed files with 41 additions and 13 deletions

View File

@ -128,3 +128,41 @@ Kallen is staying elsewhere overnight.
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro twitchStreamInfo(method) %}
{% from 'time.jinja' import next_twitch_stream %}
{% set streamstart = state_attr('input_datetime.tony_streaming_start_time','timestamp') | timestamp_custom('%-I:%M %p',false) %}
{% set game = state_attr('sensor.twitch_ironnerd24','game') %}
{% set viewers = state_attr('sensor.twitch_ironnerd24','viewers') %}
{% if is_state('sensor.twitch_ironnerd24','streaming') %}
Tony is currently streaming. The current stream category is {{ game }}. The current viewer count is {{ viewers }}.
{% elif is_state('input_boolean.tony_streaming_today','on') %}
{% if method == 'tts' %}
{{ [
"Tony will be pretending to be a real content creator tonight. ",
"Tony will be doing his best to defeat his impostor syndrome tonight. ",
"Tony will be playing video games and yelling into a microphone tonight. ",
"Tony will be scraping out the nickels and dimes tonight for the sake of entertainment. ",
"Tony is not really all that funny, but tonight he will present himself to a crowd of questionable individuals who seem to think that he is. "
] | random }} The studio is scheduled to go online at {{ streamstart }}. "
{% elif method == 'text' %}
Tony will be streaming today. Stream starts at {{ streamstart }}.
{% endif %}
{% else %}
Tony does not have a stream scheduled today. The next scheduled stream is in {{ next_twitch_stream() }} approximately.
{% endif %}
{% endmacro %}
{% macro tonyStatusReport(type,method) %}
{% from 'status.jinja' import medReportTony, twitchStreamInfo %}
{% from 'time.jinja' import ct %}
{% if type == 'meds' %}
{{ medReportTony() }}
{% endif %}
{% if type == 'stream' %}
{{ twitchStreamInfo(method) }}
{% endif %}
{% if type == 'full' %}
{{ medReportTony() }}
{{ twitchStreamInfo(method) }}
{% endif %}
{% endmacro %}

View File

@ -2,8 +2,8 @@
{# Daily Briefing #} {# Daily Briefing #}
{%- macro getReport() -%} {%- macro getReport() -%}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %} {% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %}
{% from 'time.jinja' import input_datetime_12hr, next_twitch_stream %} {% from 'time.jinja' import input_datetime_12hr %}
{% from 'status.jinja' import emma_sleep %} {% from 'status.jinja' import emma_sleep, tonyStatusReport %}
{% from 'easy_time.jinja' import count_the_days, custom_time %} {% from 'easy_time.jinja' import count_the_days, custom_time %}
<p> <p>
{{ greeting() }} {{ greeting() }}
@ -282,17 +282,7 @@
] | random }} at {{ input_datetime_12hr('input_datetime.tina_workday_start') }}. ] | random }} at {{ input_datetime_12hr('input_datetime.tina_workday_start') }}.
{% endif %} {% endif %}
{% if is_state('input_boolean.tony_streaming_today','on') %} {{ tonyStatusReport('stream','tts') }}
{{ [
"Tony will be pretending to be a real content creator tonight. ",
"Tony will be doing his best to defeat his impostor syndrome tonight. ",
"Tony will be playing video games and yelling into a microphone tonight. ",
"Tony will be scraping out the nickels and dimes tonight for the sake of entertainment. ",
"Tony is not really all that funny, but tonight he will present himself to a crowd of questionable individuals who seem to think that he is. "
] | random }} The studio is scheduled to go online at {{ input_datetime_12hr('input_datetime.tony_streaming_start_time') }}. "
{% else %}
"Tony does not have a stream scheduled today. His next scheduled stream is in {{ next_twitch_stream() }}. "
{% endif %}
{% if is_state('input_boolean.kallen_school_today', 'on') %} {% if is_state('input_boolean.kallen_school_today', 'on') %}
{% if is_state('sensor.school_start_days2go', '0') %} {% if is_state('sensor.school_start_days2go', '0') %}