omcdr
(omcdr)
1
How to create JSON message with Jinja2 template ?
{% set my_test_json = {'1': '{{ states("device_tracker.paulus") }}' %}
{{ my_test_json }}
I got:
Error rendering template: TemplateSyntaxError: expected token ‘,’, got ‘device_tracker’
It should be { ‘1’:‘unknown’}
brendena
(Brenden Adamczak)
2
This worked for me
{%
set my_test_json = {
‘1’: states(“device_tracker.paulus”)
}
%}
{{ my_test_json }}
1 Like
treno
(travis reno)
3
{% set my_test_json = {'1': states('device_tracker.paulus')} %}
{{ my_test_json }}
1 Like