Ok. So I have ventured into putting motion sensors in (finally)
But I am having some concerns with the scenarios. Mainly the bedroom. I had some time based rules in place but not sure if that’s ideal either.
So here is what I have
rule "Bedroom Motion Sensor"
when
Item BedroomMotionSensor changed
then
var Number hour = now.getHourOfDay
var triggeredTime = BedroomMotionSensor.lastUpdate()
var LightLevel = MasterBedRoomLightLevel.state as DecimalType
logError("Bedroom", "Last Triggered " + triggeredTime.toString)
logError("Bedroom","Tst2 - "+BedroomMotionSensor.maximumSince(now.minusMinutes(5).minusSeconds(30)).state.toString)
//get some values
if(MasterBedroom_MotionSensorOverride.state == ON)
{
override = true
logError("Bedroom","Override is ACTIVE!")
}
else
{
override = false
logError("Bedroom","No Override")
}
//if ((hour >= 18) || (hour <= 5)) {
var Number numOn = gLivingRoomLights.members.filter(s | s.state == ON).size
logError("Bedroom","Bedroom Count"+numOn.toString)
if(numOn > 0)
{
//check for override
if(!override)
{
//living room lights are still on, leave it alone
if((BedroomMotionSensor.state==ON) && ( LightLevel > 69))
{
gBedroomLights.send(ON)
logError("Bedroom","Bedroom Motion Detected - ON")
}
else
{
gBedroomLights.send(OFF)
logError("Bedroom","No Motion, turn the lights off")
}
}
}
In short
- check for override
- check if any living room lights are on
- if light sensor indicates dark - turn the lights on
I have it check to see if the living room lights are on because that indicates not bedtime yet so still turn the lights on. However this backfires on stormy days where there is slightly more light in the livingroom because of the bay window but the bedroom is dark so it should turn on then, but the living room lights are off so no turn on. But I also don’t want to accidentally trigger the lights if I turn in the middle of the night or something.
Anyone have any suggestions? Or is motion sensors in the bedrooms a bad idea? I do have overrides in place in case I or the wife have to go to bed early one night or something.