jbergler / hass-ttlock

Home Assistant integration for TTLock locks
65 stars 13 forks source link

No URL for webhook #135

Closed Jesper9mi closed 2 months ago

Jesper9mi commented 2 months ago

Describe the bug

When installing TTLock, everything goes fine, except I dont get the Call back URL, which means the Lock status is not correctly up to date when locking/unlocking from App/Physical on the lock.

To Reproduce

Steps to reproduce the behavior:

Just install the integration - I can lock/unlock and see 100% battery status. I cant see Last operator, last trigger as well as passagemode.

My Home assistant is available on https:// link with port redirect (I use custom TCP port forwarding down to VM with Hassio) <- could this be the issue?

Expected behavior

A clear and concise description of what you expected to happen.

Required information

config_entry-ttlock-01J5YYEDVXPRZ8GYPC66VTJ6XE (1).json

Please provide:

This error originated from a custom integration.

Logger: custom_components.ttlock Source: custom_components/ttlock/init.py:139 integration: TTLock (documentation, issues) First occurred: August 22, 2024 at 13:43:48 (2 occurrences) Last logged: 08:23:12

Could not find base URL for installation Traceback (most recent call last): File "/config/custom_components/ttlock/init.py", line 139, in register_webhook webhook_url = await self.get_url() ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ttlock/init.py", line 127, in get_url return webhook.async_generate_url( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/webhook/init.py", line 100, in async_generate_url f"{get_url( ^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 212, in get_url raise NoURLAvailableError homeassistant.helpers.network.NoURLAvailableError

jbergler commented 2 months ago

Hey @Jesper9mi - the NoURLAvailableError suggests that your home assistant instance is missing one of two things:

Could you check those?

Jesper9mi commented 2 months ago

Hi Jonas!

That helped a little bit :) Was not aware I had to set that URL (running home assistant for 4 years now :) )

Now I get the Webhook URL in the notifications:

Webhook url: https://xxyyzz.xxyyzz.dk:9999/api/webhook/280ecc712b7cc19be2924ddfg0f395fa443433de7f1fcecad7bd1b799a4a80

However when I try to put that into ttlock api it says that no "colon" is allowed, so it doesn't seems like I can use my own port forwarding (9999 -> 443) ...

So the only thing to do is to either expose hassio on traditional port 443 or use the cloud subscription?

(9999 not being the real port .. )

Jesper9mi commented 2 months ago

Hmm, now I can copy paste URL into TTOCk fine with ports and colons...

So.. Everything works for me now! The magic thing was the URL under Settings > General > Network :)

Thank you so much!

ahmadnazirafiq commented 2 months ago

Hi, when I try to put the webhook URL into callback URL box in TTLock website, it says timed out :(

jbergler commented 2 months ago

I'm glad you made some progress, not sure I can help much further though. You can try using some tool like https://portchecker.io/ to see if your port is reachable from the internet.

Also remember that ttlock is in China and if you have something like cloudflare proxying in then they may block access.