Sense API for NodeJS

I finally got around to publishing my own unofficial Sense API implementation with Node. I forked it from another great repo and made some changes so the real-time websocket calls avoid rate-limiting.

I’m currently using this to send data to SmartThings, which opens up tons of options and logic rules based on current usage and things turning on and off.

Feel free to try it out and post some feedback or changes.


What does one need to use this API? Can it be done from the phone? Or need a PC? Can it be done from the SmartThings phone or web app? Or does it need a compiler, and if so which one?

Thanks in advance for any details you can provide.

If you’re talking about the SmartThings implementation in particular, follow the directions here. You can run the Node server piece on a PC, although there are quite a few other machines you can run it on - mine actually runs on a raspberry pi. Once you have the Node server running, it will pull your Sense data and feed it your SmartThings hub to create associated devices. The setup is not as user-friendly as I would like for people who are not familiar with Node, but it does work, and I’m glad to try and help walk you through it.

The SmartThings implementation’s node server code makes use of the sense-energy-node library I linked above. In general, that library doesn’t do much on its own - it’s really just some javascript code that makes writing other code easier. It contains methods to get Sense data in a fairly easy way. I published it separately in case other people would like to come up with other non-SmartThings ways to get to the data and consume it.

1 Like

Where is it “pulling” the data from? the sense hardware on the LAN or from the sense website?

oh just looked at your code, looks like sense does have an API…
interesting… maybe I will hang around a little longer lol…

1 Like

Yep, it’s pulling from Sense servers. It has a REST API for some stuff, but the real gold mine uses a websocket, which is a little more complicated to deal with.