Dump dictionaries in automations

Hi,
I have some automations and want to see which data is provided via the “trigger” dictionary.
Tried {{ trigger | tojson }} (https://jinja.palletsprojects.com/en/2.10.x/templates/#tojson) but that did not work because tojson is not defined.
What is the correct way to get insights into those variables?

Best,
Christoph

tojson should definitely be defined. The problem may be that that filter doesn’t know how to convert State objects. You could try {{ trigger | to_json }} instead. (to_json is a HA extension to Jinja which was just recently added.) Or you could simply try {{ trigger }}.

For to_json I got TypeError: Object of type Event is not JSON serializable but simply use {{ trigger }} worked fine. Thanks.

1 Like