jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
196 stars 48 forks source link

Unable to get devices listed/showing in HA #107

Closed shanelord01 closed 3 years ago

shanelord01 commented 3 years ago

Config Hubitat Elevation® Platform Version 2.2.5.131 Hardware Version Rev C-4

Home Assistant Version core-2021.3.3 supervisor-2021.03.4

Hubitat Integration Version 0.6.5 (installed via HACS)

Setup

Debug logs from the Hubitat hub show a number of lines of below:

app:7062021-03-10 12:26:21.227 am debugdeviceItem called app:7062021-03-10 12:26:21.224 am debugfindDevice called app:7062021-03-10 12:26:21.222 am debuglistDevices called app:7062021-03-10 12:44:10.282 am debugTesting URL is http://192.168.1.90/apps/api/706/devices?access_token=5059f02c-ef64-4c54-b985-xxxxxxxxxxxx

(x's used for privacy just in case - in reality this shows the correct access token)

So the Integration is talking to the hub.

After doing this, the Hubitat Hub is auto populating the HA server IP address and random port (am assuming set by HA Hubitat Integration) in the "URL to send device events to by POST" field.

Troubleshooting steps taken:

Any help would be appreciated as I am out of ideas on how to get this to work.

Thanks, Shane.

shanelord01 commented 3 years ago

Wow. Out of the blue it resolved - only final test I tried was to enable "Allow Control of HSM" in Hubitat Maker API, then restarted HA.

jason0x43 commented 3 years ago

Hmmm...a bug was fixed a while back where not having HSM enabled could cause an initialization error in the library the integration uses to communicate with Hubitat. Hopefully it was a fluke, but if you run into the issue again (or feel like disabling HSM to see if the issue comes back), we can reopen this.

shanelord01 commented 3 years ago

Hmmm...a bug was fixed a while back where not having HSM enabled could cause an initialization error in the library the integration uses to communicate with Hubitat. Hopefully it was a fluke, but if you run into the issue again (or feel like disabling HSM to see if the issue comes back), we can reopen this.

There was definitely a log entry with a failure around HSM in HA. I missed capturing it but I def saw it as it prompted me to test changing HSM to on as a last resort. I changed the setting in Hubitat and rebooted HA. It then worked.

I'll try turning it off and see if it re-occurs.

Edit: Just did... log error:

Logger: homeassistant.config_entries
Source: custom_components/hubitat/device.py:183
First occurred: 8:35:49 AM (1 occurrences)
Last logged: 8:35:49 AM

Error setting up entry Hubitat (5059f02c) for hubitat
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 248, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/hubitat/__init__.py", line 37, in async_setup_entry
    if not await hub.async_setup():
  File "/config/custom_components/hubitat/device.py", line 183, in async_setup
    await self._hub.start()
  File "/usr/local/lib/python3.8/site-packages/hubitatmaker/hub.py", line 178, in start
    await self._load_hsm_status()
  File "/usr/local/lib/python3.8/site-packages/hubitatmaker/hub.py", line 343, in _load_hsm_status
    self._hsm_status = hsm["hsm"]
KeyError: 'hsm'
uvjim commented 3 years ago

Hi,

I'm also seeing this in a new setup (have another working). The main difference appears to be HSM being disabled.

Logger: homeassistant.config_entries
Source: custom_components/hubitat/device.py:183
First occurred: 19:53:31 (1 occurrences)
Last logged: 19:53:31

Error setting up entry Hubitat (272b3204) for hubitat
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 248, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/hubitat/__init__.py", line 37, in async_setup_entry
    if not await hub.async_setup():
  File "/config/custom_components/hubitat/device.py", line 183, in async_setup
    await self._hub.start()
  File "/usr/local/lib/python3.8/site-packages/hubitatmaker/hub.py", line 178, in start
    await self._load_hsm_status()
  File "/usr/local/lib/python3.8/site-packages/hubitatmaker/hub.py", line 343, in _load_hsm_status
    self._hsm_status = hsm["hsm"]
KeyError: 'hsm'

I have no issue with enabling HSM at present as all work is done in HASS rather than anything in Hubitat. Just thought I'd add my 2p just in case you need anymore testing.

jason0x43 commented 3 years ago

That's good to know, thanks! I really thought I'd disabled hubitatmaker's requirement for HSM to be enabled, but I'll have to double check...

jason0x43 commented 3 years ago

Fixed in v0.6.6

uvjim commented 3 years ago

Just upgraded and disabled HSM again in Hubitat. Can confirm this working with devices being listed.

I do now receive the following warning on restart mind you. I'm happy to ignore for now.

`Logger: hubitatmaker.hub Source: /usr/local/lib/python3.8/site-packages/hubitatmaker/hub.py:180 First occurred: 16:16:11 (1 occurrences) Last logged: 16:16:11

Unable to access HSM status: 'hsm'`

jason0x43 commented 3 years ago

That warning is expected with the current code, and can safely be ignored. At some point I’ll see about silencing the warning entirely if it makes sense.