HE Logging Utility

HE support has stated that websockets are unsupported and undocumented. Use this app at your own risk!

( But, they do have a plan to make them official someday :smiley: ).

Hubitat Elevation Logging Utility has been created. This is an extendable nodejs solution that use the exposed HE websockets to capture logging/event data and write to pretty much anywhere you want. This version also has InfluxDB support (which I am still working on finalizing/fixing/enhancing).

For those of you who know nodejs, you can drop in your own data endpoints. Want to write your data to SumoLogic? Use the SumoLogic npm package (sumologic - npm), drop it into a writer and you're on your way! You can add it to package.json or install it on your server locally.

As this is relying on unsupported methods of accessing the hub, I will support this until they either remove the websockets OR make any changes to the streams. I stress again, use this at your own risk.

Any suggestions (or contributors) are greatly appreciated.

6 Likes

I’ll give this a try this weekend. Thanks!

1 Like

I have started my adventure... I currently have your logger running on a Raspberyy Pi 3B+, connected to my Development Hubitat hub. I am using the 'console writer' for right now. So far, so good. :+1:

A little feedback for the ReadMe...

It currently states to "Run node logging.js"

It should be "Run node logger.js"

Also, it wasn't clear that the brackets (i.e. [ and ] ) should be removed from the example config.json file for the IP address.

I'll keep poking at it as time permits. Looks great so far! Thank you for getting this started. I am hopeful that this solution will be less work for the Hubitat Hub with respect to InfluxDB data logging.

[Update] - looks like rebooting the Hubitat Hub causes the NodeJS app to exit. it would probably be better if it could try to reconnect every 30 to 60 seconds and resume where it left off. Or, are you wanting to rely on PM2 or FOREVER to cause the restarts to occur?

Thank you sir. I appreciate the feedback!

Oops. I kinda rushed the README. LOL I'll get that fixed up.

Yeah, that's why I made the config.json.dist. I'll work tomorrow on getting it cleaned up and more readable.

It should be as it's not polling the HE hub, it's just getting data when the hub pushes it out on the websockets. So, in theory, there's no additional overhead on the hub itself.

I use PM2 personally, but I can code in a check if the hub isn't responding and loop (maybe forever?) until the hub comes back.

I'm also working on adding timed actions. So, if you want to have a writer that polls the Maker API every 15 minutes for battery or temp info, the script will allow you to do so. It's a use case for me (as I showed in the NodeRed post).

1 Like

This looks interesting, I'm using InfluxDB for some other stuff; after reading all of the various threads here on options to push Hubitat events to it, this looks efficient. I have a few other node.js apps running in Docker, so would be easy to spin this up and try it out.

So... I was checking about any progress since the last post?

I’ve just recently started using Node-Red with a flow published in the Node-Red thread to handle my InfluxDB needs. It’s been working very well.

1 Like

Just giving this a try after reading the NodeRed post. Have been having some stability issues requiring hard power cycles to the hub and hoping to track down the issue.

Couple things to note when getting this running:

1: run node logger.js instead of node logging.js per ogiewon's comment.
2: writer/file.js:11 throws an error that dest in not defined in if(dest.debug)
-- changed this to if(writer.debug) and it works fine.
3: default config.json has several writers enabled. Since I didn't have a MySQL instance or an InfluxDB instance running, I had to set those sections to false or it would throw and error looking for them.

All in all rather intuitive and I appreciate the write-up and the effort. Enjoyed the NodeRed post and will dabble in there as I'd like to get things graphed eventually.

Now I just need to keep the hub up longer than 3-4 days at a time.

I am trying to get this up and running and I encountered this while doing npm install.

Any suggestions on how to resolve this?

Thanks