Custom Component: Hubitat

Are you getting updates from other devices? Like, if you flip a switch (assuming you have any switches), does HA show the proper state? It’s possible to have the integration in a state where HA can talk to Hubitat but Hubitat can’t send event updates back to HA. (Typically that happens when HA and Hubitat are on different networks.)

1 Like

Yes, I am getting updates from devices, although in the past few days I’ve been struggling to figure out what the issue is with the delayed response and sometimes erroneous state reports. Ended up placing 1 Hubitat device per room for smooth operation (my Fibaro HC2 that I’m moving away from is a significantly better player, range-wise).

I do not know much about the Hubitat → HA integration options yet but everything is on a single network, just to confirm.

I noticed that the “Temperature Reporting Interval” is set to Disabled by default on the Fibaro Motion Sensor, so it seems like I might have to pay attention to config values there, too…

It’s actually doing this to me now, when I flip a switch, light turns on instantly but the switch flips back 1 second later, so the light is on but the switch returns to Off state. Why would this be happening?

That’s the situation I was mentioning (HA can talk to Hubitat but Hubitat can’t send event updates back to HA). What’s happening is:

  1. You flip the switch in HA
  2. HA preliminarily updates the state of the switch entity to reflect the change
  3. HA never receives an update from the device, so it reverts the state of the switch entity

Open the Maker API instance in Hubitat and look at the “URL to POST device events to” value. Given your home’s network, is that an address that Hubitat should be able to directly access, or is it an address that’s behind a firewall, or on an internal docker/KVM/etc. network?

Thanks for clarifying the cause of Hubitat and HA communication issues. That makes sense but the thing is it used to work just fine for a while during the setup process. I have 3 Hubitat hubs configured in different parts of the house, all integrated into Home Assistant, the “URL to POST device events to” has the IP address of the Home Assistant (and a random 5 digit port number, different for each of the 3 Hubs which I assume is how it should be).

I tried to figure out at which point I could have triggered the communication issue but could not remember anything in particular. So I simply rebooted all the hubs and Home Assistance, and it started to work again which is somewhat confusing, maybe just a glitch.

You’ve been surprisingly responsive, Jason. I’ve watched a ton of youtube videos and read on forums before making the decision to switch to HA and also move away from Fibaro to an Internet-free hub. It looks like a long journey ahead but I’m up for it. Thank you!

Jason, I just figured out you’re the author of the integration! As a smart home enthusiast, I owe a lot to you here, thank you! 1165 is a long way to this point but I plan to read it all to understand where the Hubitat integration stands as I’m putting a lot of hope in it, I literally cannot stop clicking the on/off button to watch lights switch instantly with Hubitat. You know you sometimes are in the mood of playing with buttons, and if I did that to Fibaro, on the 5th or 6th click the hub would start protesting and pause one me until seconds later when it would resume executing the commands like a ton within a second. That kept bothering me until I came across Hubitat promising local functionality and fast steady response. The main issue besides the glitches is the antenna range but I’ve “fixed” that by setting up a Hub in each room until I decide on accepting the external antenna soldering adventure…

Fantastic job man, I am grateful to you for this, I really am.

I was working on setting up a new automation based on a Hubitat event. When I was creating it through the HA UI I realized that my Hubitat devices are all duplicated. I’m not sure when or how this happened, but any advice on how to remove the duplicates?

I see the same thing, one of the devices doesn’t have any entities though. I assumed it was something I did.

I just checked a few of the duplicated devices and see the same thing. One device has entities and the second device does not.

I didn’t change anything with the integration or on the Hubitat side aside from the HA updates and Hubitat firmware updates.

There were changes made a few months ago (v0.7.2) that could have resulted in some leftover devices with no associated entities. Try running through the integration’s config flow; that should let you remove the entity-less devices.

Thanks, I tried going through the Config flow but I still see all of the duplicates. If I remove the Hubitat integration and re-add it, is that a pretty seamless process or will that “break” anything like automations, dashboards, etc?

Hi,

I am trying to get events from Hubitat to Home Assistant.
I have Maker API and have installed this integration on HA.
As I want to receive button press events, I suppose I have to use “Event Server” on the integration.
But I don’t see much information on that on the README on Github.

What should I use for Event Server URL and Event Server port ?

And how can I configure the button to trigger an automation on HA ?

edit: nevermind; The field was populated automagically :slight_smile:

You should be able to manually delete the devices by going to through the config flow and picking them in the “devices to remove” section, although that’s kind of tricky if they have the same names. I had code in integration for a month or two that would automatically remove any leftover devices. I’ll see about adding that back.

Yeah, the event server is automatically managed, although you may still have to do some manual config depending on your network setup.

To add a button trigger, create an automation and add a Device trigger for your button device. You should be able to choose a specific button press event.

My problem is that the devices have the same exact name, so when I’m just looking at the list I don’t know which one to remove.

Thanks

Trying to set this up as a Zigbee/ZWave hub and it’s throwing “Unexpected error occured” when trying to add it. I’ve got the app ID I made in Hubitat (HomeAssistant), the access token, and the IP address entered but am leaving all other spots blank. Anything I’m missing?

The app ID, access token, and IP address are all that should be required, as long as HA can see the Hubitat hub (and vice versa).

Could you take a look at the Home Assistant log to see if there’s a more informative error in there?

Looks like there is. Here’s the full output of the error:

2022-12-30 10:57:05.114 ERROR (MainThread) [custom_components.hubitat.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/hubitatmaker/hub.py", line 163, in check_config
    await self._check_api()
  File "/usr/local/lib/python3.10/site-packages/hubitatmaker/hub.py", line 304, in _check_api
    await self._api_request("devices")
  File "/usr/local/lib/python3.10/site-packages/hubitatmaker/hub.py", line 421, in _api_request
    json = await resp.json()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.0.110/apps/api/HomeAssistant/devices?access_token=+%TOKENDELETED')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/hubitat/config_flow.py", line 88, in async_step_user
    info = await _validate_input(user_input)
  File "/config/custom_components/hubitat/config_flow.py", line 438, in _validate_input
    await hub.check_config()
  File "/usr/local/lib/python3.10/site-packages/hubitatmaker/hub.py", line 165, in check_config
    raise ConnectionError(str(e))
ConnectionError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.0.110/apps/api/HomeAssistant/devices?access_token=+%TOKENDELETED')
2022-12-30 11:41:18.196 ERROR (MainThread) [custom_components.hubitat.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/hubitatmaker/hub.py", line 163, in check_config
    await self._check_api()
  File "/usr/local/lib/python3.10/site-packages/hubitatmaker/hub.py", line 304, in _check_api
    await self._api_request("devices")
  File "/usr/local/lib/python3.10/site-packages/hubitatmaker/hub.py", line 421, in _api_request
    json = await resp.json()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.0.110/apps/api/HomeAssistant/devices?access_token=+%TOKENDELETED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/hubitat/config_flow.py", line 88, in async_step_user
    info = await _validate_input(user_input)
  File "/config/custom_components/hubitat/config_flow.py", line 438, in _validate_input
    await hub.check_config()
  File "/usr/local/lib/python3.10/site-packages/hubitatmaker/hub.py", line 165, in check_config
    raise ConnectionError(str(e))
ConnectionError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('http://192.168.0.110/apps/api/HomeAssistant/devices?access_token=+%TOKENDELETED')
2022-12-30 11:58:08.325 ERROR (MainThread) [frontend.js.latest.202212131] :0:0 ResizeObserver loop completed with undelivered notifications.

Edited for formatting and to delete redundant errors from when I repeatedly attempted this. If it helps, the token I’m entering is with the dashes- I’m just doing the copy/pasta thing from Hubitat to HA

For the app ID, make sure you’re using the numeric app ID, not the string “HomeAssistant”. The Hubitat app ID is the number after app/ in the Maker API url from Hubitat.

Worked like a charm. Maybe add that info to the readme?

Anyway, thanks for the help Jason, and happy new year!