Node-RED nodes for hubitat

For the record, I don't think that is the actual problem. It should cast the string to a number automatically (well, it will if at least ONE of them is a number.... if both strings it wont).

If that wasn't it, export the flow and post it here and I'll take a quick look.

Still a no go. Unless I am not using the debug node correctly, I’m not seeing anything coming from the Illuminance node.

So I see the debug from the test motion node ( Red ) and the Motion Logic node ( blue ) but never a debug message from the Illumination Node which should show something even before it reached the Illuminance switch node. The Debug for illumination is purple.

if you put an inject node straight into the illuminance node and trigger it do you get a debug message?

If you do, maybe delete the connector pin and remake it, then re-deploy. Shouldn't have to do that, but :man_shrugging:.

(would be faster to troubleshoot if you would export the node and post it here though :slight_smile: )

1 Like

Sorry. I am new to node red. Didn’t know I could do that.

2 Likes

image

image

1 Like

[
{
"id": "e70fd05e.23a3f",
"type": "tab",
"label": "Great Room",
"disabled": false,
"info": ""
},
{
"id": "9ad7035e.46aa68",
"type": "hubitat device",
"z": "e70fd05e.23a3f",
"name": "Test motion",
"server": "5c8e3c9e.30a0bc",
"deviceId": "3363",
"attribute": "",
"sendEvent": true,
"x": 129.1172332763672,
"y": 206.1728000640869,
"wires": [
[
"7755871b.1a29c8",
"3b188a09.c1208e"
]
]
},
{
"id": "7755871b.1a29c8",
"type": "debug",
"z": "e70fd05e.23a3f",
"name": "Motion Debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 280.5543212890625,
"y": 106.5767822265625,
"wires":
},
{
"id": "d4f23c00.e5bd68",
"type": "hubitat command",
"z": "e70fd05e.23a3f",
"name": "Great Room Light Off",
"server": "5c8e3c9e.30a0bc",
"deviceId": "338",
"command": "off",
"commandArgs": "",
"x": 774.9944152832031,
"y": 337.92817783355713,
"wires": [

]
},
{
"id": "7811526c.77de2c",
"type": "hubitat device",
"z": "e70fd05e.23a3f",
"name": "Illumination",
"server": "5c8e3c9e.30a0bc",
"deviceId": "3365",
"attribute": "illuminance",
"sendEvent": false,
"x": 501.5611801147461,
"y": 144.47695064544678,
"wires": [
[
"8f4f4efc.891418",
"5fe46ea4.bc47f8"
]
]
},
{
"id": "e405b923.19c8a8",
"type": "debug",
"z": "e70fd05e.23a3f",
"name": "Logic Debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 750.2336120605469,
"y": 273.18216133117676,
"wires":
},
{
"id": "8f4f4efc.891418",
"type": "debug",
"z": "e70fd05e.23a3f",
"name": "Illumination",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 755.3772735595703,
"y": 214.7102508544922,
"wires":
},
{
"id": "5fe46ea4.bc47f8",
"type": "switch",
"z": "e70fd05e.23a3f",
"name": "Illuminance",
"property": "payload.value",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60",
"vt": "num"
},
{
"t": "gte",
"v": "61",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 694.2284851074219,
"y": 89.72765827178955,
"wires": [
[
"3f7fa702.017ce8"
],
[
"8f4f4efc.891418"
]
]
},
{
"id": "3f7fa702.017ce8",
"type": "hubitat command",
"z": "e70fd05e.23a3f",
"name": "Great Room Light On",
"server": "5c8e3c9e.30a0bc",
"deviceId": "338",
"command": "on",
"commandArgs": "",
"x": 917.2186431884766,
"y": 40.16406440734863,
"wires": [

]
},
{
"id": "3b188a09.c1208e",
"type": "switch",
"z": "e70fd05e.23a3f",
"name": "Motion Logic",
"property": "payload.value",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "active",
"vt": "str"
},
{
"t": "eq",
"v": "inactive",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 401.5704803466797,
"y": 244.08739566802979,
"wires": [
[
"e405b923.19c8a8",
"7811526c.77de2c"
],
[
"d4f23c00.e5bd68",
"e405b923.19c8a8"
]
]
},
{
"id": "5c8e3c9e.30a0bc",
"type": "hubitat config",
"z": "",
"name": "Hubitat",
"usetls": false,
"host": "192.168.1.",
"port": "80",
"appId": "4444",
"nodeRedServer": "http://192.168.
:1880",
"webhookPath": "/hubitat/webhook",
"autoRefresh": true,
"useWebsocket": false
}
]

Hmm...

Nothing obviously wrong jumping out at me. Might be worth just deleting the illuminance hubitat node and switch, and run the motion switch to the ON device node, deploy, and see if it works.

If it does, then add the illuminance and illuminance switch back in. and test again.

@Keo

There is one thing I would recommend changing. I think that msg.payload.value is a string and not a number. But in the switch node called "Illuminance", you are testing for numerical values. Therefore, I would put a change node between the Illuminance node and the Illuminance switch node.

The change node should be configured as detailed below:

Untitled

One more question...

Is your status icon actually a red ring? I don't think that is a good thing. Maybe unrelated to your current question, but still...

image

1 Like

Correct. Node-red will definitely auto-cast it to a number in this case, but to be 'most correct' converting it explicitly is better. (I never do though :slight_smile: )

Yes it is. I don’t understand why because the lights do turn on and off when I don’t have an illuminance node.

Early on I had a sequence that worked erratically until I started explicitly converting a temperature value to a number. So I've tended to do it where necessary.

1 Like

So here’s the thing. It never sends debug information from the illuminance device. So it never gets to the logic node.

All I can say is that if you are getting nothing out of that illuminance device node, then something is very wrong in the flow. No idea why, and I've never had a flow act that way before.

I would try deleting the illuminance nodes, redeploy, create them over, redeploy.

1 Like

I’ve done this. I don’t suppose you have an example of a request node for Hubitat do you?

Maybe I can make a request for the data and use that value? I can’t figure out how to use that node.

Nope, I don't use the request node.

Did you ever try my other suggestion and put an inject node into the illuminance device node and see if anything comes out of it? If not, then the problem has to be on that node.

1 Like

You can use an http node to get attributes of any particular device. There are examples provided in the Maker API integration indicating how the request has to be crafted.

Parse the output of the http GET request through a JSON parser node - here's what it looks like:

The Hubitat request node provides the exact same information. All you need to do is indicate the deviceID. Something like this:

Untitled

Just thinking out load.......is it a battery device? Flat battery?

i have a fibaro motion sensor that i use lux for and have been caught out when battery was flat and my lux rules didn't work!!!

Just to add, i have lux in my flow as such
image
and my switch node:
image

1 Like

I found my issue. Apparently the docker container I was using was a few releases behind. As soon as I took the new container everything worked as expected. Sorry for the wild goose chase, and thank you for all of your help.

4 Likes

Ugh. Sorry all, it’s me again. I am trying to set the dimmer level using the Hubitat command node, but I can’t figure out how to pass the value into the command node. I’ve read the node help but I’m still not clear on how to pass the command in.

Sorry for the newb question.