Node-RED nodes for hubitat

I think it was an answer to this:

Has anyone else noticed that the new double-tap feature for pico remotes does not seem to be sent over to the device node? All other events are sent, just not double tap.

I wasn't paying attention - it just seemed to eat taps and messed up my "button tap" subflow which traps multi-tap events on Picos and other button devices by timing the presses. The legacy driver brings back the old behavior but I had switched over to something else by that time.

1 Like

:exploding_head:

I am trying to create a bar chart at the end of each day to show total usage of my AC. I am feeding this to the chart
under my msg.payload I have:
{"series":["Cooling","Fan Only","Idle","Heating"],"data":[[5],[3],[1],[0]],"labels":["date"]}

I cannot get it to graph all4 data points in a group.

Any ideas on what I have set wrong?

You'll love this... just bound your json object with "[]" so..

{"series":["Cooling","Fan Only","Idle","Heating"],"data":[[5],[3],[1],[0]],"labels":["date"]}

becomes:

[{"series":["Cooling","Fan Only","Idle","Heating"],"data":[[5],[3],[1],[0]],"labels":["date"]}]
3 Likes

Yup,
Worked!

Now how do I get it so it is additive to the data instead of replacing the data, I'm too lazy to create flow variables to hold it...

Well you could store the chart output in a GV then parse that as you go.. adding values based on searching the "series" array of the chart object and using the resulting index value to locate and grab the related "data" array value and then feed that back into the Chart Node (set msg topic to the series entry you want and payload = new value) ... probably want to use a function node for this but seems easy enough.

1 Like

Yeah, I was hoping not to do that, but...
Thanks for the confirmation!

You could create a simple msg "counter" subflow that counts messages with a given topic.. and outputs the accumulated value. You could then use that to update your chart. Note: you would have to save the counting data in a flow variable BUT it would be contained within the subflow instance.

@napalmcsr This is an example I whipped up for giggles..

theCount Example

[{"id":"16ba13235838884b","type":"subflow","name":"theCount","info":"","category":"","in":[{"x":120,"y":120,"wires":[{"id":"31a77bafcac74c41"}]}],"out":[{"x":640,"y":80,"wires":[{"id":"31a77bafcac74c41","port":0}]}],"env":[{"name":"RESET_ON_START","type":"bool","value":"true"}],"meta":{},"color":"#DDAA99","status":{"x":640,"y":160,"wires":[{"id":"31a77bafcac74c41","port":1}]}},{"id":"31a77bafcac74c41","type":"function","z":"16ba13235838884b","name":"Accumulate based on topic","func":"var topic = msg.topic\nvar resetTopic = msg.hasOwnProperty(\"resetTopic\");\nvar reset = msg.hasOwnProperty(\"reset\");\nvar ret = [];\nvar varName = \"counter\";\n\nvar addend = msg.hasOwnProperty(\"addend\") ? msg.addend : 1 ;\n\nvar cntr = flow.get(varName);\nif (cntr === undefined || reset) {\n    cntr = {};\n}\n\nif (!reset) {\n    if (cntr.hasOwnProperty(topic) && !resetTopic) {\n        cntr[topic] = cntr[topic] + addend;\n        \n    } else {\n        cntr[topic] = 1 - resetTopic;\n    }\n    msg.counter = cntr[topic];\n    \n    ret = [msg,{ \"payload\": { \"text\": topic + \": \" + cntr[topic].toString()}}];\n\n} else {\n\n    ret = [undefined,{ \"payload\":{\"text\": \"counters reset\"}}];\n    \n}\nflow.set(varName,cntr);\n\nreturn ret;","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":120,"wires":[[],[]]},{"id":"4d92c46fa340072d","type":"ui_chart","z":"655ae8d912445576","name":"","group":"9167e5082e18187e","order":0,"width":0,"height":0,"label":"Test Bar Chart","chartType":"bar","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"10","removeOlder":"36","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1000,"y":1320,"wires":[[]]},{"id":"cfdbca627b6aa7c4","type":"inject","z":"655ae8d912445576","name":"add Cooling","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Cooling","payload":"","payloadType":"date","x":250,"y":1040,"wires":[["4611159fc2c1ad17"]]},{"id":"db57fcff9ad51107","type":"inject","z":"655ae8d912445576","name":"add Fan Only","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Fan Only","payload":"","payloadType":"date","x":250,"y":1180,"wires":[["4611159fc2c1ad17"]]},{"id":"e7379017ebdf9620","type":"inject","z":"655ae8d912445576","name":"add Idle","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Idle","payload":"","payloadType":"date","x":230,"y":1220,"wires":[["4611159fc2c1ad17"]]},{"id":"5fa73cf0bee8816e","type":"inject","z":"655ae8d912445576","name":"add Heating","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Heating","payload":"","payloadType":"date","x":250,"y":1260,"wires":[["4611159fc2c1ad17"]]},{"id":"4611159fc2c1ad17","type":"subflow:16ba13235838884b","z":"655ae8d912445576","name":"","env":[{"name":"RESET_ON_START","value":"false","type":"bool"}],"x":500,"y":1180,"wires":[["0e5ca17e32e7e1b4"]]},{"id":"ee1421fb138b591f","type":"inject","z":"655ae8d912445576","name":"Reset All","props":[{"p":"reset","v":"","vt":"date"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"AnyTopic","x":240,"y":1320,"wires":[["4611159fc2c1ad17","67eb55eec5ba53aa"]]},{"id":"aba03f64cea692c1","type":"inject","z":"655ae8d912445576","name":"reset Cooling","props":[{"p":"topic","vt":"str"},{"p":"payload"},{"p":"resetTopic","v":"","vt":"date"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Cooling","payload":"","payloadType":"date","x":250,"y":1080,"wires":[["4611159fc2c1ad17"]]},{"id":"b69dd098606f0c2f","type":"inject","z":"655ae8d912445576","name":"subtract Cooling","props":[{"p":"topic","vt":"str"},{"p":"payload"},{"p":"addend","v":"-1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Cooling","payload":"","payloadType":"date","x":260,"y":1120,"wires":[["4611159fc2c1ad17"]]},{"id":"0e5ca17e32e7e1b4","type":"change","z":"655ae8d912445576","name":"set payload = counter \\n delete counter \\n set series = topic","rules":[{"t":"set","p":"payload","pt":"msg","to":"counter","tot":"msg"},{"t":"delete","p":"counter","pt":"msg"},{"t":"set","p":"series","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":1180,"wires":[["4d92c46fa340072d"]]},{"id":"67eb55eec5ba53aa","type":"change","z":"655ae8d912445576","name":"payload = []","rules":[{"t":"set","p":"payload","pt":"msg","to":"[]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":1320,"wires":[["4d92c46fa340072d"]]},{"id":"9167e5082e18187e","type":"ui_group","name":"Default","tab":"e9ca8db812d39fb7","order":1,"disp":true,"width":"12","collapse":false,"className":""},{"id":"e9ca8db812d39fb7","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

1 Like

Here is where I have gotten too :slightly_smiling_face: it mixes the data with the series

Json
{"_msgid":"b6a980d9cd86bb1c","topic":"yo4","payload":[{"data":[[[10],[9],[5],[0]],[[10],[9],[5],[0]],[[10],[9],[5],[0]],[[10],[9],[5],[0]],[[10],[9],[5],[0]],[[10],[9],[5],[0]]],"series":["Cooling","Fan Only","Idle","Heating"],"labels":["6","5","4","3","2","1"]}]}

1 Like

looks like I have to transpose my arrays...

Maybe tomorrow

Yay, got that to work, now to fix the data going in!

1 Like

If you used email notifications via Gmail, and it stopped working recently (as of June 2022), it may be because Google has turned off access via less secure apps. The solution is simple (took me about 5 minutes), and is documented in this post:

2 Likes

thanks for posting this!! Sadly I dont think I even realized.

1 Like

I just received a Third Reality Light Switch that works fine thru HE but it's status does not change in Node Red. This is the HE log:

Nothing shows in the Node Red logs when I turn switch off or on in HE. Node Red Command Node can turn on or off switch but doesn't show up in Node Red logs either. I am using the native Third Reality Switch driver.

Any suggestions?

I'm going to guess here because I'm not that well versed with Node-Red <--> Hubitat connections....
is Node-Red capturing events or logs?

In Node-Red go to the Hubitat command node and re-save the web hooks entry.

3 Likes

That did it! Thanx

1 Like