Node-RED nodes for hubitat

Hi All, hope you all are keeping safe!
Slightly off topic, but I'm just wondering if anyone here has got blink security cameras and got it working with node-red? Thanks

I also use openvpnAS on docker form..been using it for the last 5 years...flawless. I tried various different VPNs in between, but kept going back to this as it's free and it's suffice for what I need.

re: backing up your flows

Just finished reading through the duration of this thread. I saw this question asked a few times, perhaps before this feature was made available by Node Red: How do you go about backing up your flows?

For anyone with git/github experience, this feature has allowed me to track my changes and back up my flows via git: Projects : Node-RED The only caveat is that it's not automatic. You have to click a few buttons and add a message to make it commit and push your config up to the cloud. Still, better to me than needing to run a backup script.

If it is going to be a manual process anyway, I think just exporting them from the GUI is just as easy. But options are good!

re: math

Perhaps I'm a little slower on this than most, but I did all sorts of contraptions in node red before I realized you could do basic math with the default palette's Change node:

I'd previously broken this out with a third party Calc node but was frustrated that it didn't accept decimal/float numbers! Even before that I'd just used a plain javascript function node to write it out.

This is how we learn, but I stared at the ominous J: for a week before realizing it was the answer to a bunch of my pain in my flows.

6 Likes

I do lots of math in expressions (usually in change nodes). Super handy!

Yeah the JSONATA stuff... kinda weirded me out too in an XQUERY kinda way...

2 Likes

Is there a way to pause something from happening until what is happening stops?
I'm still working on this radio flow and I've gotten closer to a solution. I'll try to explain:

light sensor detects the dot light up and remains lit until the dot goes silent with a countdown timer on it, it will carry over into the activity changing to music, but still counts down and turns the led's off. So if I had a way to trigger a pause on audioplayer state change to pause that part until the dot goes to interrupted or stopped then resume the countdown to turning off the led's my problem will be solved. If i leave the off out of the switch, then I'm stumped on how to get the lights to turn off after the activity stops. The dot is a gen 2 and doesn't give any indication of the task being finished, which is why I'm using the light sensor. Here is my flow any ideas, input, wisdom is welcome!

Anyone know how to refresh a weather gif? I have a weather image (satellite) coming from Aussie govt. weather website. I've got it appearing on my dashboard, which is fine.

But I need it to discard the image and refresh it every 5 minutes. How would I do that? This is the flow that grabs the image, and displays on dash. If I inject, it doesnt seem to refresh - just keeps old image.

Also, you could help yourself to some good weather if you helped an Aussie with blue skies and no clouds for weeks. See, I would like to know when the clouds arrive!

Summary

[{"id":"9c10b145.4e05c","type":"function","z":"d05dc217.e017e","name":"Grab image","func":"msg.payload = 'http://www.bom.gov.au/radar/IDR713.gif';\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":1940,"wires":[["c3c2daa2.b6ca78"]]},{"id":"c9167eda.9e762","type":"inject","z":"d05dc217.e017e","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":1940,"wires":[["9c10b145.4e05c"]]},{"id":"c3c2daa2.b6ca78","type":"ui_template","z":"d05dc217.e017e","group":"9e1fdf14.6bb5e","name":"Weather","order":4,"width":"0","height":"0","format":"

Status: <img width="524" height="564" src= {{msg.payload}} alt='Image not found' />

","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":560,"y":1940,"wires":[[]]},{"id":"9e1fdf14.6bb5e","type":"ui_group","z":"","name":"Overview","tab":"98965367.6ffea","order":10,"disp":true,"width":"9","collapse":false},{"id":"98965367.6ffea","type":"ui_tab","z":"","name":"Mike","icon":"dashboard","disabled":false,"hidden":false}]

Since i'm redoing my flows, (had to remove NR and forgot to take backup of flows :hot_face:)
I thought i would do away with the global variables.
You mentioned that i could put a mode node between my sensor and mode switch, (Flow A)
But i could only get it to work by putting it after the active/inactive switch node (Flow B)
Just wondering if its something i'm missing in Flow A


Cheers!

In flow A, the msg.payload.value of the motion sensor gets overwritten by the mode node.

@bdydrp

In sequence B, how do the lights ever turn off? As I interpret your sequence, motion inactive doesn't send a signal to the stop timer to get it running again.

Even tho send events is unticked for mode?

Haha... True, just forgot add the line before taking screenshot

Yes.

Thanks.

Yes. Clearing the send events box only keeps if from triggering due to a mode change. The node still reports the current state, it just doesn't trigger an action.

1 Like

Maybe one thing you could do is have a bogus parameter on the end of your src url.. something like this in your "Grab Image" function node...

msg.payload = 'http://www.bom.gov.au/radar/IDR713.gif?date=' + (new Date()).toISOString();
return msg;

Then for each injection it will be a unique call..

2 Likes

Thanks. This worked. I have all my blue sky without a cloud for miles showing in my dashboard now (and updated). Nice one. May you get some blue skies your way.

1 Like

This is my fortnightly public service announcement that y'all should get on board with the Sonos palette, and putting playlists on your dashboard. I've got White Noise (rain and flowing river noise), Fleetwood Mac (yeah baby!). I've got a +5/-5% volume, skip song and toggle on/off.

image

The party time switches allow me to have Sonos music follow me around the home - which is working great. It's a flow I've linked to previously about a thousand posts ago.

This flow flushes the queue, and plays a Sonos playlist called Fleetwood Mac.

Summary
[{"id":"e0b2c7f5.3185e8","type":"sonos-control-player","z":"acbd3b2b.717768","confignode":"6cadd770.784a18","name":"Sonos - Office","x":1340,"y":1680,"wires":[[]]},{"id":"3453cd7e.aeebf2","type":"change","z":"acbd3b2b.717768","name":"Play (Vol. 10)","rules":[{"t":"set","p":"payload","pt":"msg","to":"play","tot":"str"},{"t":"set","p":"volume","pt":"msg","to":"10","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":1680,"wires":[["e0b2c7f5.3185e8"]]},{"id":"f07ba8b3.e86478","type":"ui_template","z":"acbd3b2b.717768","group":"2f9ab0f9.45393","name":"[Dash] Fleetwood Mac","order":10,"width":"2","height":"2","format":"\n<md-button class=\"vibrate filled touched smallfont rounded\" style=\"background-color:#1c1c1a\" ng-click=\"send({payload: 'Hello World'})\"> \n   Fleetwood <br> Mac\n</md-button> \n\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":380,"y":1680,"wires":[["a3a17547.00e978","60cc7a25.9a0644","ffb58e12.ee64e"]]},{"id":"a3a17547.00e978","type":"change","z":"acbd3b2b.717768","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"flush_queue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1680,"wires":[["d1105f6e.17dbc"]]},{"id":"d1105f6e.17dbc","type":"sonos-manage-queue","z":"acbd3b2b.717768","confignode":"6cadd770.784a18","name":"","x":880,"y":1680,"wires":[["3453cd7e.aeebf2"]]},{"id":"960e8250.0ff16","type":"change","z":"acbd3b2b.717768","name":"Fleetwood Mac","rules":[{"t":"set","p":"payload","pt":"msg","to":"insert_musiclibrary_playlist","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Fleetwood Mac","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1720,"wires":[["d1105f6e.17dbc"]]},{"id":"ffb58e12.ee64e","type":"delay","z":"acbd3b2b.717768","name":"","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":515,"y":1720,"wires":[["960e8250.0ff16"]],"l":false},{"id":"6cadd770.784a18","type":"sonos-config","z":"","name":"Sonos - Office","serialnum":"B8-E9-37-2F-9C-48:7","ipaddress":"192.168.1.44"},{"id":"2f9ab0f9.45393","type":"ui_group","z":"","name":"Sonos","tab":"98965367.6ffea","order":8,"disp":true,"width":"6","collapse":false},{"id":"98965367.6ffea","type":"ui_tab","z":"","name":"Mike","icon":"dashboard","disabled":false,"hidden":false}]

This flow flushes the queue, and then plays an amazon music/google play song. Get the song details from here

 [{"id":"d2efc0b1.3ae34","type":"ui_template","z":"acbd3b2b.717768","group":"2f9ab0f9.45393","name":"[Dash] White Noise","order":6,"width":2,"height":2,"format":"\n<md-button class=\"vibrate filled touched smallfont rounded\" style=\"background-color:#1c1c1a\" ng-click=\"send({payload: 'Hello World'})\"> \n   White Noise\n</md-button> \n\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":390,"y":1420,"wires":[["efdfac36.b2658","9da30fe3.8ae08","8c35b38a.edc63"]]},{"id":"9c5c2665.dddf28","type":"change","z":"acbd3b2b.717768","name":"Waves Noise","rules":[{"t":"set","p":"payload","pt":"msg","to":"insert_uri","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"x-sonosapi-hls-static:catalog%2ftracks%2fB00LAPJRYO%2f?sid=201&flags=0&sn=7","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":1560,"wires":[["4bebc932.d16058"]]},{"id":"4bebc932.d16058","type":"sonos-manage-queue","z":"acbd3b2b.717768","confignode":"6cadd770.784a18","name":"","x":840,"y":1540,"wires":[["3453cd7e.aeebf2"]]},{"id":"e0b2c7f5.3185e8","type":"sonos-control-player","z":"acbd3b2b.717768","confignode":"6cadd770.784a18","name":"Sonos - Office","x":1340,"y":1580,"wires":[[]]},{"id":"3453cd7e.aeebf2","type":"change","z":"acbd3b2b.717768","name":"Play (Vol. 10)","rules":[{"t":"set","p":"payload","pt":"msg","to":"play","tot":"str"},{"t":"set","p":"volume","pt":"msg","to":"10","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1110,"y":1580,"wires":[["e0b2c7f5.3185e8"]]},{"id":"efdfac36.b2658","type":"change","z":"acbd3b2b.717768","name":"Flush queue","rules":[{"t":"set","p":"payload","pt":"msg","to":"flush_queue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":1420,"wires":[["dde4efc7.0501b"]]},{"id":"dde4efc7.0501b","type":"sonos-manage-queue","z":"acbd3b2b.717768","confignode":"6cadd770.784a18","name":"","x":840,"y":1460,"wires":[[]]},{"id":"9da30fe3.8ae08","type":"delay","z":"acbd3b2b.717768","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":515,"y":1560,"wires":[["9c5c2665.dddf28"]],"l":false},{"id":"bffc062d.ce9e18","type":"change","z":"acbd3b2b.717768","name":"Stream Noise","rules":[{"t":"set","p":"payload","pt":"msg","to":"insert_uri","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"x-sonosapi-hls-static:catalog%2ftracks%2fB00LCTFD28%2f?sid=201&flags=0&sn=7","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1500,"wires":[["dde4efc7.0501b"]]},{"id":"8c35b38a.edc63","type":"delay","z":"acbd3b2b.717768","name":"","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":515,"y":1520,"wires":[["bffc062d.ce9e18"]],"l":false},{"id":"2f9ab0f9.45393","type":"ui_group","z":"","name":"Sonos","tab":"98965367.6ffea","order":8,"disp":true,"width":6,"collapse":false},{"id":"6cadd770.784a18","type":"sonos-config","z":"","name":"Sonos - Office","serialnum":"B8-E9-37-2F-9C-48:7","ipaddress":"192.168.1.44"},{"id":"98965367.6ffea","type":"ui_tab","z":"","name":"Mike","icon":"dashboard","disabled":false,"hidden":false}]  

The buttons I got from here. You need to put a styling button on the flow/page with a button.

3 Likes