Home Assistant

It does look like your HA instance may not be receiving updates from Hubitat. Assuming things are working correctly, the communication sequence should look like:

2020-04-12 16:36:58 DEBUG (MainThread) [custom_components.hubitat.light] Turning on Hall Light with {}
2020-04-12 16:36:58 DEBUG (MainThread) [custom_components.hubitat.device] sent on to 514
2020-04-12 16:36:59 DEBUG (MainThread) [hubitatmaker.hub] Received event: {'name': 'switch', 'value': 'on', 'displayName': 'Hall Light', 'deviceId': '514', 'descriptionText': 'Hall Light switch is on', 'unit': None, 'data': None}
2020-04-12 16:36:59 DEBUG (MainThread) [hubitatmaker.hub] Updating switch of 514 to on
2020-04-12 16:37:02 DEBUG (MainThread) [custom_components.hubitat.light] Turning off Hall Light
2020-04-12 16:37:02 DEBUG (MainThread) [custom_components.hubitat.device] sent off to 514
2020-04-12 16:37:02 DEBUG (MainThread) [hubitatmaker.hub] Received event: {'name': 'switch', 'value': 'off', 'displayName': 'Hall Light', 'deviceId': '514', 'descriptionText': 'Hall Light switch is off', 'unit': None, 'data': None}
2020-04-12 16:37:02 DEBUG (MainThread) [hubitatmaker.hub] Updating switch of 514 to off

A command goes out, and within a second or so, an even is received from Hubitat confirming that the device state was changed.

So, one thing to check is the Hubitat logs -- when you toggle a switch in Home Assistant, does the device in Hubitat show a state change in the Hubitat live log?

Another thing to check -- is Hubitat posting to the proper address? Open your Maker API instance in Hubitat and look at the "URL to send device events to by POST" field. Try POSTing to it, with curl for example:

$ curl --data '{"id":"33"}' http://10.0.1.100:45343

(The specifics of the "data" value don't really matter, we just need to POST something to the endpoint.) If the endpoint is valid, you should get back OK from that command.

I presume this is what you mean by state change. Here are my Hubitat logs as a result of me clicking the HA button:

[app:775](http://10.16.1.95/logs#app775)2020-04-12 16:58:58.938 [debug](http://10.16.1.95/installedapp/configure/775)deviceItem called

[app:775](http://10.16.1.95/logs#app775)2020-04-12 16:58:58.935 [debug](http://10.16.1.95/installedapp/configure/775)Executing command: off on device: Kitchen Work Lights

[app:775](http://10.16.1.95/logs#app775)2020-04-12 16:58:58.884 [debug](http://10.16.1.95/installedapp/configure/775)findDevice called

[app:775](http://10.16.1.95/logs#app775)2020-04-12 16:58:58.881 [debug](http://10.16.1.95/installedapp/configure/775)sendDeviceCommand called

Something I wanted to look at closer. For the configuration of POST, what port is the HA device supposed to listen on? Is it 45343?

Hopefully there's a message from the device itself in there, too:

dev:514 2020-04-12 17:02:34.145 info Hall Light switch is on
app:2269 2020-04-12 17:02:34.054 debug deviceItem called
app:2269 2020-04-12 17:02:34.049 debug Executing command: on on device: Hall Light
app:2269 2020-04-12 17:02:34.000 debug findDevice called
app:2269 2020-04-12 17:02:33.994 debug sendDeviceCommand called

The HA integration will listen on a random port by default, but you can set it to something specific if you need to.

ahh, so it is using an ephemeral port? That may be the problem. I have this setup in a container that is NAT'd to the host OS. How do I set it static?

In HA: Configuration -> Integrations -> Hubitat -> settings cog in upper right. Set "Event server port" to whatever you need, then restart HA.

That was the problem. My configuration when NAT'ing out had to be static. Then I set the port on the Hubitat to match and everything is working. Thank you very very much @jason0x43. Your help has been spectacular, and your patience event greater.

1 Like

Excellent! :tada:

@jason0x43 Not sure which side has an error, but if I create a Hubitat Virtual Temperature Bulb and make an adjustment with an HA automation, I get the wrong values on HE when calling for ˚K from HA

Screen Shot 2021-01-18 at 6.05.04 PM
Screen Shot 2021-01-18 at 6.05.36 PM
Screen Shot 2021-01-18 at 6.09.35 PM
Screen Shot 2021-01-18 at 6.09.46 PM

Hmmm... HA deals internally in mireds rather than °K, and it's possible there's a rounding issue in there somewhere. I'll take a look (issue).

After looking into it a bit more, that color temp mismatch is just a function of how HA works. Kelvin temps are converted to mireds by HA before being passed to light entities, so an entity only deals with mireds (it never even sees the kelvin parameter).

2 Likes

Glad I saw your post about the HACS issue. I've been scratching my head trying to figure out why I cannot find it. Manual install also not working now, but I'm probably missing a hidden directory this time because I'm trying to install on a virtual machine over Samba.

No clue why manual wouldn't work on HASS.IO before, but updated to HA 2021.2.2 and now can install :man_shrugging:

I have no reason to bring Zigbee or Z-Wave devices from HE to HA, but the ability to share HE virtual switches with HA so easily comes in real handy. I realized this was a way to put some of my Lutron Connected Bulb Remotes back in service. Not perfect, but it works! Thanks again for this @jason0x43 !

https://community.hubitat.com/t/a-word-about-ha-he-integration/63754/110?u=smarthomeprimer

1 Like

How did you solved this? im having the exact issue. When i toggle the switch it turn on the light and then return to the off position automatically.

I just did a new install, and that's exactly what's happening to me. When I turn a lamp on, it goes on, but the icon in HA flips back to the "off" position. It seems ALL my devices are acting this way. Seems like its not receiving info back from hubitat, but I can send.
Edit: It is receiving data back from hubitat, but it takes a few hours. It shows mw temps from thermostats from a few hours ago
Any thoughts?

Hmmm...generally the problem when Hubitat can't communicate with HA is that the HA instance is running in a VM or behind a firewall or something. When the HA integration starts up, it updates the "URL to POST device events to" address in the associated Maker API instance in Hubitat. That URL must be one that Hubitat can actually reach.

By default, the integration pings Hubitat and uses the address of whatever interface it used to reach Hubitat. If your HA is running in a VM using NAT addressing, that address will be some internal IP address that Hubitat can't reach.

If you're in that situation, you'll need to manually set the event server URL and port in the Hubitat integration in HA the address or hostname of the physical host (the host visible to Hubitat), and then make sure whatever port you set there is mapped to the VM running HA.

1 Like

My HA is running in docker desktop. I'll mess around with it when I get home from work and report back. Only odd thing is that it is receiving some things. Would the event server be the hubitat ip?
Edit The only time HA is getting updated info from hubitat is when I do a HA server restart. Exactly what you said. So that confirms is definitely an issue with the inbound from hubitat to HA

Are you on a recent HA version? What you do have your HA network settings set to (configuration --> general --> network)? You may need to uncheck autoconfigure and manually select the correct (external) interface for HA to bind to.

Its a brand new HA install. Its running on a windows machine using docker desktop

If you uncheck "auto configure", what are the other options? That 172.x address is in the private space...