Hi team,
I was reading thru:
And the post I made here has some background / context:
But in short, let’s say I have the following Jinja template in custom_templates folder:
{# COMMON #}
{% set someone_home = is_state('binary_sensor.someone_is_home', 'on') %}
{% set auto = is_state('input_select.home_ambiance', 'Automatic') %}
{# SLEEP #}
{% set napping = is_state('input_boolean.napping', 'on') %}
{% set sleeping = is_state('input_boolean.sleeping', 'on') %}
{% set overnight = is_state('input_boolean.overnight', 'on') %}
{# MOVIE #}
{% set movie = is_state('input_boolean.watching_movie', 'on') %}
{% set tv_playing = is_state('media_player.living_room_apple_tv', 'playing') %}
{# WEATHER #}
{% set dark_outside = is_state('binary_sensor.is_dark_outside', 'on') %}
{# TIMES #}
{% set early = is_state('binary_sensor.early_morning', 'on') %}
{% set morning = is_state('binary_sensor.morning', 'on') %}
{# TIMES #}
{% set alarm_triggered = is_state('alarm_control_panel.security_system', 'triggered') %}
Basically it’s just some standard variables that I was copy pasting in a lot of my automations / templates etc prior to this feature being announced recently.
I’d like to be able to import them and use them in other templates or automations, is there a way to import *?
Right now I have for example:
{% from 'common.jinja' import someone_home, auto, napping, sleeping, overnight, movie, tv_playing, dark_outside, early, morning, alarm_triggered
with context %}
{{ someone_home }}
But I’d like to import all variables without stating them, is that possible?
Thank you!!
Matt