Node-RED nodes for hubitat

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

You should try using msg.topic.

Edit: Yup, that'll work ....

Screen Shot 2020-03-08 at 10.39.10 AM

Screen Shot 2020-03-08 at 10.39.23 AM

1 Like

Thanks. I knew there was a simple answer.

1 Like

I'm trying to set this up but when I toggle my test switch, nothing comes out the device node.
I also get a 404 in my NR logs

I am running NR in a container but I don't think that is the issue as I have other integration using maker api without issue.

Edit: I see @kevin posted a similar issue earlier on. I'm also running NR as a HA addon.
@kevin, did you ever get this sorted out?

Edit 2: Figured it out. Just needed to read the Addon docs in details. @kevin, fyi, all http endpoints in the addon are exposed under /endpoint. So you would need to edit the Maker Api POST url to be
http://192.168.x.x:1880/endpoint/hubitat/webhook

1 Like

@danfox52, if you want to see everything a node is outputting, you should change the debug node to show the complete message.

image

This way you get the full picture of what is going in and coming out of nodes. I always change that on every debug node I create.

2 Likes

I wish I knew how to set "default" options for some nodes. For the debug node it isn't too much work to change it from msg.payload to the complete message object.

But for other nodes - like time-based nodes, it would be nice to have latitude and longitude set globally (or even just once per flow).

1 Like

At the bottom of every flow tab, I have a bunch of "template" node and flows. Anything I create often, I leave down there and then copy and paste as needed. I call it my Junk Yard :stuck_out_tongue_winking_eye:

This is my HA occupancy lighting tab. The junkyard is pretty empty now but I had a few long node strings.

If it gets crowded down there, I try to create a subflow to handle all the logic. That's what I did in this case. All the little teal nodes with the light bulbs were a string of nodes that was slowly growing. Every time I added more complexity to my logic, I would have to edit every node in the string for each room. Gets tiresome fast so I created a subflow that I have to edit once. Here's the subflow for the "bulb" node.

3 Likes

Are you able to post a code link to the subflows? I learn by seeing how others do it.

Also, what's the best way to only send a message to HE if required, with this flow.

On another note, I cant believe how easy this was. I was attempting to use function nodes until the discussion late last week. This rule in HE was one of those rules constantly throwing up sql/db errors.

2 Likes

I could but I'm not sure how helpful it would be to you. Firstly, this is a flow for HA not HE. I'm also not even sure it will let you import it anyway. The green nodes are a personally customized version of the stoptimer node.

I'm not sure what you mean here. Are you asking how to only send an on/off command if necessary? Eg is light is already on, then don't send on command. If so, then that would probably be a better answered by @aaiyar. I think he mentioned doing this earlier in the thread.

1 Like

Yup, I did.

@mike - let me know if you want an example. Basically, I just record the on/off of every switch (msg.payload.currentValue) in a flow variable, and then turn the light on only if the flow variable is "off".

Be happy to post a flow if you'd like.

2 Likes

I read through much of this thread again, to increase my knowledge. As they say, a little knowledge is dangerous. I appreciate the help offered here by you all.

Back at release 0.0.18 it was said that currentValue was being depreciated in favor of value (although, not anytime soon). Should I begin making flows with value instead?

Yes.

2 Likes