jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
199 stars 47 forks source link

Event update URL set to None after latest hassio updates #102

Closed jh4mit closed 3 years ago

jh4mit commented 3 years ago

After applying Home Assistant Core (2021.5) and Supervisor on RPi installation, hac-hubitat sets the Maker API host POST URL to //None:0.

jh4mit commented 3 years ago

Relevant log after debug:

021-01-25 13:43:58 INFO (MainThread) [homeassistant.setup] Setting up hubitat 2021-01-25 13:43:58 INFO (MainThread) [homeassistant.setup] Setup of domain hubitat took 0.0 seconds 2021-01-25 13:43:58 DEBUG (MainThread) [custom_components.hubitat.device] Initializing Hubitat hub with event server on port 0
2021-01-25 13:43:58 DEBUG (MainThread) [hubitatmaker.hub] Setting host to X.X.X.50 2021-01-25 13:43:58 INFO (MainThread) [hubitatmaker.hub] Created hub 2021-01-25 13:43:58 DEBUG (MainThread) [hubitatmaker.hub] Listening on X.X.X.40:33387 2021-01-25 13:43:58 INFO (MainThread) [hubitatmaker.hub] Setting event update URL to %2F%2FNone%3A0 https://github.com/hacs/integration/issues
2021-01-25 13:44:01 DEBUG (MainThread) [hubitatmaker.hub] Loaded device list 2021-01-25 13:44:01 DEBUG (MainThread) [hubitatmaker.hub] Loading device 32 2021-01-25 13:44:01 DEBUG (MainThread) [hubitatmaker.hub] Loaded device 32 2021-01-25 13:44:01 DEBUG (MainThread) [hubitatmaker.hub] Loading device 1 ...

jason0x43 commented 3 years ago

Had you manually set the event URL or port in the integration options? (Not that it should be a problem, but I might have missed a corner case somewhere.)

Where is the https://github.com/hacs/integration/issues URL coming from? Like, was it in the logs, and if so, what line? (That's not a message displayed by this integration.)

jh4mit commented 3 years ago

Don't remember setting event URL before, unless through the set-up dialog.

https://github.com/hacs/integration/issues appears in the log on that line -- no other info, so not sure what component is generating it.

jason0x43 commented 3 years ago

What version of the Hubitat integration are you running? Also, has this been happening for multiple restarts?

jh4mit commented 3 years ago

Integration 0.6.1. I've reinstalled through HACS, and the issue remains.

It also persists through restarting Hubitat and through restarting Home Assistant (both core restart and host reboot). I've manually changed the POST URL to the logged IP and port; this restores response to device events, but it gets reset to None when Home Assistant reboots.

Not sure where the persistent data for the integration gets stored, but if you tell me where to look, I can check re custom URLs.

If it helps, core.config_entries for Hubitat looks like:

{ "entry_id": "46aec1fcc35257c3aa3c831186e3150b", "version": 1, "domain": "hubitat", "title": "Hubitat (9f8085f6)", "data": { "use_server_url": false, "server_port": 0, "temperature_unit": "F", "host": "X.X.X.50", "app_id": "108", "access_token": "<redacted>", "server_url": "" }, "options": {}, "system_options": { "disable_new_entities": false }, "source": "user", "connection_class": "local_push", "unique_id": null }

jatgm1 commented 3 years ago

Ya idk what's up but I just had to restore hassio, running on docker ce on raspbian(raspberry pi os) because none of the motion sensors update.

jason0x43 commented 3 years ago

Ah, I think I see the problem. The way server_url was handled changed between v0.5.x and v0.6.x. In v0.5.x, server_url always had a value (it was "" when empty), and it used the use_server_url flag to decide whether or not to use the custom URL. In v0.6.x, I figured out how to properly handle a null value for server_url, so I got rid of the flag. Now an empty server_url is being used, which ends up being parsed as //None:0.

The quick and dirty solution is to shut down HA and set server_url: null in the config entry. I'll publish an updated version in a bit will more gracefully handle this situation.

jatgm1 commented 3 years ago

Cool beans jazz cat 😺 so like I'm not sure how to fix that, can you comment on this when it's fixed to let me know it's updatable?

jason0x43 commented 3 years ago

v0.6.2 has been published. Give that a try.

jatgm1 commented 3 years ago

😃

jatgm1 commented 3 years ago

So it works, just to let you know.

jh4mit commented 3 years ago

Latest patch fixed! Awesome.