wk275 / qbTools-v2

Tooling environment for Qbus and MQTT via Nodered.
GNU General Public License v3.0
2 stars 0 forks source link

Writing Weather data to InfluxDB in NodeRed not working properly #6

Closed asulonn closed 11 months ago

asulonn commented 12 months ago

I was checking out some of the flows that were provided in the QBTools in NodeRed. Trying out the "Mqtt Weather - Homeassistant - InfluxDB example" i had some issues.

In function node "Create json objects" in subflow "MQTT InfluxDB", on line 5, It seems that inputObj = msg.payload; Should be changed to: inputObj = msg.payload.toString(); Otherwise i received errors from the code on line 17: inputObj.search(/(^\{).*/g, "$1") > -1 ) When the payload was numbers or booleans for instance.

In function node "Create measurement objects" in the same subflow on line 13, it seems that: msg.payload = { out }; Should be changed to: msg.payload = { precision: 'ms', bucket: bucket, data: out }; Only having { out } triggered errors when logging. It seems that the array of data needs to be called "data".

I was wondering: is this still something you are in progress with? (since the errors were still in there) and/or is the data you got from these weather sites/these flows reliable? I'm especially interested in the rain data (for my sprinkler system :-) ) I guess i will be finding out now they are being logged :-)

I must say it has been really interesting to look at your code! I have been learning a lot of ways to do stuff in javascript/nodeRed functions from it! Thanks a million for the effort you have been/are putting into this!

wk275 commented 12 months ago

Thank you for your appreciation. It makes it worthwhile to spend so many hours developing this environment.

I changed the code a lot in qbTools V2. The weather code was not tested at that time. Meanwhile, during the migration of my environment, I detected the error as well. The weather node has been rewritten and will now be handled by an Influx class. This code and other improvements will probably be released within a few days.

I live near Antwerp, and the weather node is 99.5% accurate for me. It works with Buienradar and Buienalarm. I operate my greenhouse windows with it. The switches are turned on when they reach the thresholds limits specified within the node, and they are propagated to a virtual QBus output. The actual moving is performed by Qbus REL08 logic

Txs for testing the code.

wk275 commented 11 months ago

Solved in qbTools v2.3.12