Node-RED nodes for hubitat

I can't seem to grasp what "setColor" is looking for

To set a bulb to blue, I would think the command would look like this, but it doesn't do anything (i also tried without the array brackets, so Arguments -> hue:65,saturation:100,level:100)

Screenshot 2020-03-03 10.39.41

Running three commands, one each for Hue, Saturation and Level works, but yuck.

Anyone know the syntax to make that happen in one shot?

Edit

If you want to see the communication between NR and Hubitat check out this palette

Import the flow they have posted in the " Control the logger" section and edit the "Listen For" node and put the IP to your HE in there, You can then see calls between the two to help understand what is going on

I couldn't get setColor to work at all with the command node. Tried probably 15 different formats/combinations.

In the end I ran out of time and switched to just sending separate hue and saturation commands.

The question was asked before, but never answered. Maybe it isn't possible currently, as Maker API would have to convert the string to a map internally - that can't be done external to Maker API.

Could ask support or @bravenel I guess.

This is known and is not supported via Maker API currently. I ran into this when I was doing the HS and ISY integration as well.

1 Like

LOL. I just asked you in your other thread. Sorry about asking 2x places.

I also replied there too :slight_smile:

1 Like

@fblackburn

I updated to .22 this morning and didn't have any issues with any devices I was already using, but I've just added a few more devices to Maker API and am now getting issues with the new ones. When I first select the device to add to a flow it sets up fine and gets a value (I'm using a Hue Sensor for both motion and illuminance) but it doesn't get any updates when the status of the device changes in Hubitat. I've restarted Node Red but still the same.

EDIT it seems that if I change anything in the flow and deploy, the devices will then pick up the latest status, just not as they happen.

Anything you want me to check or look at?

UPDATE Oddly after many deploys the new devices are now updating OK.

I've had this experience happen in the past. I don't know if it's the many deploys or it just takes time to settle in.

1 Like

If I was you, I'd control the Hue bulbs directly from Node Red (skipping HE as the middle man), assuming you have set the bulbs up connected to a Hue Hub. It's faster (there's no minimum 500ms delay). The polling seems to be quicker too. And you can send multiple commands in one go. See my picture.

1 Like

I actually considered that and did install that palette, the issue is that some of my rooms are slowly getting some Sengled bulbs mixed in. I can't see myself from this point forward ever buying a Hue bulb again as I'm definitely a fan of Sengled since I got into HE

1 Like

I updated to 0.22 and the same problem came up. Device nodes on my 2nd HE hub are not updating status. I've done the "move a device one square and re-deploy" and configured webhooks several times to no avail.

Did you change the webhook address (in 2nd hub node) so it's different to the first hub? Have you gone into each node and opened it, and checked the details?

Mine are hubitatmaster/webhook and hubitatclient/webhook

1 Like

Where do you come up with these values? Can you put anything as long as it is the same in HE and NR?

OK. I changed hub 2 to hubitat2/webhook in both HE and NR. Seems to work now.

2 Likes

Yeah I knew it, it was laziness :angel:
I will add it to my TODO list, I think it's not hard to do Done, it will be in the next release

It seems more and more common... I will take a look on this part of code, but if someone can found a scenario to reproduce, it will be awesome
In the meantime, the workaround is very easy :slight_smile:

1 Like

Really loving this integration. Thanks. Here is my latest.

Sonos music follows me around the house

Sonos follows me around the house. And then turns off 5 minutes after no motion. Can easily set it up, takes about 2 minutes with this flow. You need the SonosPlus nodes, from the Palette.

Instructions:

  1. You will probably want another restriction at the start. You dont want just a motion sensor triggering this off.
  2. Use the Setup flow, to determine your Sonos Master speaker name. First, configure the yellow box, selecting your Master speaker. Then deploy and inject. Determine the name of your Sonos Master Speaker, from debug logs. Use the name at point 4.
  3. Make sure in the second node (Active/Inactive) that the msg.payload.value is correct for your motion sensor(s).
  4. a) In "Active/Inactive?" node, set the name of the master speaker, from point 2. You need to set it in two locations, replacing "Office" b) Also, set the name of the Master in the "Client Leave group" node. It's the bottom of the four text boxes. Currently populated with Office).
  5. In the main flow, select the last node (colored pink), and configure it for your Client speaker.
  6. Deploy and fix your errors.
  7. Music maestro

Here is the flow (with the setup flow)

[{"id":"3658315a.a14f7e","type":"sonos-control-player","z":"bd95fd32.e7aa2","confignode":"2e14d17b.6706ee","name":"Client (Kitchen)","x":1320,"y":900,"wires":[[]]},{"id":"561ec303.87174c","type":"hubitat device","z":"bd95fd32.e7aa2","name":"MD - Kitchen 2","server":"53b6a3bd.05e6fc","deviceId":"12","attribute":"motion","sendEvent":true,"x":240,"y":900,"wires":[["12511617.551f6a"]]},{"id":"dd3dc4d4.397f48","type":"change","z":"bd95fd32.e7aa2","name":"Client leaves group","rules":[{"t":"set","p":"payload","pt":"msg","to":"leave_group","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Office","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":920,"wires":[["221cc189.9c0d5e"]]},{"id":"3b7e6361.7ec3bc","type":"stoptimer","z":"bd95fd32.e7aa2","duration":"5","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":700,"y":920,"wires":[["dd3dc4d4.397f48"],[]]},{"id":"221cc189.9c0d5e","type":"rbe","z":"bd95fd32.e7aa2","name":"RBE","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1130,"y":900,"wires":[["3658315a.a14f7e"]]},{"id":"12511617.551f6a","type":"function","z":"bd95fd32.e7aa2","name":"Active/Inactive? ","func":"switch (msg.payload.value) {\n    case \"active\":\n        msg.topic = \"Office\";\n        msg.payload = \"join_group\"\n        var newMsg = {payload:\"stop\"};\n        return [msg, newMsg]\n    case \"inactive\":\n        msg.topic = \"Office\";\n        msg.payload = 'false'\n        return [null, msg]\n}","outputs":2,"noerr":0,"x":460,"y":900,"wires":[["221cc189.9c0d5e"],["3b7e6361.7ec3bc"]]},{"id":"cb35f5f9.463df8","type":"sonos-get-status","z":"bd95fd32.e7aa2","confignode":"9fa1dde5.f2684","name":"Master (Office)","x":740,"y":980,"wires":[["460277b6.9ffa48"]]},{"id":"57c53246.43e5fc","type":"inject","z":"bd95fd32.e7aa2","name":"Determine Sonos Master Name","topic":"","payload":"get_basics","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":490,"y":980,"wires":[["cb35f5f9.463df8"]]},{"id":"460277b6.9ffa48","type":"debug","z":"bd95fd32.e7aa2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":910,"y":980,"wires":[]},{"id":"5eb0e89f.909a48","type":"comment","z":"bd95fd32.e7aa2","name":"Setup Flow ---------->","info":"","x":230,"y":980,"wires":[]},{"id":"2e14d17b.6706ee","type":"sonos-config","z":"","name":"Sonos - Kitchen","serialnum":"removed","ipaddress":"removed"},{"id":"53b6a3bd.05e6fc","type":"hubitat config","z":"","name":"Hubitat Coordinator","usetls":false,"host":"192.168.1.100","port":"80","token":"38c388e7-7b8c-436e-a6a0-6529f6b7980b","appId":"1731","nodeRedServer":"removed","webhookPath":"/hubitat/webhook"},{"id":"9fa1dde5.f2684","type":"sonos-config","z":"","name":"Sonos - Office","serialnum":"?","ipaddress":"?"}]
4 Likes

Is there a way for NR to know when it (or RPi) is restarted? The reason I want to know is when RPi restarts, all global context data is cleared. I't like to automatically reset these variables to the defaults when NR restarts

Use the Inject node. Here's my configuration to start a flow 15 seconds after NR starts:

Screen Shot 2020-03-03 at 9.53.53 PM

There's also node-red-contrib-startup-trigger.

Thanks!

With some basic benchmark (20 simultaneous requests) I got sometime an error as response. So if it happen again for some of you, then it should be interesting to look at the Hubitat's log. Here some example of errors I had:

But not every fail will generate log

Could someone please explain what the difference is between these two scripts? Particularly in reference to setting the payload to "stop".

The 1st returns "stop". (Bolding mine)
The 2nd returns "stop".
But in a timer node (that requires: stop), the second stops the node, the first does not. I'm confused. (Note, I realise they are heading out different exits, I just thought of a better way to do it. Both exits reach the countdown timer.)

image

and

image

Here are the debug logs. I delayed the 2nd, the one that works. (I even took out the topic for the 1st one (doesnt work), and it still doesnt work.

image

image