New Hubitat to InfluxDB Bridge via MakerAPI+Node [beta]

Thanks. I’ve resorted to using the influxdb logger app for now until.

Also, are the latest files up on your GitHub for me to pull down manually without having to run npm i? In looking at the js files the documented version in them is 0.1.7 but I know you’re on 0.1.9 currently. Thank you.

Pushed latest to github.

Looks like we're getting bad json from the hubitat. If you uncomment line 47 we can see what's being sent. Perhaps a " isn't being escaped? Any odd characters in device names?

Right answer is to catch json parse errors and just print the bad json out. :confused:

I created this, haven't tested it though. This will stop it from crashing, and print out the error. Makes it more robust all around.

But haven't run it yet. :smiley:

I’ll test it shortly. As far as device names, I only have one device added in makerapi for testing and it has no special characters.

No Bueno...

home evt_uniq_string 1927-windSpeed

home data: windSpeed,deviceId=1927,deviceName=Weatherflow\ -\ Tempest,hubName=home,hubId=null,locationId=null,locationName=null,repeat=true,unit=mph value=4.0

2 1600878710829

home evt_uniq_string 1927-TimestampString

home handleEvent(): Found a string value that's not explicitly handled: Device Name: ${deviceName}, Event Name: ${evt.name}, Value: ${evt.value} warn

home data: TimestampString,deviceId=1927,deviceName=Weatherflow\ -\ Tempest,hubName=home,hubId=null,locationId=null,locationName=null,repeat=true,unit=Wed Sep

value="23" 1600878710829

home evt_uniq_string 1927-WindDirectionString

home handleEvent(): Found a string value that's not explicitly handled: Device Name: ${deviceName}, Event Name: ${evt.name}, Value: ${evt.value} warn

home data: WindDirectionString,deviceId=1927,deviceName=Weatherflow\ -\ Tempest,hubName=home,hubId=null,locationId=null,locationName=null,repeat=true value=WN

W 1600878710830

home evt_uniq_string 1927-windDirection

home data: windDirection,deviceId=1927,deviceName=Weatherflow\ -\ Tempest,hubName=home,hubId=null,locationId=null,locationName=null,repeat=true,unit=� value=2

82 1600878710830

home evt_uniq_string 1927-humidity
home data: humidity,deviceId=1927,deviceName=Weatherflow\ -\ Tempest,hubName=home,hubId=null,locationId=null,locationName=null,repeat=true,unit=% value=50 160
0878710830
undefined:1

SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at IncomingMessage. (/root/.hubitat-maker-to-influxdb/app.js:48:37)
at IncomingMessage.emit (events.js:314:20)
at endReadableNT (_stream_readable.js:1244:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)

It's weird, I've got this running in a node container in container station in QNAP and it's like whenever I focus away from container station or the console on the container is when the crash happens.

What version of Node is this compatible with? I'm running 14.8.0 with this, but I can drop it down to version 8.x or whatever if necessary.

@inetjnky I'm running v10, that shouldn't be it...the error looks pretty normal, and not a node change.

The last logs don't look like the codes been updated. The try/catch pushed the JSON.parse() to line 49. Yet the error indicates line 48.

The app.js file is def updated according to your change you requested. I'm showing line 48 is the correct line.

@inetjnky thanks for the code snippet, comment out line 48, it's supposed to be this:

No sense calling JSON.parse() outside the try! :slight_smile:

I commented out line 56 after seeing it wasn't in your code snippet and it's not crashing but I'm seeing this:

I get that home failed to parse json from hubitat everytime I leave container station or the console view of the particular container.

Thanks for trying to help @asj however I've setup Node-Red and have setup my influxdb through Node-Red. Appreciate your assistance though but Node-Red is working much better for my scenario.

@inetjnky - did you follow a particular guide to get node-red influx db logging? I might want to try this myself.

Hello

I can't get this to work. Can some one help me?

image

Sorry I missed this question. Not sure if you ever got it to work but I followed the “Hubitat > Nodered > MySQL > Grafana (long read)” thread.

I am not trying to get everything to work with nodered. I was trying to use Influxdb Bridge via MakerAPI + node to work.

On Pi I have installed following:
Influxdb, works , edited the config, shold be ok
Grafana, works
node version 12.20
npm 6.14.8
Installed hubitat-amker-to-influxdb (edited the config should bee ok)

On Hubitat
installed maker API

I don't konw what I am missing.

I have tryed to run the hubitat-maker-to-influxdb with PM2 and tryed with sudo node app.js
But It dosen't work. I am not so used to using PI and maybe I have missed something.

Or maybe better to try with nodered....

This has been working great for me. I ran into something that isn't really an issue (it resolved itself), but I wanted to know what happened anyway.

I got these nifty barcode looking events. My thinking is this was caused when I removed and re-paired these sensors for reasons unrelated. I joined them using the same name.

Given this:

Could this be the status of the previously joined device's last value (in this case, a device with the same name)?

EDIT: just noticed the spacing of the events, the cycle repeated every 30 minutes. I'm pretty sure this is what happened.

I've had this working well for some time. Will try and take a look in the next couple of days and see if I can see anything that is different in my setup. If I forget (highly likely :slightly_smiling_face: ), feel free to remind me.