SOLVED: Pulling my hair out over getting Node-RED integration working (AKA: Mode not initializing because the mode needed to be set in the Hubitat dashboard first)

So, I'm new to Node-Red and Hubitat but I have a fair understanding of tech stuff like this. Problem is I cannot get Node-Red to play nice with Hubitat. I used the following video tutorial to set up Node-Red:

http://homebridge.hubitatcommunity.com/Hubitat_Node-Red/index.htm

When I set up the mode to test the connection to Habitat, I get successfully deployed. But instead of the mode returning a value of "day" (or whatever the mode is) I get "uninitialized" instead. When I check the debug log I get "Unable to initialize mode: Cannot read properties of undefined (reading 'name')".

If it's helpful, I've tried this on two different macs with the same exact result. I've updated everything to the latest versions and I've got the green tick in Node-RED on when I configure the webhook.

Any help or suggestions would be much appreciated.

Is Node Red working to control other devices and just not returning a value for Mode? Please share a screenshot of your Maker API config for Node Red and also the Hubitat Config Node in Node Red. Be sure to hide your access token when sharing.

2 Likes

Strange - I am getting the same thing and I know that my HE/Node-RED config is correct (ALL my automations are in NR). I don't use any "modes" in HE, so had never tried this before.

EDIT: I switched my config (I have 2 configs) and now it is working, so there must be something in your HE configuration

Screen Shot 2022-03-22 at 7.05.10 AM

This old post may be helpful:

I'll apologize in advance for the crap ton of screen grabs. I figured more info was better than less.






It doesn't seem to be able to control other devices but it will report their current state. However, when the state changes it doesn't update.

Your MakerAPI is configured incorrectly. 127.0.0.1 is the loopback IP address, so it cannot be the address of the computer running Node-RED.

2 Likes

Bingo. The problem is here:

2 Likes

I really appreciate everyone being so willing to help out.

I restarted everything then I made the changes and then restarted everything again. Unfortunately, I'm getting the same result.

I have my firewall disabled for now to try to make this work, so I know that's not it. Could it be the port? Or am I missing something super obvious?



Have you confirmed:

  1. The IP address of your Hubitat is 192.168.68.165?
  2. The MakerAPI application ID is 97?
  3. That there are no errors when the token was cut and pasted into the config node?

I've confirmed with my router that the Hubitat hub is at 192.168.68.165 and double checked that entry with the hub mac address.

I'm pretty confident that the application ID is 97 from this: http://192.168.68.165/apps/api/97/postURL....

And I didn't see anything to indicate any errors when I pasted the token into Node-RED. For fun, I entered the token in rather than pasting (making sure to check each character) and I still have the same result.

Also, just for test it, I connected my mac via lan cable and used the new IP that came with that connection. Still no change.

Shouldn't the port in Hubitat config be 8080 ?

Not for the standard install..

Also make sure you hit "configure webhook" and get a green checkmark.

1 Like

Did you also change the IP address in the MakerAPI configuration to point to the Mac IP address (where Node-RED is running)?

EDIT: Never mind - I think you changed it in the later screenshot

1 Like

SOLVED!

I realized I could get power levels and states of various lights and even the mode for my ring alarm. They don't update very quickly, but they do update.

So, I tinkered the the ModeAPI to to make sure there were actual modes set and that didn't seem to matter. Having said that, once I went into my dashboard and set the mode, it refreshed and tada!

Thanks so much for all the help everyone. I think I'm going to really enjoy tinkering with this project.

3 Likes

I'm sure you will - it is extremely addictive :wink: The community is great with some people with a LOT of experience.

3 Likes

I spent several hours trying to solve this bug. Then, after finding your post, I simply selected a mode on the Dashboard, and that solved it.
Thank you!

To be honest, I feel that it was a completely unnecessary and illogical problem, a real time waster.

I’m glad it was helpful. I’ve encountered so many things like this in the last three weeks that this problem seems trivial to me now. :joy: I agree, these weird problems seem so off in the weeds from what I’m actually trying to accomplish.

But for an old guy who hasn’t done any programming since the days of turbo c and ms dos, I’m holding my own. I’ve even managed to get my ring contact sensors to tell my nest thermostat what to do! And that was no easy task.

3 Likes