#Yes but how could I do the override so
1 messages · Page 1 of 1 (latest)
I've done something similar to that myself.
I react to multiple different situations in Node-Red:
- Following the light state, if it turns on without a certain temporary value from a Flow set, flip the "Light Control" to manual.
- If a remote dimmer is used to adjust the brightness of the lights (even if they've been turned on by motion), flip the light control to manual and stop any running motion timers from turning the lights off.
In my case, the override variable is actually a Home Assistant input_select helper (values of: off, manual, auto).
If the light control is changed from auto to manual, leave all lights as-is and stop running auto-off timers.
Actually, I need to get rid of the temporary value and just move the HA helper change to an earlier bit on my motion detection (so that it gets changed before lights are turned on). My use for the temp variable was to stop the "Lights to manual" flow from triggering off motion (motion turns lights on, lights turning on makes NR think "Oh, manual time!")
Then, in the motion setup, on trigger you'd first check if the variable is "manual" or not
But how would for example setting it via Siri (HomeKit bridge) set the state to manual?
Follow the light state (react on lights changing from off to on or changes in brightness), that way it doesn't matter what changes the lights.
As long as you're setting the variable before turning on the lights from motion, it should work just fine.
so basically
off -> change -> on_automatic: When movement is recognized and NOT in "manual" mode: Set helper state to "change", then turn the lights on, finally set state to "on_automatic"
on_automatic -> off can turn off after X second, sets helper state to "off"
off-> on_manual or on_automatic->on_manual If a light gets changed and it is NOT currently in the "change" state, we switch to "manual" mode
But how can we recognize properly, that a room is "off" and that the automatic flow can start again?
Either have a check for "When all lights are manually turned off, set helper 'off'" or something more elaborate.
I'll try to whip up a quick example based on my overly complicated setup 😄
https://pastebin.com/A9bhyMZW
A very simple example of what I would do.
It's actually missing a check for what the payload of the motion trigger is (currently, it'd trigger on both "Motion detected" and "No more motion" messages).
But, simply:
Flow 1
- Motion checks the current control state (for both 'off' and 'motion', keep going, otherwise stop).
- Set control state to "motion"
- Start a ControlTimer for 5 minutes
- ControlTimer turns on the lights when it initially triggers, any new messages from the motion flow will restart the timer (so the lights don't turn off when there's constant motion)
- When no motion has been detected for 5 minutes, timer runs out and lights turn off.
Flow 2
- Manually adjust a light
- Set control state to "manual" or "off" based on the manual adjustment.
- Throw a link out to Flow 1 that stops a running timer (so the lights don't turn off on their own)
- Actually adjust the lights (either off, or on etc).
For Flow 2, you'd hook that up to events from a Dimmer switch, or HA trigger: change-node's
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.