[OBSOLETE] Sense Energy Monitor

@brbeaird Finally getting back around to theses Sense/Smartthings SSL issues… now that I’m stuck home and unemployed.

I’m running the following versions:
{ smartthings_sensemonitor: ‘0.4.2’,
npm: ‘5.8.0’,
ares: ‘1.14.0’,
cldr: ‘34.0’,
http_parser: ‘2.8.0’,
icu: ‘63.1’,
modules: ‘64’,
napi: ‘3’,
nghttp2: ‘1.36.0’,
node: ‘10.15.2’,
openssl: ‘1.1.1b’,
tz: ‘2018e’,
unicode: ‘11.0’,
uv: ‘1.24.1’,
v8: ‘6.8.275.32-node.12’,
zlib: ‘1.2.11’ }

Debian is 10.3 (default with the current version of Raspian)
npm is still reporting that it isn’t compatible with Node v10… which is weird… updated that too.
Node is 10.15.2 (so below the version threshold suggested by @Andrew_St_Laurent1)

I’ve checked a hundred times that my clock is set right on my Pi.

And I’m still getting the following error:

27/03/2020, 12:00:10 | Error: Sense WebSocket Closed: write EPROTO 1995522064:error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature type:../ssl/t1_lib.c:1111:

I really am stuck here… Any ideas anyone?

Edited to add: I wonder if this is an issue because I’m running a v1 Smartthings Hub? In my reading, this SSL error is an issue with clients running OpenSSL 1.1.1 connecting to servers running older versions.

Hey @NorCalLights. Very sorry to hear about your job situation.

I’m wondering if it’s the newer Debian version. I may try upgrading mine when I get some time and see if I can reproduce it or at least eliminate that as a possibility.

The SmartThings Hub v1 would not affect it. That error has to do with connecting to Sense. Besides that, I also have a v1 hub that I’ve used successfully.

There definitely should be a way to get this working. I’m still just not quite sure what that is.

I saw this: https://github.com/ssllabs/ssllabs-scan/issues/740

Looks like maybe it’s a bug in Debian 10? Not sure how to resolve it at the moment.

Hey @brbeaird thanks for looking into it for me. If it’s just an issue with Debian 10, I can try installing an earlier version of Raspbian based on Debian 9 and see if that solves it!

I’ll report back. Thanks!

1 Like

@brbeaird Hey that worked!!! I loaded a version of Raspbian based on Debian 9 and everything worked great. It might be worth adding a note to the Readme that it won’t work with Debian 10.

Thanks for your help!

1 Like

Sweet!! That’s so awesome. I’ve added a note to the top of the README. Glad you confirmed it and got things working. Hopefully you have some fun with it.

Seeing some errors in the log on the node server. Any ideas?

10/30/2020, 6:45:14 AM | Refreshing monitor data, monitor data, and missed events…
(node:4830) UnhandledPromiseRejectionWarning: ReferenceError: log is not defined
at periodicRefresh (/Users/Server/Downloads/SmartThings_SenseMonitor-master/node_server/server.js:222:9)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:4830) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 76)
10/30/2020, 6:45:44 AM | Sense WebSocket Closed | Reason: Normal
ERROR: Unable to connect to SmartThings Hub: Error: connect ETIMEDOUT 10.0.1.250:39500
^C10/30/2020, 6:46:04 AM | gracefulStop:
10/30/2020, 6:46:04 AM | gracefulStopNoMsg:
graceful setting timeout for PID: 4830

Could not close connections in time, forcefully shutting down

I don’t know if it is related to your issue, but I’m getting an error in the actual Sense App " The Sense server returned an error"

1 Like

Ah it is here also (in the app)… shows how much I use the actual app! Normally it’s the numbers on an ActionTiles dash

Right I usually don’t use the Sense App either but I notice that I wasn’t getting the notifications whenever my hvac turned on anymore, so I checked the app today just to find that error message. Maybe Sense is having some issues?

I was definitely seeing a ton of errors yesterday, but they seem to have resolved. Looks like something on the Sense side. This code could for sure use some better error handling. I’ll add that at some point - most of my development here is just on hold until the new changes are a bit more firm.

1 Like

Following the guide and trying to add your repo to my IDE and I get:

×You don’t have access to brbeaird/SmartThings_SenseMonitor

Any ideas? Thanks

Have followed all the steps, but get this error in my log, and no devices get setup after configuration. The only device that shows up is the Sense Monitor itself, none of the other devices that sense has identified.

db1b596a-1b35-4e8d-b6fb-b7f9870fea53 3:35:28 PM: error AddDevice Error! physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘Sense Energy Device’ in namespace ‘brbeaird’ not found. @line 416 (doCall)

db1b596a-1b35-4e8d-b6fb-b7f9870fea53 3:35:28 PM: debug Creating NEW Sense Energy Device: Sense-Solar

db1b596a-1b35-4e8d-b6fb-b7f9870fea53 3:35:28 PM: debug name will be: Sense-Solar

Me too. For some reason, it does not enumerate the devices. However when I go to smartapp section on smartthings app, I can see those devices there. No sure why the aren’t populated in my devices tab.

+1 on this error.

That error indicates you’re missing one of the device type handlers, in particular - the Sense Energy Device handler. Can you check your IDE and make sure it’s there and published?

Digging up an old one here but I’ve found that upgrading to a 12.x or higher version of node adds the use of the --tls-min-v1.0 argument and allows it to communicate. Seems like the Sense monitor or hub isn’t TLS 1.2 and the combination of openssl 1.1.1 and node versions higher than 10.19 will default to that security level.
I’m running Ubuntu 20.04 LTS on a RPi just for the sense monitor, here are the basic steps. They can be run as a regular user with sudo most of the time but if it is dedicated to the monitor you can jump to root if you like.
I installed the Node Version Manager so I could run some tests on different versions, it isn’t necessary but it is easy:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | sudo bash
With that installed you can run nvm list-remote to show you what is out there and then install the latest version you like. I went with the current Node LTS:
sudo nvm install v14.16.0
Ran a quick verification in /SmartThings_senseMonitor/node_server:
sudo node --tls-min-v1.0 server.js
Fire tables started going crazy with devices (even though I have it turned off…) so then I added the option for pm2 to start and monitor:
sudo pm2 start server.js --node-args="–tls-min-v1.0"
That could probably be v1.1 but I don’t really care that much about internal only api access.
Hope that helps others who want to go beyond an ancient Debian install.

I am selling my Sense Monitor if anyone is interested since I will be moving. Please DM if interested.

I’ll try this. I’m running on new pi with latest stable raspian and node. Connection works fine between all systems… but Pi hangs after 15-20 minutes (consistently). Any ideas?

The Pi itself hangs or node? If it is the Pi it is usually something with the sdcard. If it is the process I would check the logs (pm2 logs) to see if there is an issue or segfault.