Node-Red Flow Samples/Sharing

Yes for the most part although you do have to restart the Node-RED addon a bit more than you would if it were standalone. The good news is that's easily done - settings/addons/NR/restart

1 Like

One more tip. If you're going to migrate from one system to another and that includes changing IP addresses, make sure you remember what other services may have been running on the old platform. Changing the IP of your MQTT broker without preparation WILL cause problems. :rofl:

2 Likes

Is anyone using node-red dashboards or otherwise creating interactive experiences in node-red? I would appreciate any examples or tips to get started.

I'm still new to node-red, but I have the basics of how to write a flow to execute based on events and device commands using the excellent Hubitat community integration. But I'm at a loss on interactive things. Is there a native and/or preferred way to do this in node-red?

I'd like to create panels to help automate some things and also provide more responsive dashboard control related to my Broadlink remotes integration.

Is it possible to have alexa re-activate during a flow, to listen for additional information? Or if not, is it possible to extract who is speaking from the alexa nodes? I'm trying to add some sort of authorization to certain voice requests. Ideally, I'd like "alexa, do xyx", alexa says please authorize, "auth code", alexa says ok and executes. I feel like that's not possible right now, so I think you could possibly accomplish the same if you could verify the speaker and check for that value before continuing. Any thoughts or ideas?

I am using Node-RED Dashboards to display data. I don't use them to control any devices (I use HomeKit for that). NR Dashboards are not the most intuitive things out there but once you get the hang of it, it gets easier.

Here are a few examples of what my Dashboards look like:

I log all "events" in a database and can sort them, select specific date, device or event type

This information is captured using @thebearmay 's Hub Information Driver and also stored. Graphs are generated using the dashboard chart node.

Another example, not HE related is for my Tesla Powerwall. The combo chart uses a Chart.js plugin and is displayed in a template node (since the native chart node cannot do combo charts).

Hope this helps. Give me a shout if you want additional details.

2 Likes

This is great. Any tips on getting started?

Do you put nodes into your flow that "feed" the dashboard indicators somehow, or else how do you connect them to data sources? How do you actually launch the dashboard? If you can't tell, I dipped in a toe but that's about it.

See the flow below - the standard NR nodes are used to get data and then the ui_nodes are used to display the data.

I thought I had posted my solution for saving and displaying the events but I can't find it here now.

EDIT: Here is one of the solutions that I had posted.

The dashboard is at the same IP address that you use for creating your flows except it as a /ui at the end of the url (IP:1880/ui)

There are a few YouTube videos on getting started with the dashboard. Here is one that I used in the beginning

5 Likes

Yep, same with the data monitoring only!

The Grafana graphs are an iframe within an NR dash.

3 Likes

Have you installed the node-red-contrib-alexa-remote2-applestrudel pallet. The data that comes out of the Alexa Event node might contain that information but it's not clear which value it is. In a quick review of all of the values, I am not sure. I am the only one home right now so I can't compare results when I ask Alexa who I am vs my wife doing the same.

I have a "quick" dashboard I use.. still needs some work tho as I'm more of an automation type guy.. Also has some other tabs like battery reporting etc.

2 Likes

Thanks again for the tips. Having some fun getting this up and running this morning (disclaimer: little bit of mspaint re-arranging just so the screenshots aren't so huge).

This is what control looks like. It's pretty quick and easy to edit, though I'm sure some of the logic will get more complicated as I get more into it.

Is there any way to control the ordering and layout on the ui panel?

image

1 Like

Yes. For example:


1 Like

Ah, thank you. I hadn't discovered the layout pane on the right-hand side. I was just getting "lucky" with the nodes I had dropped on the main sequence editing area. :wink:

1 Like

Sorry - I should have stated that. I made the assumption you knew - my bad!

I wouldn't have known to look if you hadn't said it was possible, so you got me in the ballpark and "taught me to fish". Thanks again.

1 Like

The other "trick" that I use is I put different sections of a dashboard tab in groups and give the group a fixed width. Then they don't move around too much if you resize your browser page (just my preference). I also set my ui_nodes to a "fixed" width

2 Likes

I learned a lot today, thanks again for the tips, @aaiyar and @rakeshg .

I am actually trying to do something more specific than this, but here's the proof of concept that I worked up. It's a generic switch, where there's a dropdown populated with devices of capability.switch. There's a single toggle that acts on whichever you select.

I have been struggling with making some of my logic in node-red dynamic with respect to Hubitat devices, because knowing the deviceId (DNI) is sort of cumbersome. This gets me past that, plus looks good on a dashboard, to boot.

I'd appreciate any tips if I'm doing brute force things that have a more elegant/cleaner way.

2 Likes

Don't see much that can/should change. One possible thing is that instead of a switch node (switch), use a change node to set msg.command to msg.payload coming from the ui_switch node. I think the ui_switch has "on"/"off" states only, so should match msg.command attributes.

The other thing is that you could possibly load the devices/all at NR startup (unless there is a need to populate it repeatedly) and/or if you see a hubStartup event. The use the ui_control node ( on the flow - connect event only) to populate msg.options and the device selection node.

Many ways to skin the cat! Have fun...

2 Likes

Thanks for the tips!

The value from the UI switch is true/false. I didn't see a shorter way to get that to on/off than the change node. Is there one?

You read my mind on refreshing devices. I did it that way so that anything new I added on the HE side would be populated. Unless the event of adding a device would be injected by any of the HE nodes (to cause the logic after it to flow), but I wasn't sure on that one.

2 Likes

I think that value can be on/off. For example, in this sequence:

Screen Shot 2022-08-14 at 11.22.06 AM

The switch node is configured as:

and the change node is configured as:

3 Likes