I am trying to get my En-suite lights to turn off after a set period of time and currently the lights turn on but don’t turn off. Its also slowed my Vera down to a restart so i wonder if i have messed up the code. I have attached the output of the status of the PLEG Device hoping that somebody can verify what i have done wrong.
The PIR triggers for 2 minutes (tESMotion) then resets after this time with no motion detected, so i expected the timer to start then.
I have a garage door closer working just fine in PLEG but this is using NOW and not a call to the StartTimer so i wonder if i have made a mistake there? for the life of me i cannot figure out the issue with the lights.
Thank you for your support its really appreciated.
I just want to clarify something
When you state No in the following statement did you mean to?
cESMotionDetected No tESMotion (Likely want to turn repeats on here)
cESAutoOn No !tESLightsOn and cESMotionDetected do you mean i put the not
cESAutoOff No (tESLightsOn; !sESTimer3)
I have tried it without the No command and it seems that anything to do with the timer isn’t working. I have used the sESTimer3 again as i removed the En-suite sensors and added them to a smart switch for now. So the prefix of everything has changed to
For my office lights
I have attached the status report again, and you can see that even though i have triggered the the lights with the PIR it doesn’t seem to fire the schedule.
Currently the lights fire up, but don’t switch off.
Generally when I write manual switch logic, it is because I want a light to stay on/off longer than the automatic setting. Meaning ignore the automation for a period of time (like an hour) before going back to automatic mode. But if you want the switch to follow its 3 minute timer, then you just need to start the timer when you see the lights turn on.
So (for example) a new condition cOFLightOn that also starts the sESTimer3 timer.
Or a little cleaner you could combine:
cOFMotionOrManual Yes tOFMotion or tOFLightsOn
cOFAutoOn No !tOFLightsOn and tOFMotion
cOFAutoOff No (tOFLightsOn; !sESTimer3)
Yes all my switches support instant on and show the correct status in the UI as they trigger.
You have got me thinking about the manual timer part, could you share the code you use for the different timer for manual activation to motion
I like the idea of passing through the room and the lights having a quick time out on motion, however having the option to manually switch on the switch so it stays on for 30 minutes would be perfect.
The office scenario is perfect for this as i can be pretty stationary and with it being a battery PIR as i had to use this until Vera sort the compatibility for the universal sensor from fibaro i cannot relay on the fact that it will trip in the 3 minutes i give it.
I don’t want to be constantly waving my hands around to re trigger the timer, although that wouldn’t have been an issue until you came along, as there was a lot of arm waving i can assure you.
I generally use this format below, which was inspired by some of Richard’s examples.
First I establish what is manual operation - lights turning on or off that are not as a result of an automation (based on if they happened within 30 seconds of an automation) - and if that is the case, start a 1 hour timer. During that 1 hour I leave the lights in the state their are in, once it expires I go back to automatic.
Then I set up the auto on and auto off logic. There is a chicken or egg issue, since the conditions refer to each other and one has to be written first, but it is easy when you plan it out.
Condition: FirstFloorBathroomSinkLightsManualOperation Yes (NOT (FirstFloorBathroomNeedsSinkLightsOn; FirstFloorBathroomSinkLightsOn < 30) and FirstFloorBathroomSinkLightsOn) or (NOT (FirstFloorBathroomNeedsSinkLightsOff; !FirstFloorBathroomSinkLightsOn < 30) and !FirstFloorBathroomSinkLightsOn)
Condition: FirstFloorBathroomNeedsSinkLightsOn No !FirstFloorBathroomSinkLightsOn and FirstFloorBathroomOccupancy and (FirstFloorBathroomSinkLightsManualOperation;!FirstFloorBathroomSinkLightsManual1H) and NOT QuietTime
Condition: FirstFloorBathroomNeedsSinkLightsOff No FirstFloorBathroomSinkLightsOn and !FirstFloorBathroomOccupancy and (!FirstFloorBathroomDoorClosed or (FirstFloorBathroomDoorClosed and (FirstFloorBathroomDoorClosed; !FirstFloorBathroomDoorClosed1H))) and (FirstFloorBathroomSinkLightsManualOperation; !FirstFloorBathroomSinkLightsManual1H)