I need to parse some JSON with a python script that I want to execute with the python_script service. The problem is that with the python_script service, you can’t use imports. I was thinking of using the from_json template filter and wondered if somehow I can evaluate a template from within the python script.
Hello, I’m interested by the solution but I don’t understand how it’s done ?
What does mean : “Pass the object to the script unmodified and it should be a dictionary”
The goal is, if I have “sensor.temperature” in area “Room1”, in my script I would like be able to do the code above and get “Room1” in the return “areaFunction(‘sensor.temperature’)”
Since the last version, you can use in template the function {{area_name(entity_id)}} to get the area name where the sensor is.
I wanted to use this in a python script. The title of this post was perfect, but I think the solution was not for me ^^