Node-RED nodes for hubitat

:rofl: You sir are going deeper down the rabbit hole. Dont get lost down there. It's bottomless.
Personally I would say move to a beefier device now if you know you are going to using NR as your primary automation driver. Eventually you are probably going to hit an I/O limit on that pizero...but be careful listening to me...I like to make folks buy more powerful toys so I can justify doing so myself (right @aaiyar :wink:)

3 Likes

Could you please PM me with this in a JSON file? For some reason when I copy and paste this, I am getting an error.

Edited post to a link on github instead of trying to embed it!

Gist to flow

1 Like

I was worried about running mine currently on a Pi 4 but if you are going ok so far on a Zero, I am feeling pretty good.

I have converted almost all of my Rules to Node Red Sequences but have kept all of my Rules paused. I just can't make myself delete the Rules because I know what would happen with the WAF if something went wrong with Node Red.

Speaking of that (while wildly knocking on wood), what are suggestions for keeping a backup of all of my Node Red flows?

On my Pi3 I use one of these and just make a copy of the memory card.

I did this same thing, it took after having them converted and running smoothly for 2 weeks before I finally deleted them 2 days ago.

1 Like

I found this last night, I did get it to work once, but I haven't had a ton of time to toy around with it other than that one time

https://flows.nodered.org/flow/bc200a0dc255b129cdca40a619a93764

@stephack you was talking about pushover how do you tell the difference between Blue and Green? for the Pushover?? Thanks

The blue one is node-red-contrib-pushover and can be installed from the Pallette. It is a custom version that I preferred when I used pushover. More flexible and allows access to more api features.

1 Like

Blue (better!)

Green

1 Like

Thanks I got it and have downloaded the correct one.

I have just been exporting all flows manually every day to Google Drive. I'll let you know in a few days how that works. I just bought a RPi4 to upgrade my RPi3. I was going to just put the old card in the new device, but I think I'll try a full fresh install and then see how well importing all the flows from a backup works.

Node-red keeps all flows in a single file. You can find the file in the folder ~/.node-red/ and it is called flows_[hostname].json and credentials are stored in flows_[hostname]_cred.json

Backing up those two files will allow you to restore your flows in no time.

1 Like

Would you mind sharing the correct procedure to restore from those files. I tried a while back and I remember following the steps I found (google) but had issues...I think they were related to the credentials file. I ended up manually exporting and reimporting my flows. Wasn't too bad but I had to also manually setup all the "configure" nodes again...not ideal. Would truly appreciate knowing your recommended process to restore.

Let me see if I can restore my file again to a different rPI. I has been a while, I try to not crash my server :slight_smile:

I think you need more than those 2 files if you want a cold restore without manually re-loading palette and settings. The package.json is very handy to have.

I did a bit of a search of the thread regarding setting the Mode on Hubitat from Node Red and it seems it currently isn't possible. But I have come up with a work round which is working well.

First in HE I created a GV with variable connector. I called it GVMode. I then have 2 rules in HE, the first updates GVMode to the current mode whenever Mode changes in HE, and the second changes the Mode in HE to the value of GVMode whenever GVMode changes. I added the GVMode connector to Maker API.

In Node Red it then works just like any other HE device. The device node gets it's current value and the command node can send a string to set it's value, which then updates the Mode in Hubitat.

In testing it works really quickly.

This here just worked for me:

Backup:

  1. Backup you credential secret, by default, it can be found in ~/.node-red/.config.json, the entry is "_credentialSecret". Here is a linux command to get that value easily
    cat ~/.node-red/.config.json | jq '._credentialSecret'
  2. Backup your flows and configrued credentials, files ~/.node-red/flows_[hostname].json and ~/.node-red/flows_[hostname]_cred.json
  3. Keep a list of plugins installed, here is a linux command that can get a list for you
    cat ~/.node-red/.config.json | jq '.[] | keys'

Restore:

  1. Install node-red
  2. Start node-red
  3. Stop node-red
  4. Edit the file ~/.node-red/.config.json and replace the "_credentialSecret" with the value backed up in step 1 above
  5. Start node-red
  6. Install 3rd party plugins collected in backup step 3 above
  7. stop node-red
  8. replace files ~/.node-red/flows_[hostname].json and ~/.node-red/flows_[hostname]_cred.json with the files backed up in step 2 above. Make sure that the file name has the correct hostname in the file name
  9. Start node-red

You should be rolling now

1 Like

No doubt that would work. But if you just backup/restore your .config.json and package.json you don't have to do half of those steps...

???

It's totally possible using an HttpRequest node

http://ip_address_of_hubitat/apps/api/maker_api_device_id/modes/mode_id?access_token=token

to get the ID for the mode you want to go into:

http://ip_address_of_hubitat/apps/api/maker_api_device_id/modes?access_token=token

1 Like