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

Wow, there's a lot to digest there. I might need to slow it down to try and absorb everything :slight_smile: Thanks for providing the link @Vettester.

I think I may have got side-tracked with trying to access the tags through InfluxDB, when, if I can access them in Grafana, would become a mute point, utlimately Grafana is where I want to use them.

You might might want to try just creating specific charts without using variables. I’m using average temperatures for the areas I am interested in and have found it makes a lot cleaner dashboard.

Here’s what I’m using for temperature:

Note: The flat red line at 70 degrees is an alert I have set for my main floor thermostat.

1 Like

Nice chart.

I recently started to play with averaging multiple sensors in HE to look at indoor and outdoor temperature, using @Cobra 's driver: Average All. I still need to send these through via the maker API. Even though I could do this calc in Influx / Grafana I feel the driver gives me more flexibility with HE dashboards, etc.

I also like the focus of the dashboard, I'm still toying with how best to lay mine out. Will try and post some pics in the next day or two.

1 Like

@sburke781 I use these sometimes, I use grafana in a pretty basic way, but maybe this will help for you? This adds an ah-hoc filter on any dashboard so you can have 15 sensors, then just pick 1:

https://youtu.be/EJrq4qFrdWg

1 Like

Thanks, I'll take a look and let you know how it goes.

I did end up getting a variable to work, just can't remember what source of information provided I used... I'm terrible at looping back with outcomes... :slight_smile:

I setup a variable with a comma separate list of values (would have preferred to have a dynamic list, but this was easy enough and they won't change too often):

I then added this to the WHERE clause of the two queries I have, one for Temperature and one for Humidity (only Temperature shown below).

I then added the variable as a selector in the dashboard, which filters all the charts where those queries are used:

I also posted some details of a modified version of these charts I have added to my Hubitat dashboard, details are here and here.

Thanks again for all your help,
Simon

Has any tried or been able to setup a stacked bar chart based on two separate metrics? I have read and experienced how influx db does not support unions across measurements. My only options I can see may be a continuous query (I think that's what it was called) or setting up dummy devices with the same attributes (metrics) so they appear in the same measurement "table" in influx.

The situation I have is a HE device for my Solar panels that has a number of readings, including how much energy the panels produced in total (a), how much of that production was consumed by the house (b), and how much was fed back into the grid (c). a = b + c. There is a similar situation with overall consumption, solar power consumed and power drawn from the grid.

In both cases I want to show a stacked bar showing the percentage breakup between self consumption and the grid related metric, i.e. metric b vs metric c.

Any ideas?

I keep getting an echo of the example, can you guide me what I may be doing wrong? I looked for the errant commas, couldn't find any.

What error are you getting @karnik.abhijeet?

@asj it does not throw me an error, it echos the example config.json file. Do you want to see my config file?

You don’t happen to be familiar with unraid and there docker templates?

Is the config.js.example accurate? I am having trouble getting this working.

{
local_config: {
    hostname:  "0.0.0.0",
    base_port: 8567,
    influxdb_port: 8086,
    influxdb_host: "192.168.0.100",
    influxdb_db_name: "hubitat",
    local_url: "http://192.168.0.51",
    poll_interval: 1800,
},
hubs: {
	"Production": {
		"url": "http://192.168.0.98/apps/api/3438",
		"token": "2dbe7144-ab8d-417e-86f7-90131ad6c621"
	    }
}

What’s the error or problem you’re having?

Thanks for this app.

I've been logging to Influx for over 3 years now. First from ST, then from the InfluxDB logger app in HE.

I'm not entirely sure it's related to the Influx logger app, but I've had 2-3 hub lockups in the past 5 weeks so I thought I would try this out to see if the lockups stopped.

I'm running a few other node apps, but this one has me stumped. I just get the default config.json output when I run the app.

Pretty sure my config.json spec is correct. Can anyone see what the problem is?

{
	"local_config": {
		"influxdb_port": 8086,
		"influxdb_host": "192.168.5.133",
		"influxdb_db_name": "SmartThings",
		"local_url": "http://192.168.5.225"
	},
	"hubs": {
		"home": {
			"url": "http://192.168.5.56/apps/api/737",
			"token": "57097ed7-817b-4439-ad0c-90d3b7be1c7e"
		}
	}
}

node is crashing with the following after running through and gathering data from makerapi:

home evt_uniq_string 1927-illuminance
home data: illuminance,deviceId=1927,deviceName=Weatherflow\ -\ Tempest,hubName=home,hubId=null,locationId=null,locationName=null,repeat=true,unit=lux value=0
1600838275772
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)

Any idea what would be causing this?

Oh that's odd....I'll need to look at it. It's been so long I looked at the code I can't even remember why I'm calling json parse lol.

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.