Node-RED nodes for hubitat

I would guess the problem is here... But I could be misunderstanding what you are trying to do. Is there even a "msg.open" in the message? Even if there is, I don't think that change node does what you think, as you would have to have a "msg.payload.msg.open" field, which I bet you don't...

image

1 Like

As @JasonJoel points out, there is nothing like "msg.open". Here's the complete message object sent by a contact sensor:

Untitled

@leeonestop

So your change node should act upon the content of "msg.payload.value" (preferably) or "msg.payload.currentValue".

But even then, if you are just trying to set the msg.payload=true, you can't do it that way. Use a switch node looking for msg.payload.value = "closed" (or whatever value you are looking for - "open" ?), then a change node to set msg.payload=true.

here is what I get? and I have try a switch with a change and it didn't work?

image

Click on the arrowhead to expand any of those out. Also (as an FYI), your debug node is set to capture "msg.payload". What I showed was the complete msg object.

I assure you a switch node into a change node works. I have dozens of them in service right now.

Did you use msg.payload .value in the switch node, or just msg.payload? Won't work with just msg.payload as that is not where the value is...

image

Also, if you ever get confused on what the path to a value is, when you expand the debug message, there is a handy "copy path" button you can use.
image

2 Likes

@leeonestop

I had sent you a sample sequence with a switch node and two change nodes a few days ago to use with SonosPollyTTS, You need to use a similar sequence here.

Regarding handling groups, I have been thinking about this as well. I think it would be straightforward enough to build some subflows that treat a group as 1 thing, but for now, I am using the HE built-in Groups and Scenes app to create the group and then exposing the group to NR via the maker app (in addition to the already exposed individual lights). This allows me to build flows that control items individually or as a group as the circumstances dictate.

2 Likes

Me too except what happens when the individual lights get turned on or off in the group? How are you defining "on" or "off" for the group?

If you set this option (either on or off)

Use group device to indicate if any members are on/off?

Then turning an individual light on or off effects the whole group and you will have trouble controlling just that one light.

IF that option is NOT set on then the group can get out of sync with the individual members. With the group saying it's on but all the members have been turned off (individually).

@JasonJoel I wasn't saying that they don't work but they are not working for me in this case and that were my confusion come in because I don't understand why? I was trying to figure out why if I inject a node with a true boolean it work but when I incorporate a switch node and a change it to true it doesn't? I must have something else wrong in the flow? Thanks for helping.

Don't know. But this works - I just tested it:

Switch node:
image

Change node:
image

If you incorporate a switch node (on msg.payload.value) and then a change node that changes msg.payload.value == open to a Boolean true, it should definitely work.

My only other suggestion is to test it 1 node at a time in the chain by putting a debug after each of them.

First:

  • make sure you are getting the event you expect from the device node

After you confirm that:

  • make sure the message is making it through the switch node. If not, your switch node parameters are wrong.

After you confirm that:

  • make sure that the result you get out of the back end of the change node is what you expect. If not, then that is the node that is wrong.

Your question made me think harder about it and decided to do some experimentation to learn what is true.

I was able to verify that you have 3 options when building a group:

  1. Ignore the offs and ons within the group
  2. Treat any 1 on within the group as the group is on
  3. Treat any 1 off within the group as group is off

I don't know that it is better than just doing it all in NR, but I think this means to use HE's Groups and Scenes, you should probably build all 3 versions of the group, expose them to NR and then use the one that is logically what you want in a given NR flow. I did confirm that sending an on or an off to any of the 3 group devices performs that action on all included devices even if they are in a misaligned state at least as long as "Enable Zigbee group messaging" and " Enable on/off optimization" are both turned on as they were for my test.

1 Like

Yep thats what I found too and thanks for engaging me in this discussion..it's helping me think things through. We are starting to get into the subtleties of the interactions between HE and NR which is useful.

I guess what I'm after is the ability to update the status of the group switch when a member light turns on or off without impacting anything unless ALL the members are set to the same thing. This would lead to your case #1 but with extra NR sequence logic - member switch 1 turns on - if all other members are on then set group status to on. If all off then set group to off. IF user turns group on or off then all members get turned on/off as expected. The trick is avoiding infinite loops - so have looked into semaphore locks or just a simple flow variable boolean for each group.

My logic was starting to get a little convoluted so thought I'd reach out to see what others are doing.

Edit: the OTHER reason this is important is because when using the HE Alexa skill the virtual bulb you create acts kind of like a #1 group.. and maybe needs to be handled as such.

1 Like

@JasonJoel I got it to work thanks to your and @aaiyar help. I had something mess up but I redid all the nodes and after looking at your examples and changing my node it work. Thanks I guess old age is catching up to me.

2 Likes

Good to hear!

I have some days where I can't get something to work after hours of trying, and then get it working in 5 minutes when coming back to it after a few days break. Go figure. But I'm getting older too. lol.

Side note from a previous post on here, happy to say my main server is now fixed, too. :slight_smile:

3 Likes

Are we able to pass status messages back to HE to show on the dashboard via NR/MQTT?

I got given an old Roomba (fully manual version where you actually have to push the giant button on the top to get it going :grinning:). Anyway I've got it working via this video here

So sending commands to the roomba is pretty straightforward.

The roomba also publishes status messages (battery level, charge/cleaning status etc) to MQTT which I can subscribe to via NR. What I'm missing is how to display these messages in a HE virtual device via maker API. Can this be done because I haven't been able to figure this out.

I don't use hubitat dashboards, so I can't help there. Maybe someone else on here does, though?