Node-RED nodes for hubitat

Now that the device name is the node's topic, is it possible to override the device in a command node like we can override the command? For example, could I set up a command node to turn on Light A but then have an inject node that overrides the device and instead turns on Light B?

This thread has been moving pretty fast so I apologize if I missed how to do it.

Global, flow, and context variables are all the same - the only difference is scope.

Can set any of them in change nodes. Can do truth logic on any of them in switch nodes.

Can use any of them in function nodes. Note that for a context variable, you can only use in the node it was defined in, so could only use a context variable in a function node that was defined in that function node.

Yeah, when you inject a value in the device node, the status disappear and only reappear if the device receive an event

I found this bug tonight too, it will be fixed in the next version :wink:

4 Likes

Technically, the topic is not the device name, but the node name
Also a device name is not unique in HE, to make a such feature you will need to pass the device ID.

Setting the deviceId as message property is easy to do (technically), but I don't think it should be implemented. Making the device field optional (to keep consistency) and allowing to choose device with the input just make the device node too generic. For this, you can directly use the HTTP request node.

I'm open to discuss about it, but you should prove me some scenarios that cannot be done in another way or without adding complexity

That makes perfect sense. So I will ask if someone has a solution to reduce the number of nodes in my Vacation Lighting sequence WITHOUT utilizing a Function Node :smiley:

The pink nodes on the left are from node-red-contrib-presence-faker. Basically, it randomly sends off & on payloads and topics based on time parameters that you set. The sequence ends by writing what device changed and when it changed to a text file. As you can see, I have 7 parallel paths so I was hoping that there was a way to consolidate somewhere after the Presense Faker nodes again without using a Function Node. If there isn't, no big deal, this seems to work just fine. It's definitely not a reason to do anything weird in your integration.

In this sequence, I was originally using HTTP Requests and a Template node to generate the URL so the Topic for each of the Presence Fakers' node is already the deviceID.

EDIT: Ok, now that I have gone back and looked at this again, I think I can lose the Change Nodes and the Device Node (blue) now that the device name is part of the payload. I created this before that was an option. Also, i forgot to mention I change your Command Nodes to Red and Device Nodes to blue to help me distiguish.

Has anyone tried the NR Dashboard? I've just loaded it and started playing around with it. Looks very promising at first glance.

My flirtation with Node Red as a bit of fun the side is in danger of turning into more...............

1 Like

Welcome to Node Red, this is exactly what happens to all of us once we get started with this....

2 Likes

How would I change (in this node) in line 7, payload to payload.value

I tried "payload.value", 'payload.value', (payload.value), and a few others. Is is possible? Trying to keep the nodes down.

Have you tried msg.payload.value ?

If you want to do it in-line like that, you have to make the payload json format too.
In your case it would be:

var newmsg2 = { "topic": "control", "payload": {"value": "inactive"}};

Or, of course, you can do it in multiple commands...

var newmsg2 = {};
newmsg2.topic = "control";
newmsg2.payload.value = "inactive";

Same end result.

1 Like

Ha, I read that the other way around :grin:

1 Like

Funny, I wasn't sure how you meant that (other way around), but now that I re-read it I see exactly what you mean. lol. English... What a language! Which then makes me think about...

1 Like

Have you looked at these?

1 Like

Have now converted every rule machine rule I had over to Node Red, except for those that use Sonos TTS, when a solution to this is found then I will be completely platform independent on the automation. My last one (thermostat scheduler) took some time as I went from this

To now this:

3 Likes

Could you share this sequence please (export and paste)? Many thanks!

New version 0.0.19

Changes

  • config node: support multi hub (big thank you to @dan.t)
  • config node: allow to customize the webhook path. This allow to:
    • distinguish endpoints when using many hubs
    • secure the path to avoid guessing attacks *
  • config node: small validation on Node-RED Server field to avoid typo with white space
  • device node: fix bug that remove the status when requesting device attribute
  • command node: fix bug when sending integer 0 as command arguments

* I will not add more effort to add security on the webhook endpoint.
I think that with SSL/TLS on your server and a custom path containing a uuid (e.i. the token), you can play with Node-RED even if it's hosted on internet.
But, I still do not recommend this setup for real usage and don't take the responsibility for doing this :slight_smile:

Ongoing

I will take the time to update my flows with the last version (still on 0.0.14 ...). I also want to have fun with NR :stuck_out_tongue_closed_eyes:
In other words: no big changes planned, only bug fixes if found

6 Likes

I assume you tried using characters other than space? Dash (minus), maybe? Just seems that there should be SOME non-pronounced character that could be substituted for spaces... But maybe not?

Not showing up in my palette - current version still 0.0.18. I'll check again later, though.

EDIT: It showed up.

I tried using periods and didn't work. I'll try others later, but I doubt it will work, hope so though.

Thanks - but unfortunately that didn't import. Could you try the text export? That worked when I sent a sequence to @mike.

No rush.