Node-RED nodes for hubitat

OK, I have an issue @fblackburn .

If I setup a command node for a dimmer with the default command=setLevel, default argument=49 and then send a msg.command to it overriding setLevel with "off" it will cause an error on Maker API in Hubitat.

It looks like the Node-Red command node is still sending the "49" to Maker API even though the command "off" does not use/have arguments. I can see the "49" in the chain of Maker API messages before it generates the error - so I'm 99.9% that is what is happening.

Since Maker API is not expecting arguments with an "off" command it generates an error (and the "off" doesn't work).

To work around this I can do any of the following, which is fine for now:

  1. Change the default command node to something other than setLevel that does not have arguments
  2. Delete the default argument in the node
  3. Set msg.arguments in the overriding message to a blank string

I'm just going to do #3, really easy to do since I already have a change node. No big deal.

But long term, commands that don't use arguments need to strip this out automatically to prevent errors in Maker API and ensure the command functions.

EDIT: 1 more thing. The response from that invalid command did make a trappable message, of sorts - if you had a debug node connected. This really should get logged/flagged somewhere more obvious. Without a debug node, you get no error indication in the Node-Red debug log at all. Maybe a status icon on the node with a red square, a debug warn/error message, something. Just food for thought!

image

You're right, I will try to fix these two things Done for the next release.

But the biggest question remains ... Why setting setLevel to 49 instead 50!!!! :laughing:

4 Likes

LOL, good question!!! Interestingly, I did that while testing and forgot to change it back to 50. Glad I did, because in this specific case it made it really easy to find the issue. Purely accidental.

1 Like

Awesome, thanks. I'm popping over to Jamaica for the week, so will test when I get back. :+1:

Installed 0.0.23. All went smoothly.
I now have converted all RM rules to NR. Rule Machine has been removed from both Hubitat hubs.

3 Likes

Hi All,

I've upgraded to ver 0.0.23 and starting to get this when deploying
image

any idea what this is from? thanks

Not sure what version you upgraded from, and maybe it doesn't matter.

I would think going into the hubitat config and setting the webhook address would resolve it, though.

I upgraded from 0.0.22.

I went back in and edited hubitat, now there's a button "configure webhook" that I never noticed.
clicked on it, got a tick, click on deploy, it doesn't come up anymore.

so I guess maybe that's it? :man_shrugging:

Yep! It's about a default compatibility migration when you did not set the webhookPath. To avoid breaking all config nodes and force people to resave the form, then we simply add a default value with a notice
If you resave your config node, then it disappear :slight_smile:

2 Likes

Can anyone please share a dimming over time sequence?

Many thanks!

I don't have one of those, but that's an interesting question.

Maybe this? I haven't actually tried it.

Just checking to see if you have tried adding the optional "duration secs" argument to the setLevel command? For example, I use a command node argument property 75,15 to dim the lamp to 75% over 15 seconds.

1 Like

No, I haven't. Thanks for the heads up!!

Good point. No reason that shouldn't work.

I just explored the node-red-dashboard and it's really impressive how it's simple :astonished:

Screenshot from 2020-03-07 21-14-30

Screenshot from 2020-03-08 10-46-32

Oh and by the way, the version 0.0.24 is released with fixes for @JasonJoel (see changelog) :slight_smile:

4 Likes

I don't know if this is possible, but I have two requests:

  1. Could you post the flow that you used for the dashboard example that you've shown?

  2. THere's optional add-on the setLevel command which lets you dim over time. Is is possible to add the same option to the setColorTemperature choice?

Many thanks!

Here's the flow [ { "id": "adb92998.dcbfd", "type": "ui_chart", "z": "aaeb6413.0533e", "name": "", "group": "f6653b0e.ec5b28", "order": 1, "width": 0, "height": 0, "label": "Temperature", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "Waiting for data...", "dot": true, "ymin": "", "ymax": "", "removeOlder": 1, "removeOlderPoints": "", "removeOlderUnit": "86400", "cutout": 0, "useOneColor": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "useOldStyle": false, "outputs": 1, "x": 711, "y": 689, "wires": [ [] ] }, { "id": "8094d398.cde2f", "type": "hubitat device", "z": "aaeb6413.0533e", "name": "Bathroom", "server": "926d3261.73326", "deviceId": "1001", "attribute": "temperature", "sendEvent": true, "x": 340, "y": 660, "wires": [ [ "7232c4b2.4e3d5c" ] ] }, { "id": "9d6a65e.7a60c98", "type": "hubitat device", "z": "aaeb6413.0533e", "name": "Living Room", "server": "926d3261.73326", "deviceId": "1000", "attribute": "temperature", "sendEvent": true, "x": 350, "y": 720, "wires": [ [ "76b82c49.ffad8c" ] ] }, { "id": "7232c4b2.4e3d5c", "type": "change", "z": "aaeb6413.0533e", "name": "unwrap payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.value", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 520, "y": 660, "wires": [ [ "adb92998.dcbfd" ] ] }, { "id": "76b82c49.ffad8c", "type": "change", "z": "aaeb6413.0533e", "name": "unwrap payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.value", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 520, "y": 720, "wires": [ [ "adb92998.dcbfd" ] ] }, { "id": "baea619f.b275a8", "type": "inject", "z": "aaeb6413.0533e", "name": "reset", "topic": "Button", "payload": "[]", "payloadType": "json", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 550, "y": 600, "wires": [ [ "adb92998.dcbfd" ] ] }, { "id": "100162cb.b353fd", "type": "inject", "z": "aaeb6413.0533e", "name": "Inject values", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 164, "y": 688, "wires": [ [ "9d6a65e.7a60c98", "8094d398.cde2f" ] ] }, { "id": "f6653b0e.ec5b28", "type": "ui_group", "z": "", "name": "Default", "tab": "d49bef78.03b87", "disp": true, "width": "12", "collapse": false }, { "id": "d49bef78.03b87", "type": "ui_tab", "z": "", "name": "Home", "icon": "dashboard", "disabled": false, "hidden": false } ]

Node-RED only proxy what Maker API return and Maker API only proxy what the driver allow to do. So if you want this, I think you must modify the driver :confused:

2 Likes

Right. In the Hubitat driver model only setLevel has a duration argument.

So if you want to change color over time you will need to do it on the node-red side, and send saturation and hue commands on a repeated basis.

Frustratingly you can't use setColor, as there is an issue on the Hubitat side where it doesn't convert the string passed to it into a map. So, separate hue and saturation commands are needed.

1 Like

How do I get the device name to save in a Global variable? I would like to know which of these devices changed to "open".
image
I tried:
image
but that didn't return anything.

Using this, it does what I want, but it's a lot of complication I'd like to avoid:
image