OpenWonderLabs / SwitchBotAPI

SwitchBot Open API Documents
893 stars 73 forks source link

Webhooks not working in production #368

Open ric-101 opened 6 days ago

ric-101 commented 6 days ago

Current Situation

Hi there! So I'm trying to set up web hooks, and I managed to get things to look like they SHOULD work, but they don't when needed. Here's what I have:

Things which MAY influence this:

Any ideas? what could stop SwitchBot from correctly calling my server's webhook URL?

Thank you :)

Logs

I there a way to find SwitchBot's log about webhook calls it makes? I haven't been able to find it

Configuration

Not sure what you may need, configuration works on the dev server...

Environment

Dev server: PyCharm, windows (behing ngrok) Prod server: Linux, gunicorn, nginx, local, ssh reverse tunnel to make it accessible from outside.

Additional Context

No response

Larsene commented 4 days ago

My thought is that your production server NEED a valid ssl certificate. Switchbot has no options (as far as i know) to support self signed certificates, nor to enable or disable SSL certificate checking - as Twilio allow for example).

As you're working with a python project, you can host it online for testing, with real certificate on alwaysdata (free under 100Mb, good for testing).

Didn't you find anything useful on nginx requests logs ?

ric-101 commented 3 days ago

Thank you! Indeed seems to be working after removing SSL!

I still can't get the webooks from he keypad though... any idea way? Also, any other event than "add/remove" code? Actually I'd like an event anytime anyone presses a key on the keypad...

Thank you!

Larsene commented 3 days ago

You're welcome.

I've the same problem for the keypad #361 as others has #367 . There's a bug in the API for the keypad, and even after an asking on the switchbot client support, nothing change (the support doesn't help on the API).

Anyway, the API has no webhook notifications for the key entered on the keypad, only if a code is created or deleted... A good proposal has been made here #192 but unfortunably Switchbot developpers are not really presents here....