home-assistant-configuration/config/templates/twitter_new_ha.yaml

42 lines
1.5 KiB
YAML
Raw Normal View History

2019-02-21 17:49:55 +00:00
>
{% macro getIntro() %}
{{- [
"Woohoo! ",
"BAM! ",
"Look at that! "
] | random -}}
{% endmacro %}
{% macro getVersion() %}
2019-12-09 13:24:48 +00:00
@home_assistant version {{ states.sensor.released_version.state }} is out.
2019-02-21 17:49:55 +00:00
{% endmacro %}
{%- macro getRandomSnark() -%}
{{- [
" Its like Patch Tuesday, but without the fail. Visit https://www.home-assistant.io #homeassistant",
" Get in my SD Card! Visit https://www.home-assistant.io #homeassistant",
" Shut up and take my ones and zeros! Visit https://www.home-assistant.io #homeassistant",
" Seriously, you want some of this! Visit https://www.home-assistant.io #homeassistant",
" Friends dont let friends update #homeassistant without reading breaking changes! Visit https://www.home-assistant.io ",
2019-02-21 17:49:55 +00:00
" If you are not running #homeassistant now is the best time to get started. Visit https://www.home-assistant.io"
] | random -}}
{%- 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() -%}
{{ getIntro() }}
{{ getVersion() }}
{{ getRandomSnark() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}