You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's another way that has the benefit of being able to pluck sub objects (keys) which I couldn't get to work using your version...
a generic macro followed by a templated call to the macro.
has allowed me to replace 100's of lines of clunky yaml, with nice clean json...and pull it in all over the place.
If I could figure out how to do it with an import and a key, that would be even better. but I can't get something like: {% from '/config/yaml/imports/footer-buttons.yaml' import porch as footer_data with context %} to work.
But the below does work.
{% macro import_json(source) %}
{% include source %}
{% endmacro %}
{% set dpad_device = "firetv" %}
{% set dpad_file = '/config/yaml/imports/dpad_buttons.json' %}
{% set dpad_data = (import_json(dpad_file) | fromjson)[dpad_device] %}
{% set dpad_entity = "media_player.fire_tv_192_168_1_91" %}
Is it possible somehow to include variables from another file somehow?
I tried these two methods, but actually didn't expect it to work (and it didn't):
and in json-settings.yaml:
'{ "settingA": true, "settingB": false }'
And this version as well:
and in json-settings.yaml:
Also tried using jinja2 include without success.
I'm trying to avoid using global variables (requires a restart of HA)
Does anyone have any ideas on how to solve this?
The text was updated successfully, but these errors were encountered: