An automation action can’t pass trigger variables to a python script, which makes for much more complex automations. We need the ability for trigger variable expressions to get evaluated before the script call, rather than passing the expression string itself.
I’m not understanding. You can document the inputs to your python script like this. And then when you call your python script from an automation you can definitely use an expression for one of those inputs and get it evaluated. Just like you can with any other service call. Something like this works fine:
action:
- service: python_script.my_script
data:
my_input: "state: {{ trigger.to_state.state }}"
So what’s missing here?
2 Likes
Unfortunately it’s been a while since I tried this. I’ll have to go back and figure out what I was trying to do and see if I can reproduce the problem I was having.