Node-RED nodes for hubitat

I wonder if that's my issue with the TMobile Hotspot... when I connect with my laptop I cannot use WG. I do have openvpn on my firewall so maybe will give that a shot too..

edit: I wonder if something like UDP2Raw or udptunnel would work...

Jsonata can do this easy. I think it would be as simple as payload.songs.id the default example on try.jsonata.org is almost exactly this.

1 Like

Woohoo the jsonata worked! Thanks!

3 Likes

Very cool!!! can you post the jsonata code?

Here you go

Next up: figuring out how to delete the dsaudio queue instead of appending. One step closer to automating my music using a Synology and Chromecast

1 Like

Embarrassed to say I did not realize JSONATA could operate across an array of objects like that.. just tested and works great - fun stuff. Thanks @durable-navy-blue-ot & @napalmcsr!!

2 Likes

Node-red: Do node

Anyone know why I am getting this error in the debug log?

"Missing meta data for returning to do-node. Flow ends here."

The flow is:

And the "do-node" config is:

I originally had the link out node on the last output of the do-node and I thought that may have been the problem, so added another task (Get Chart Data) and attached the link out to that output, but that did not get rid of the error in the debug. The flow works correctly, just logs this error in the debug pane. Thanks for your help.

I would assume the issue is the link out node. Each task needs a completion - can you add a "done" alongside the link maybe?

1 Like

Also to make things even more fun - have you seen action flows?

2 Likes

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