Node-RED nodes for hubitat

In the "what I did with node-red and hubitat today" section... It is cold in San Antonio for a few days - which is rare. We get freezing temps for a few hours or a day here and there, but not 3 straight days, and we aren't insulated/prepared for that. So....

  1. Made a freeze alert using all my sensors that report temperature. The link in nodes connect to Hubitat Event nodes - I keep 1 instance of the Event node on my "global" flow for each hub and just link to them when needed. I find that it is a lot easier to just do one Event Node + a filter in a switch than it is to add a zillion device nodes.

  2. Made a quick table to let me look at the temps. Lots of ways to do this, I did it the way I know (there are others). Had to dump to a js function node for that one as I wanted to pre-sort the list. Had issues with the table updating on the dashboard, so I just threw a ui_control on there to refresh it. Might not be needed, but it worked and I was in a hurry.


    Yields this:

4 Likes

That's a great idea. We're expecting freezing temperatures here on Lundi Gras and Mardi Gras. I am going to setup freeze alerts with temperature sensors in unconditioned space!

I updated Node (using hb-service update node) on my RPi/Homebridge and when I restarted node-red, it said it was creating a new flow file. When I went to look at my flows, EVERYTHING was gone - just an empty flow file. After my initial panic, I restarted the Homebridge server and lo and behold, everything was back.

Any idea on what could have happened? I am running NR on the Homebridge pre-built image.

Why wouldn’t you run them in separate images, that way dependencies in one don’t impact the other?

1 Like

The pre-built image for Homebridge has the OS and other components (node, npm etc.) installed and has the ability to install and manage other add-ons (Node-RED). I did not start with a a clean Raspbian install.

Sorry I thought you meant docker image. My bad.

1 Like

THANK YOU!

This has been bugging me for days trying to get data into NR.
This was exactly my problem.

My internal server drives DNS for the house - but it looks like the HE is hard coded to go directly to 8.8.8.8 for the DNS server... unless you configure it for static IP, then the DNS field becomes available.

I will work on what do about that later - but importantly, now I have events piping into NR in real time (yay)!

2 Likes

Thanks very much for that. I've just updated to that version and it works perfectly.

1 Like

The color changes don't seem to stick for me.

You need to click on the circle with the colour from the palette selection for it to "take" but it's working fine for me I have 2 configuration nodes with 2 different shades of green.

1 Like

I did. My nodes change color. And then revert back to the default green.

Turned out to be a browser cache issue.

3 Likes

I am using the generic event node to capture events and log them to a database. I do see sunrise/sunset events but I don't see a systemStart event. Is it supposed to work that way? I want to trigger a notification based on systemStart - would the location node be a better resource to capture that?

Posted this up above (around 4322), but it’s a device driver that contains the hub and static location information for the hub (didn’t include sunrise/sunset, etc as they change over time). Device driver automatically refreshes at system restart (and stores the date/time of the event)...

https://raw.githubusercontent.com/thebearmay/hubitat/main/hubInfo.groovy

When do you expect to see systemSTart event? This event is only triggered when the hub start. Then to trigger it, you need to restart your hub

The event node is the best a way to catch it. About location node, you can have more info on its implementation here

Edit: oh well I see the description ... Ok then you can have this event by both nodes :stuck_out_tongue:

Thanks - I'm actually using your driver to get the firmware version and yes, it is publishing the lastUpdated and lastHubRestart events. Actually that's how I figured out that my Hub had restarted unexpectedly.

I was going to use that but I noticed that the lastHubRestart was also updated if the "initialize" button was pressed from the device page. I could work with this, but thought it was built into the event node.

One quick request on that driver - any chance you can change the date from Unix epoch to a date/time format? I tried but have no understanding of how drivers work so did not want to screw it up. :pray:t3:

What type of format would you like?

The problem is that I'm not seeing an event systemStart from the event node in my database logging tables. Could it be timing? I am going to put a debug node and try a restart tomorrow to figure out if I am somehow just missing it.

Date/time (in local time) would be perfect (e.g. 2021-02-16 18:14:49)

I can reproduce, the systemStart event is received (and cache rebuilt), but event node (or location) doesn't output anything. I'll investigate

1 Like

Should be out there now. Won’t show up until a restart (unless you manually run the Initialize which as you noted captures the initialize time as the restart time).

lastHubRestartFormatted

1 Like