Hi everyone. I’m using one of these new Tuya presence sensors and it’s pretty good. However, I’m struggling to get the desired effect in my Node Red motion lighting routine. Maybe someone can help.
Here’s a snippet of the Node Red flow. It’s pretty standard I think.
The problem I have is this sensor (it’s at the top left of the flow, with various other PIR sensors below it that work fine) can be active but doesn’t spit that message out on a regular basis or when retriggered. It will just sit there saying active, but because it doesn’t output anything, my timer will time out and the lights go off even tho it’s still active.
Is there a better way to construct the flow to take account of this? Some way to retrigger the active status output regularly or suchlike?
I think you could add a Device Node for the Tuya Multi Sensor - Living Room sensor with Send Events turned off and a Switch node that passes "inactive" for msg.payload.value at the red arrow in your flow. Then, before turning off Living Room TV (Sony), the flow will make sure Tuya Multi Sensor - Living Room is inactive. Add an output for the Switch Node for "active" that routes back to the 3 Minute Timer so that time starts over.
I have been using NodeRed for the past few years but I am still a noob with available nodes. Being proficient in JavaScript I often jump to function nodes but trying to utilize prebuilt nodes when possible. One need now is a multi-condition node.
I use the Filter node but really dislike that I have to choose the "property" at the top and all the conditions are based on say msg.payload that I set as the property.
Is there a node that allows me to just specify multiple conditions such as:
Condition 1: msg.name contains Home
Condition 2: msg.type == Switch
etc
in a situation like this I would use an OR node from boolean logic ultimate. Otherwise if multiple motion sensors are tripped at the same time and one times out before the others, the light may go out even though one of the sensors is still active.
that is, I generally want ANY sensor to turn the lights on, but I want ALL sensors inactive to turn the lights off.
I don't know how to do contains in JSONATA, but you can definitely use JSONATA in a switch node to test if an expression evaluates as true or false. I use this all the time to evaluate multiple global variables in a single switch node.
Something like
$globalContext("light1-switch") = "on" and $globalContext("light2-switch") = "off"
This is great. I moved my Lutron integration over to HA and it was minimal effort to convert this. I've taken so much from you at this point. Thanks again!
Ok, for 2024 I figured I'd learn something new so I'm dabbling with Node Red. So far I've come up with triggering a motion detector in HE which runs a flow in HA which inturn lights a sengled color bulb back in HE. Not going to lie, kinda surreal watching this happen. My next step is changing color/intensity of the bulb. This rabbit hole seems to run pretty deep... what would be some of the more simpler ways you guys would pull this off? Thanks.
A motion detector or contact switch trigger from Hubitat will run a flow in Node Red in Home Assistant. The flow will tell Hubitiat to turn on a color bulb. Results are near instantly.
The trigger from Hubitat to Home Assistant uses Maker API Home Assistant.
From Home Assistant back to Hubitat I'm using the Home Assistant Device Bridge.
Home Assistant has the Hubitat and Node Red intergrations.
I thought this how everyone else is using Node Red with Hubitat?
Pretty much the only reason I have Home Assistant is database storage and grahping. 100% of my devices and rules are in Hubitat. This was just an exercise to see if I can pull it off getting the hubs talking to one another and experimenting with Node Red. I've checked that box off so now lets see what else. I'd like to change the color and intensity and seems it's much more involved than what's required for a simple on/off. Just wanting to hear some suggestions from those much smarter out there on the interweb.