johnnyt Posted April 17, 2011 Posted April 17, 2011 I have a bathroom light that I turn on when the program "bathroom motion flag" is true and the light is off. I also have logic I had hoped would keep it from going on if it's just been turned off but that part doesn't work. my logic is: if status "bathroom motion flag" is true and status "bathroom light" is off and control "bathroom light" is not switched off and control "bathroom light is not switched fast off then set "bathroom light" to 80% as I leave the room whether I press "off" or "fast off", the light does go off but then goes back on within seconds. the "flag" is set by homeseer, which accesses the DSC alarm panel that knows about the bathroom motion sensor. I deliberately delay setting the flag to false to minimize comm traffic so it will always be true for a period of time after motion has stopped but as I understand it that shouldn't matter with respect to turning the light off at the switch. but then again it isn't working as I understand it should be working. any help would be appreciated.
oberkc Posted April 17, 2011 Posted April 17, 2011 I wonder if there is not a slight logic problem in your program. Using "AND" construct, all conditions would have to simultaneously be true for the program to be true. I suspect it is hard to have a simultaneous "off" and "fast off". Try: if status "bathroom motion flag" is true and status "bathroom light" is off and ( control "bathroom light" is not switched off or control "bathroom light is not switched fast off ) then set "bathroom light" to 80%
johnnyt Posted April 19, 2011 Author Posted April 19, 2011 Thanks for the reply. I know the logic works to turn the light on (since it's the only program I have to turn the light on) If I didn't know better (and I guess yesterday I didn't) I'd say that ISY was not recognizing that I've switched the light off (or fast off) but I'm realizing it's that the condition gets re-evaluated immediately after I clicked off (or fast off) because the light status changes from on to off; it then sees all conditions as true again and turns the light on again. In other words it has, within milliseconds, completely "forgotten" about the off or fast off event. It's brilliantly logical but not as intuitive as I might have liked. I've created a second program for "switched off" OR "switched fast off" that disables my first program, resets my bathroom motion flag, waits 2 seconds and re-enables the first program. Now everything works fine.
Recommended Posts