ChrisRomp / addon-ecowitt-proxy

An HTTP receiver for Ecowitt data for sending to the Home Assistant integration.
Apache License 2.0
14 stars 2 forks source link

request don't reach Ecowitt integration: 2023-08-06 15:38:07 INFO 10.116.0.178 - - [06/Aug/2023 15:38:07] "POST /api/webhook/WEBHOOK_ID HTTP/1.1" 404 - #2

Closed ascheucher closed 1 year ago

ascheucher commented 1 year ago

Thanks for sharing your little add on! But I can't get it to work. This is how I have installed it:

obviously this doesn't work for me now. This is the Proxy's log:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[15:37:53] INFO: Using webhook ID 
2023-08-06 15:37:54 INFO     WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:8081
 * Running on http://10.116.0.31:8081
2023-08-06 15:37:54 INFO     Press CTRL+C to quit
2023-08-06 15:38:07 INFO     10.116.0.178 - - [06/Aug/2023 15:38:07] "POST /api/webhook/WEBHOOK_ID HTTP/1.1" 404 -
2023-08-06 15:39:11 INFO     10.116.0.178 - - [06/Aug/2023 15:39:11] "POST /api/webhook/WEBHOOK_ID HTTP/1.1" 404 -
2023-08-06 15:40:15 INFO     10.116.0.178 - - [06/Aug/2023 15:40:15] "POST /api/webhook/WEBHOOK_ID HTTP/1.1" 404 -

I assume this means the Proxy get's an 404 from the Ecowitt integration, isn't it? ...

I thought I figured out the problem, but no. there are two save buttons in the config section of the proxy!

I only used the lower one. Hence, I thought the webhook id wasn't saved and it did the request towards /api/webhook, but checking the old logs pasted here, I replaced the actual WEBHOOK_ID with... But it was missin from the log line: INFO: Using webhook ID

now I saved it once again, and it's in the log at the INFO: Using webhookd ID line, but I still geht the 404s

Looked in the code of receiver.py and it looks like the BASE_URL env viariable is not set up:

# docker exec -it addon_1d2e7f3c_ecowitt-proxy /bin/bash
1d2e7f3c-ecowitt-proxy:/app# echo $HA_BASE_URL

1d2e7f3c-ecowitt-proxy:/app#
ChrisRomp commented 1 year ago

Totally not your fault. This desperately needs documentation and I have provided none so far. That's coming soon.

In your Ecowitt gateway, set the webhook path to /log/ha.

I'm rethinking my whole approach and maybe this add-on is better as a generic webhook proxy, but I'll need to think through the security implications of that.

ascheucher commented 1 year ago

BINGO! Thx

2023-08-06 16:46:56 INFO     WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:8081
 * Running on http://10.116.0.31:8081
2023-08-06 16:46:56 INFO     Press CTRL+C to quit
2023-08-06 16:47:27 INFO     10.116.0.178 - - [06/Aug/2023 16:47:27] "POST /log/ha HTTP/1.1" 200 -

200 is a good response. :)

And Ecowitt integration status also changed to: 1 device and 25 entities

I'd call this a win.

Edit: the only regret I have with this now: I thought about to develop the same Add On to tip my toes into HA Add On development! :D

ChrisRomp commented 1 year ago

You're welcome to chip in! :) I wrote this as a simple python script that I ran as a service on another host, but I figured I'd learn some HA add-on development and share it.

ascheucher commented 1 year ago

Honestly would love to, but I have a bit to much on my plate already. But thanks for the offer!

ChrisRomp commented 1 year ago

No worries; I can totally relate. 😅

morice85 commented 10 months ago

Ciao ho questo problema:

Ho impostato come Api : /api/webhook/03505cfbbceec4c6275c7f4b6874d7e7 Porta 8081

Ho impostato la Stazione Ecowitt con: 192.168.0.100 /log/ha 8081 60

Dove Sbaglio? Qual'è l'errore?@ChrisRomp

Screenshot 2023-10-18 alle 00 06 14