[Release] Logitech Harmony Hub Driver v0.1.20230311

I believe Device commands could be implemented. I’m not planning on actively adding that capability, but I welcome others to do so.

Dan, did the public release of 2.03 break this integration?

edit: disregard, for some reason I had to open the parent device and re-save then it came back to life

1 Like

I saw the same thing going from the first beta to the second beta with this driver. Not sure what is going on. Might be something in the new webSockets API. Or it could be in my code. Pressing REFRESH also seems to bring it back to life.

I'll need to do some more investigation...

1 Like

I think its because it doesn't reconnect the websocket after the reboot.

Clicking refresh will send a websocket command which should fail because its not connected, however should be caught by the websocketstatus and issue the reconnect command which calls initialize and it kicks back in.

One thing you can do is create a smart app that manages the devices and subscribes to the hub reboot event. Then after any reboot it can kick off a reconnect and refresh to update any switches for scene's that may be out of sync.

Its more complicated but I only think you can subscribe to that event in the app. I don't think there is any way to issue a command after a reboot with a driver.

You can also add it to a rule that maybe calls refresh on it every x minutes. This way it will eventually kick back in.

I could be wrong, but this is what I could see by scanning through the code.

I think you're correct as well. Since this issue would plague any device driver that uses webSockets, it probably makes sense to have @chuck.schwer take a look at the new webSockets API to see if there is a race condition or something happening during startup of the hub.

I just updated my DEV hub to 2.0.3.114 and had to click SAVE on the Parent Device as well to restore the webSocket connection. Earlier, during my testing, the driver's Refresh call used to perform the same action as saving the device. I think I changed it in the last release to try to clean up the code a little.

1 Like

This issue actually plagues any driver that does some kind of function that kicked off when its installed. I think it was telnet I was playing with that I also saw this. I get around it by creating parent apps to manage them.

You could also create a schedule to run a connect method every X minutes. If its already connected it will just close the connection and create a new one. But at least after a reboot it will eventually reconnect and continue functioning. I don't know if there is a way to tell if its already connected before trying to reconnect other than sending a random message and getting an error.

Thanks Dan! Got this set up a little bit ago, everything is working great so far. Will report back if I see any issues.

Hopefully websockets will be around for awhile...although this post makes me question that :scream: I wonder what it would take to get XMPP added to Hubitat's list of capabilities.

I just ran into this as well. Refresh did not reestablish the connection. Had to hit save in the parent driver.

I will look into adding a fix to handle the hub restart issue.

The initialize method should be called on hub start assuming the driver defines the initialize capability. If that is the case and its still failing, I will take a look

1 Like

Thanks Chuck. I'll give it a shot!

1 Like

I learn something new all the time. So I just need to add 'capability "initialize"' and it will call the initialize method on reboot. Going to try that now.

1 Like

LOL - I had that in the code already, but commented it out to make the Parent UI cleaner... I am testing it now...

Update: That fixed it! Thanks @chuck.schwer for the tip! New Parent Driver code is already uploaded in GitHub.

3 Likes

I saw that. Lol.

Just tried it on my driver and it worked. Now I gotta go update some driver code with this new information.

Did a little forum searching and did find this from Mike in may though. Adding it to my notes for future reference.

1 Like

@ogiewon, unfortunately this integration was a real disappointment for me. I configured everything and tried to turn on my TV activity. My TV did not come on, all my lights flashed on and off and my Alexa TTS said "your hubitat hub has surpassed your quota of ogiewon apps and driver. Please remove at least 5 of them as soon as possible." I'm just tired of saying thank you, so I wrote the above instead. Great job..as usual..:roll_eyes:

9 Likes

DAMN! I wish you Yanks could spell properly!

I have initialise everywhere (which, of course, is the correct way to spell the word!)
Ok.. so now I have to make spelling mistakes in all my apps/drivers :slight_smile:

Andy

5 Likes

It took me years to switch from s to z, y to i, re to er and remove u's. You Brits made the Queen's English too complicated I guess.
:rofl:

2 Likes

THAT's THE POINT!!!!!!
Stop messing with 'proper' English! :slight_smile::slight_smile:

And don't get me started on Aluminium :crazy_face:

1 Like

I think you meant Aluminum :wink:

2 Likes