Node-RED nodes for hubitat

It turned out to be the "Sensor Location" drop down (ui_dropdown). It initiates an event every time I changed the selection and it was getting triggered outside of the do-node task list. I got it working correctly by moving that flow to the last output and putting the link-out at the end of that flow. I don't think the last output needs a completion, right?

1 Like

I dunno I assumed for completeness it would be a good idea.. does it ever get to the end? What if you stuck a debug node next to the "all done" node.. does it fire? If not then why not eliminate one task and put the link node at the very end?

edit: I don't think you need an "all done" node in that last position anyway.. I've never used it like that. I could be mistaken though.

Yeah - it does that but I think I have a bigger problem with the structure of the logic. There are multiple UI elements (start/end date, sensor location) that are set initially and then can be changed by the user and each time that happens, they start the flow in the middle of the do-node logic. :thinking:

Yeah that might be an issue - did you check out action flows?

Also how can the Do node complete - get to the very last connector when you have a link node right above? I can't see how that would work. Do you have a "next" node in your linked flow?

EDIT: You might look into a Finite State Machine node possibly.

1 Like

Yeah that flow will produce errors without a return node on the link out.....

2 Likes

Is there a way to set hsm status to intrusion away and intrusion home?

Here's what you get with the HE "Set HSM" node...

Sorry in rereading your post you might have to think about what you want a little differently..

Your HSM would be set to "Arm Home" or "Arm Away" etc and then the intrusion alert event would come over via the HSM node. You would then handle it via the "Set HSM" node. You would already know the state of HSM thanks to the "HSM Node"... so all the information you want seems like it is already there or did I miss something?

A thing I do is have a global "Mode" object in Node-RED which includes the current HE Mode but also other things like "Away" and "Guests" properties. I use Node-RED to change modes and sync the changes back to my HE Hubs. That way I have a separate "state" I can use to do stuff. If an HSM alert happens then that data is available.

nr372

Note: I use "timePeriod" to sync with HE. It must match the modes defined in HE.

The "subflow" node on the above right handles adding on the extra bits of info and updating the Mode global variable as well as posting a message to MQTT so I can use that as an "event" for other flows.

1 Like

This particular flow was probably not the right place for the do-node. I ended up by taking it out :frowning_face:

Not as yet. I ended up by taking the do-node out of that flow and restructuring it slightly.

1 Like

Either Action Flows or Finite State Machine - although I have no experience with the
latter. The FSM looks very interesting but melts my brain every time I start to get into it. For your case - cycling between states with user initiated events occurring at various points which can change said state sounds like a good match.

1 Like

I use finite state machine, and it's excellent. It's allows complex flows.

The top box are states, the second are triggers that change only from a state to another (only if it's defined).

3 Likes

I developed a pretty cool integration this week. We have a house rule that the kids need to put their phones in the charging cupboard when it's not screen time. Then this week I started with Home Assistant, which has an integration with Google Tracking. As a family, we already do that.

I noticed that google tracking had a phone charging status. So in Node Red, I created a rule that pings me whenever the kids phone are taken off the charger (at home). Usually within 5 minutes of them taking their phones, I'm notified, and they're confuddled at the power of Dad. They have not figured it out yet, but they're close.

5 Likes

I have roller blinds on a screened porch that I control using a Lux sensor. The flow works well. I would like a way to disable blue the flow when we are sitting on the porch. What I am thinking of is to use the switch that controls the porch lights and use a double tap to somehow disable the flow.

  1. is there a node that will disable a flow, or do I put a switch node in that is the double tap and when its on it sends the message into a non working flow?

  2. Does anyone use the sun position nodes for this type of flow?

I use a virtual switch to stop lights from turning off when we have guests at home. At the beginning of the flow that checks the status of the virtual switch. I don't know of a node that disables a flow.

The issue with a double tap and lux sensor is that your flow may be triggered again (depending on the lux reading) after you have double clicked the button and you would need to cancel the flow again. You could set a flow variable on double click and check that instead of the virtual switch like I use. The second double click could then reset the variable and your flow would execute normally.

Hope this helps.

1 Like

This is similar to what i do for my motion lighting sequences. They do not continue if the “physical switch” was used to turn the light on.

1 Like

I have a convoluted need for an Interrupt Flow and found Interrupt Flow Ultimate in that set of Nodes.

I have only used it once and thus I can't say I'm an expert but I created 'Triggers' that manage to have it work for me. I used several Change nodes to set the Payload and set a Topic.

I mentioned elsewhere that I have a Master Bath that has one set of lights and I want the lights on for one duration normally from a motion sensor and a longer duration when the shower motion occurs. However, I also use motion in the Master Bedroom to "pre-Light" the bath for 12 seconds at a very low intensity. The reason is, the dimmer and the specific LED bulbs I'm using have a long initial ramp.

So.. there's 3 motion sensors, and each causes it's own timeout but the actual timer needs to 'stick' at the longest time detected. In other words, if there's motion in the Master Bedroom the light comes on for 12 seconds at Level 9. If neither of the Master Bath motions occur, then that's it and 12 seconds it times out. If however, motion does occur in the Master Bath, then I set the lights to Level 90 for 4 minutes. If Shower motion is detected, then the timer is set to 15 minutes. But if new motion is detected in the Master Bedroom, I sure don't want the lights reset to Level 9 for 12 seconds. I have to block/interrupt that message IF the timer is already running.

2 Likes

I'm not to good on defining the nodes yet. How would I define a change node to get the bottom device to output "kWh" in the "unit" section of the device like it is in the first device?

payload.unit = "kWh";

2 Likes

1 Like