I am trying to write a python script which uses python requests to fill in a command line sensor with REST API calls.
From command line using python3, the script works fine and fills all state and attribute info on the sensor without any problem.
But when i execute it with command_line sensor command; hassio and HA refuses a connection to the REST API with 111: Connection refused. As far as i understand; since the command is executed within the hassio docker container, these addresses do not work:
- http://localhost:8123/api/states/sensor.cl_test
- http://192.168.1.XX:8123/api/states/sensor.cl_test
- http://hassio.local:8123/api/states/sensor.cl_test
I have not tried 172.30.31.1:8123 yet; think this is the internal docker container ip of hassio and homeassistant.
So, in short, which address am i supposed to use within the hassio and HA docker container to reach the localhost for REST API usage?