Closed BDVGitHub closed 9 months ago
Just test that curl command without going inside the docker container. Give it a try from a simple new terminal. Your HA url looks weird though. Is it just localhost? No 8123 port?
Hey, thanks for the advice, changed in secrets_emhass.yaml hass_url: http://localhost to hass_url: http://172.17.0.1:8123/ and is now working fine
Describe the bug When running curl -i -H ’Content-Type:application/json’ -X POST -d ’{}’ http://localhost:5000/action/dayahead-optim I get an internal server error 500
In Docker I have edited config_emhass.yaml and secrets_emhass.yaml
In Home Assistant I put in configuration.yaml
shell_command: dayahead_optim: "curl -i -H \"Content-Type:application/json\" -X POST -d '{}' http://localhost:5000/action/dayahead-optim" publish_data: "curl -i -H \"Content-Type:application/json\" -X POST -d '{}' http://localhost:5000/action/publish-data"
and in automations.yaml
To Reproduce root@MiniPCServer:/home/brecht# docker exec -it DockerEMHASS bash root@6185e47f85ef:/app# curl -i -H 'Content-Type:application/json' -X POST -d '{}' http://localhost:5000/action/dayahead-optim HTTP/1.1 500 INTERNAL SERVER ERROR Content-Length: 265 Content-Type: text/html; charset=utf-8 Date: Wed, 14 Feb 2024 20:58:38 GMT Server: waitress
<!doctype html>
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
**Expected behavior** What do I need to do to run curl -i -H 'Content-Type:application/json' -X POST -d '{}' http://localhost:5000/action/dayahead-optim without error? **Home Assistant installation type** - Home Assistant Supervised - Home Assistant Core **Your hardware** - OS: Linux (Debian) - Architecture: x86_64 **EMHASS installation type** - Docker Standalone **Additional context** Docker info lient: Docker Engine - Community Version: 25.0.3 Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.12.1 Path: /usr/libexec/docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.24.5 Path: /usr/libexec/docker/cli-plugins/docker-compose Server: Containers: 14 Running: 12 Paused: 0 Stopped: 2 Images: 14 Server Version: 25.0.3 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Using metacopy: false Native Overlay Diff: true userxattr: false Logging Driver: journald Cgroup Driver: cgroupfs Cgroup Version: 1 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 runc Default Runtime: runc Init Binary: docker-init containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc version: v1.1.12-0-g51d5e94 init version: de40ad0 Security Options: apparmor seccomp Profile: builtin Kernel Version: 6.1.0-17-amd64 Operating System: Debian GNU/Linux 12 (bookworm) OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 7.637GiB Name: MiniPCServer ID: f5877512-ed00-4d57-8a35-5f8145d7b5f0 Docker Root Dir: /var/lib/docker Debug Mode: false Experimental: true Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false log file 2024-02-14 20:29:06,597 - web_server - INFO - Launching the emhass webserver at: http://0.0.0.0:5000 2024-02-14 20:29:06,597 - web_server - INFO - Home Assistant data fetch will be performed using url: http://localhost/ 2024-02-14 20:29:06,597 - web_server - INFO - The data path is: /app/data 2024-02-14 20:29:06,598 - web_server - INFO - Using core emhass version: 0.7.7 waitress INFO Serving on http://0.0.0.0:5000 2024-02-14 20:30:00,073 - web_server - INFO - Setting up needed data 2024-02-14 20:30:00,094 - web_server - INFO - >> Publishing data... 2024-02-14 20:30:00,094 - web_server - INFO - Publishing data to HASS instance 2024-02-14 20:30:00,104 - web_server - ERROR - Exception on /action/publish-data [POST] Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 198, in _new_conn sock = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 496, in _make_request conn.request( File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 400, in request self.endheaders() File "/usr/local/lib/python3.11/http/client.py", line 1281, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1041, in _send_output self.send(msg) File "/usr/local/lib/python3.11/http/client.py", line 979, in send self.connect() File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 238, in connect self.sock = self._new_conn() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 213, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: