I have started to dip my toes into very simple python code. I have managed to write a script that can find the sea temperature from a website and print the result as a string. How do I make a script that would display this value as an entity in HA?
At this stage I want to keep it as simple as possible, just getting the value once or twice a day and displaying it in HA.
Let’s say I would like to write a python script and place it in /config/python_scripts (which I did). How do I call it from hass and pass the result to an entity, e.g. sensor.seatemp?
I am stumbling already on line 1, import with the following error:
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "sea_temp.py", line 1, in <module>
ImportError: __import__ not found
I would love to be able to accomplish this or something similar, both for the actual result, but also from a learnings experience. I have read through the documentation in hass and looked at the python section of the forum, but not yet found anything that helps me.