Node-RED nodes for hubitat

Need a little help. Recovering from Covid and bored as hell so decided to tackle Node red

On the right is the debug message, the specific item is action_brightness: 100

How do I insert the variable of action_brightness in the Argument field for the lamp device in right half.

I tried the payload.action_brightness but it doesn't work.

Use a change node to set the value of msg.arguments to be msg.payload.action_brightness

3 Likes

Thank you I knew it was something simple

A question, which I think will not be possible. I know a command node can retrieve the command from incoming msg, but can the device(text or devid) be set from the incoming msg ?
Thanks

I dont think so, you will probably need a large SWITCH node that can traffic cop it to the right place

Take a look at the help for the command node - you can pass a msg.deviceId to select the device you want. Unfortunately if you have multiple hubs you have to get a little fancy. Is this what you were looking for?

1 Like

Hey this is great! One little issue I ran into: I tried to use the mDNS name for my Hubitat (hubitat.local), but it didn't work until I put the IP address in there. Is that expected? Any chance of getting it to work using mDNS?

In any case, great work!

I'm not the developer but you could submit a pull request on the github site...

https://github.com/fblackburn1/node-red-contrib-hubitat/pulls

In my case I have 3 hubs on the same subnet so it's kind of pointless anyway. You could also do a dns host override on your router if it allows it..

2 Likes

What platform are you running node-red on? Does it support mDNS?

2 Likes

Excellent point!!! Coffee has definitely NOT kicked in this am. :coffee:

If running ubuntu / maybe debian with systemd you can do something like this to test..

sudo systemd-resolve --set-mdns=yes --interface={your network interface}

Note: this is only temporary, will go away on reboot. Sadly on my RPI running NR it does not work but have not really dug into why not (not a firewall issue).

edit: you could also just add the entry into your /etc/hosts file as well but that is more of a hard-coded solution...

1 Like

Thank you....

1 Like

I’m running this on Raspbian, and at least in my install, it works:

$ ping hubitat.local
PING hubitat.local (192.168.2.49) 56(84) bytes of data.
64 bytes from 192.168.2.49 (192.168.2.49): icmp_seq=1 ttl=64 time=0.770 ms
64 bytes from 192.168.2.49 (192.168.2.49): icmp_seq=2 ttl=64 time=0.752 ms

Can you specify what is not working? sending command, dropdown devices, receiving events, everything?

I use an external (local) DNS without issue for hubitat, but never tried with mDNS

If I specify the mDNS name(hubitat.local) in the Node-RED Hubitat server configuration, I get errors like "Unable to initialize device: request to http://hubitat.local/apps/api/130/devices/*?access_token=d0b1bc46-4a1a-4ba4-820f-7bbe888fdfe8 failed, reason: getaddrinfo ENOTFOUND hubitat.local". If I use the IP address, everything works fine.

For security, you probably should delete the reference to your access token (substitute it with some generic character like x)

2 Likes

yeah I would probably generate a new access token at this point.

2 Likes

Bwahahaha I'm an idiot. I'm usually very good about these things; wasn't even paying attention this time. New token it is…

2 Likes

We've ALL been there... :grimacing:

2 Likes

LOL yeah. At least it was trivial to generate a new token! Imagine if I had to re-include all my devices or something horrible like that!

2 Likes

In the early stages of my Hubitat experience I ended up messing up my configuration for various exploratory/experimental "reasons" and had to re-pair over 100 devices. As soon as that was all taken care of I accidentally did it again... :man_facepalming:

Was a sad, sad couple of days... Wife was not pleased with me or my "hobby"...

7 Likes