Node-RED nodes for hubitat

Is there a method to shut down/reboot HE hubs from within Node Red. I currently do it from within my synology app, but am trying to bring all house control over to Node Red, so I know where everything is.

Use and http out node to post a command the the hub... thereโ€™s a thread from today in the forum that has the url in it

4 Likes

Here's an example for a shutdown URL in the http request node

shutdown

2 Likes

So for folks with a bunch of unused peanuts and an almond 2015 router (or hacked fake one) lying around you might actually be able to use them again - turns out the almond does websockets... so you can maybe control it and it's devices through NR..... :exploding_head: :exploding_head:

https://forum.securifi.com/index.php?topic=5696.0

edit: might be a good "shed" project or something. :grinning:

FYI, if you do have a bunch of Peanuts sitting idle and do not have a Almond Router but would like to try this suggestion, you can get the Homescreen for $15 and flash it with the Almond 2015 firmware.

Is anyone using "Match Regex" in switch nodes? I am trying to use it to take all of my MQTT messages and redirect them to the right Command Nodes to do things in one big sequence. However, I am struggling with it. Right now, I do it with 15 MQTT In Nodes.

For the first switch node, I want to send any messages starting "tele" to go one route, starting "stat" to go another, then all others to go a 3rd. I found this website, Simple RegEx Tutorial, touting itself as "Simple RegEx Tutorial" but I must be doing something wrong. After reading that site, I thought it would be as simple as "^tele" for option 1 and "^stat" for option 2. When I try this, nothing is passed thru those 2 branches of the Switch Node. What elementary mistake am I making?

I'm using it a lot. Here's an example of a node using it ....

In this case "off" goes to output-1 and anything other than "off" goes to output-2 ...

Screen Shot 2020-04-09 at 11.45.02 AM

I use this site www.regextester.com to test my expressions.

1 Like

Couldn't you just use "otherwise" for output 2?

4 Likes

@stephen_nutt

Screenshot 2020-04-09 12.57.55

[{"id":"331813e6.77062c","type":"inject","z":"b1c0e8f3.379a68","name":"Tele","topic":"","payload":"tele-front-1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":760,"wires":[["faf0c055.fc6f8"]]},{"id":"2335bc15.d28924","type":"inject","z":"b1c0e8f3.379a68","name":"Stat","topic":"","payload":"stat-back-3","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":820,"wires":[["faf0c055.fc6f8"]]},{"id":"5626aac6.ddcd54","type":"inject","z":"b1c0e8f3.379a68","name":"Other","topic":"","payload":"Some other value","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":880,"wires":[["faf0c055.fc6f8"]]},{"id":"faf0c055.fc6f8","type":"switch","z":"b1c0e8f3.379a68","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"^tele.+$","vt":"str","case":false},{"t":"regex","v":"^stat.+$","vt":"str","case":false},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":330,"y":820,"wires":[["887f51f.403ffb"],["c259b13e.9339b"],["23fb77a2.228ee8"]]},{"id":"b48e3304.87a31","type":"debug","z":"b1c0e8f3.379a68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":690,"y":840,"wires":[]},{"id":"887f51f.403ffb","type":"change","z":"b1c0e8f3.379a68","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Tele Branch","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":475,"y":800,"wires":[["b48e3304.87a31"]],"l":false},{"id":"c259b13e.9339b","type":"change","z":"b1c0e8f3.379a68","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Stat Branch","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":475,"y":840,"wires":[["b48e3304.87a31"]],"l":false},{"id":"23fb77a2.228ee8","type":"change","z":"b1c0e8f3.379a68","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Other","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":475,"y":880,"wires":[["b48e3304.87a31"]],"l":false}]

I could have - if I had known of "otherwise". Missed that completely!

1 Like

Turn on Ignore case. Tele will not match ^tele?

Yeah... what is in the screen shot is just the label, not the value....

I'm a RegEx junkie, I do something with it at least 10 times a day with Work stuff

2 Likes

Thanks it's a little clearer now. First switch node down, just a couple of more to go.

1 Like

Trivial cosmetic bug (unless it is on purpose, and a feature?) on device node.

image

A device node that updates from an unsolicited event looks like the top node in the picture. Note that the switch state is "off" (with quotation marks).

A device node that had an incoming message that triggers a node output message, looks like the bottom node. Note that the switch state is off (without quotation marks).

Both of those nodes have the same device and attribute specified.

1 Like

No distinction for numbers so I guess not a feature.. however it might be good to visually distinguish in some way so it helps troubleshoot things like you forget to uncheck "send events"...

The colored blue shape is filled in/solid if send events is checked, a hollow/unfilled shape if send events in unchecked. For the ones in my pic, send events was not checked, and thus the empty shape/donut.

1 Like

Gotcha!! I obviously rushed that post.. :grimacing:

No worries! I'm sure not everyone knows about/recognizes that the shape changes based on that setting selection! So I thought I would point it out again.

1 Like

I confirm it's only a cosmetic issue
It's a real cosmetic bug with VECTOR3 dataType :wink:
Screenshot from 2020-04-09 17-01-50
It will be fixed in the next version :+1:

:sweat: I read your post, found the bug, fix it, chat with someone, come back trying to reproduce bug ... and not able to reproduce (for almost 5-10 min) ... whoups I needed to remove the fix before :laughing:

the correct one is with quote

2 Likes

Anyone around that can answer a quick question for me?
I created a flow that turns on and off a light based on a light sensor, but I also want that light to stay on if the state of my dot is playing music or telling a story. How can i base my flow on that? The goal is to make a set of lights interact when my dot is active. It works great, but I'm not sure how to keep the light on because the light sensor will always trigger first and in most cases turn off before the dot is inactive.