Node-RED nodes for hubitat

i'm looking for ideas to over ride flows, and stop sensors activating when they normally should.
The other day, wife was not well and laying in bed, but the sensors kept activating lights as they should based on mode. I have a quiet time mode, which stops this, but it only activates when either phone is plugged in.. in this case she was using her phone, so not practical to keep it plugged in

Whats a simple way to turn on/off motion flows?
I was thinking a button or alexa, but for the life of me, cant seem to integrate it
So after some ideas???

image
image

[{"id":"e97f0af0.eb9f38","type":"ui_switch","z":"2c24df2e.52fee","name":"","label":"Disable Kitchen Lighting","tooltip":"On to disable office lighting","group":"af2fb25.7064a5","order":3,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":1390,"y":1480,"wires":[["1894d726.f0e9e9"]]},{"id":"62ef2763.251908","type":"change","z":"2c24df2e.52fee","name":"Enable lights","rules":[{"t":"set","p":"master_kitchen_lights","pt":"flow","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1750,"y":1500,"wires":[[]]},{"id":"1894d726.f0e9e9","type":"switch","z":"2c24df2e.52fee","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1590,"y":1480,"wires":[["e25fb330.669ce"],["62ef2763.251908"]]},{"id":"e25fb330.669ce","type":"change","z":"2c24df2e.52fee","name":"Disable lights","rules":[{"t":"set","p":"master_kitchen_lights","pt":"flow","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1751.0000267028809,"y":1467.0000247955322,"wires":[[]]},{"id":"af2fb25.7064a5","type":"ui_group","z":"","name":"House Control","tab":"b90217d9.bf3e68","order":6,"disp":true,"width":"6","collapse":false},{"id":"b90217d9.bf3e68","type":"ui_tab","z":"","name":"Mike","icon":"dashboard","disabled":false,"hidden":false}]

And then, put a switch right before your lights that test for flow.master_kitchen_lights = off (Disable is on). I put them right before the command to turn on/off the lights, because there may be a time where you turn the lights on, and then switch the dashboard switch to disable. However, any already running timers will still turn lights off. So, do it right at the end.

image

2 Likes

Just use a virtual switch.

I do the following.

I have a virtual switch called pause - all and everything is built around this with the condition of it off.

As soon as I turn it on, all automation stops.

2 Likes

new version 1.1.0 :partying_face:

Changes

  • add possibility to use websocket instead webhook (description)
    85210231-2b8f1c00-b30c-11ea-8376-07b4d8373ff3
  • add missing documentation about deviceId for command node
2 Likes

Do I get rid of the maker API?

Thanks. Did you end up adding a heartbeat to it to detect loss of connection?

I've been using the test version of the websocket nodes on my dev hub for almost a week. Has been working fine.

1 Like

No Maker API still used to build dropdown on nodes configuration. But if you only use event node then yes you can probably enter a fake token/appID and it should works

1 Like

Yes, HE send heartbeat every 2 min and NR will try to reconnect if no heartbeat received after 2min10s

1 Like

cool. Thanks again.

I'll admit that I don't know why the websocket is faster than receiving events via http POST though. I believe you, I just don't understand technically why it is faster.

EDIT: I just read an article on websocket vs http. I think I get it now. (Just Google HTTP vs websocket)

1 Like

@fblackburn

One thing I will mention is that the websocket connection is very persistent / chatty if it gets disconnected.

It retries every 1s apparently forever. Here is what it looks like when the hub is unavailable (mine was locked up in this case - unrelated to your nodes).

The reconnect logic may need to slow down after a period of time.... maybe 1s for 30s, 15s for 5m, 60s after that - or something? Or maybe it is fine as-is, what do I know? :slight_smile:

I switched, and the first item on my device list keeps firing every so often even if there is no update.

When you say device list, do you mean the list of devices that shows up in the device node, the 1st device configured in maker api, other?

Just curious as I haven't seen that in my testing (yet).

Then fix your connection !!! :stuck_out_tongue_closed_eyes:
But yeah it's weird, it should be 3s not 1s. Anyways, you're right about delaying attempt to reconnect with time. I'll check that

1 Like

It is the first in both unfortunately... I added debug nodes to see if it is firing, but since I did that, it hasn't fired after 3 times in 20 minutes or so...

Touche. :slight_smile: I rebooted the hub and of course the errors went away.

3 Likes

Hmm. odd.

I didn't see any unexpected events the 6 days I ran the test version. BUT my development hub only has virtual devices and a few simple automation rules to flip states on some of them, so it isn't generating a lot of events.

Let me know if it occurs again.
Make sure that HE log doesn't show events triggered

Here you go, it is a virtual presence device using presence governor.


That's weird alright. I have multiple virtual presence devices, and am not seeing that. I wonder if something about presence governor is triggering an event, but it is getting de-duped in the hubitat event list. Just thinking out loud.

Yeah, nothing else in any logs. Right now I am going to try the old standby, REBOOT!

Reboot did not solve...