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

Did you try JSON Lint to check your syntax?

It's been a time saver for me many times.

Anyone have this running on their QNAP NAS in container station? I can't seem to get this setup.

I'm just testing your version, the problem I have is than the motion sersors report incorrect state every 30 min, they are show as movement in my dashboard.

It's strange, the rest of the sensors are working fine but motion is detected as active.

I found a typo on line 30 and 34 of influxdb.js:

const boolTypes = {
acceleration: { truth: 'active', },
alarm: { thruth: 'off', }, <-- Modify to alarm: { truth: 'off', },
button: { truth: 'pushed', },
carbonMonoxide: { truth: 'detected', },
consumableStatus: { truth: 'good', },
contact: { truth: 'closted', }, <-- Modify to contact: { truth: 'closed', },

1 Like

I have it in a similar configuration on Synolosy NAS: I was not able to run the docker compose file but I get the idea from the docker compose and deployed 3 instances from the resgistry with the config described on the composer:

  • Grafana
  • influxdb
  • Node

I use container station and have the following containers working: NodeRed, Grafana, InfluxDB. I even push data to the local Qnap MariaDB too. I have had it setup long before this thread using details from this very long read:

Doh! @dragner published a fix on npm, version 0.1.8 is up. Thanks for finding that!

I have Grafana, InfluxDB, nodered, and mariadb running in container station just fine. My issue is with node. I get node installed with container station just fine and it starts with the Node command but I canā€™t figure out how to run npm to do the install here. Iā€™m thinking Iā€™ll need to install on a test pi and copy the JS file(s) into my NAS and recreate the node container to start node running the JS file.

Open container station, click into your container and you should see a terminal button. Click it and when prompted enter /bin/sh and this will present a terminal window in another browser tab. From there you can run the installation commands.

Thanks Iā€™ll give it a try. If I reboot the NAS do I have to run it each time?

No, just change the docker execution command from:
command: "node"
to
command: "node /node_modules/hubitat-maker-to-influxdb/app.js"

@asj I have been checking the code, the Binary sensors are never reported as false because they are only evaluated in truth state, that does than the sensor last values it's keep as True and the poll repeats this value every 30 min.
Should be easy to fix I can try but I'm not developer and my dev skills are mainly on python.

There is a way to add the capabilty on the code for nonTruth states to be reported as false?

@dragner What is the binary sensor? This is a list of known/official types:

https://docs.hubitat.com/index.php?title=Driver_Capability_List

I see no binary sensor, and my hubitat has no binary sensor. So what is it, and where is the code from?

So Hubitat has a semi-offical list of devices and the capabilities and events they probably should conform too. But event calls are free form and anyone can do anything they want in a driver.

Sadly influxdb wants numbers, not true/false/etc. So there's 2 solutions:

  1. Make the node app conform to every single crazy thing a dev has done. :slight_smile: It tries to get a few of the major cases, and should get more.

  2. Fix the driver to send reasonable things. If the driver never sends a false, there's a problem.

To do #1 I need the event details, what is the driver sending. Best is to get the code for the driver then we can see what the driver is doing and see if it's inherently broken/fixable/have to do 1.

Sorry for the missunderstand, my English sucks :stuck_out_tongue: what I was trying to say with the binary sensor is contact/motion/... sensors, the bolean type sensors.

What I see when I deploy the app is than motion sensors and contact sensors in influxdb are registered only with a 1 as valueBinary, doesn't matter if the value es open or close, for example:

> SELECT * FROM "contact"                                                                                                              
name: contact                                                                                                                          

time                deviceId deviceName                    hubId hubName locationId locationName repeat unit    value  valueBinary     
----                -------- ----------                    ----- ------- ---------- ------------ ------ ----    -----  -----------
1584185346129000000 481      Puerta Terraza                0     home    0          Home         true   contact open   1               
1584208535469000000 262      Puerta Principal              0     home    0          Home         false  contact open   1               
1584208540706000000 262      Puerta Principal              0     home    0          Home         false  contact closed 1               
1584208910932000000 262      Puerta Principal              0     home    0          Home         false  contact open   1               
1584208912653000000 262      Puerta Principal              0     home    0          Home         false  contact closed 1
1584365984889000000 195      Sensor de Lluvia              0     home    0          Home         true   contact open   1               
1584373346317000000 262      Puerta Principal              0     home    0          Home         true   contact closed 1               
1584374656904000000 196      Sensor Apertura Ventana Techo 0     home    0          Home         true   contact closed 1               
1584376784915000000 195      Sensor de Lluvia              0     home    0          Home         true   contact open   1               
1584384146319000000 262      Puerta Principal              0     home    0          Home         true   contact closed 1

@dragner

There, fixed it properly. Try installing 0.1.9 and it should work.

You rock man! Working perfectly:

  time                deviceId deviceName                    hubId hubName locationId locationName repeat unit    value  valueBinary            
    ----                -------- ----------                    ----- ------- ---------- ------------ ------ ----    -----  -----------
    1584443826102000000 262      Puerta Principal              0     home    0          Home         false  contact open   1                        
    1584443839719000000 262      Puerta Principal              0     home    0          Home         false  contact closed 0                        
    1584444577797000000 513      Puerta Terraza                0     home    0          Home         false  contact closed 0                        
    1584444577928000000 513      Puerta Terraza                0     home    0          Home         false  contact open   1                        
    1584444578052000000 513      Puerta Terraza                0     home    0          Home         false  contact closed 0
    1584444685346000000 289      4en1 Despacho 0     home    0          Home         false  motion active   0                                       
    1584444792071000000 289      4en1 Despacho 0     home    0          Home         false  motion inactive 1                                       
    1584444795618000000 289      4en1 Despacho 0     home    0          Home         false  motion active   0                                       
    1584444806471000000 263      6en1 Comedor  0     home    0          Home         false  motion active   0                                       
    1584444867453000000 263      6en1 Comedor  0     home    0          Home         false  motion inactive 1

Set this up in an afternoon, very quickly started to see my temperature and humidity readings come through on grafana dashboard on my new Pi. Nice work @asj. Only major sticking point was to work out how to pick out the device name using a $tag in the alias by section, possibly covered in a previous post on this topic.

Simon

Yay! glad you got it working :slight_smile:

Thanks @asj.

One question, for you or anyone else who may know... What's the best way to setup a variable on a Grafana dashboard to allow a user to select one or more sensors?

I do know this can be done on an individual chart in the legend, but wanted to learn a bit more about the variables feature. Trying to achieve this lead to me trying to get Tag Values for the deviceName tag on the temperature measurement in InfluxDB, which does not return when I try to show tag values in the influx CLI. I can see this is a tag "column", but cannot return a distinct list of values. Any advice?

Thanks,
Simon

Hereā€™s a good video to help get you started.

1 Like