## misterhouse-users

 [misterhouse-users] I don't understand dimming From: Jon Boehm - 2002-09-30 01:36:17 ```Hi, Ok, this is what I what to do, when a motion sensor triggers a light that has been dimmed to 0% dims up to 50%. When the motion sensor send its off command the lamp should dim back down to 0%. Below is the code that I thought should do it but something's wrong. In the initial script/not in the loop: Set \$lamp 'on'; Set \$lamp '0'; In the loop: Set \$lamp '50' if ((state_changed \$Motion) eq 'on'); Set \$lamp '0' if ((state_changed \$Motion) eq 'off'); What am I doing wrong? Jon ```
 RE: [misterhouse-users] I don't understand dimming From: Bruce Winter - 2002-09-30 12:59:58 ```> Ok, this is what I what to do, when a motion sensor triggers a light that > has been dimmed to 0% dims up to 50%. When the motion sensor send its off > command the lamp should dim back down to 0%. > > Below is the code that I thought should do it but something's wrong. > > > In the initial script/not in the loop: > Set \$lamp 'on'; > Set \$lamp '0'; > > > In the loop: > Set \$lamp '50' if ((state_changed \$Motion) eq 'on'); > Set \$lamp '0' if ((state_changed \$Motion) eq 'off'); > > What am I doing wrong? You need to include %. Without it, it is interpreted as relative +- increases, rather absolute levels. So 50 is like +50 and 0 is like +0. Bruce ```
 Re: [misterhouse-users] I don't understand dimming From: Jon Boehm - 2002-10-01 07:30:44 ```You mean like this?? In the initial script/not in the loop: Set \$lamp 'on'; Set \$lamp '0%'; In the loop: Set \$lamp '50%' if ((state_changed \$Motion) eq 'on'); Set \$lamp '0%' if ((state_changed \$Motion) eq 'off'); I tried this and doesn't seem to do anything. The only way the light dims is by using "set \$lamp'dim'" No other command seems to have any decreasing effect on the lamp. Set \$lamp 'dim'; # dims the lamp Set \$lamp '25'; # brighten after it has been dimmed already Set \$lamp '-25'; # nothing Set \$lamp '50%'; # nothing Jon >> Ok, this is what I what to do, when a motion sensor triggers a light that >> has been dimmed to 0% dims up to 50%. When the motion sensor send its off >> command the lamp should dim back down to 0%. >> >> Below is the code that I thought should do it but something's wrong. >> >> >> In the initial script/not in the loop: >> Set \$lamp 'on'; >> Set \$lamp '0'; >> >> >> In the loop: >> Set \$lamp '50' if ((state_changed \$Motion) eq 'on'); >> Set \$lamp '0' if ((state_changed \$Motion) eq 'off'); >> >> What am I doing wrong? > > You need to include %. Without it, it is interpreted as relative +- > increases, rather absolute levels. So 50 is like +50 and 0 is like +0. > > Bruce > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > ________________________________________________________ > To unsubscribe from this list, go to: > http://sourceforge.net/mail/?group_id=1365 > ```
 Re: [misterhouse-users] I don't understand dimming From: Paul Chamberlain - 2002-10-01 13:14:17 ```Jon Boehm wrote: > Set \$lamp '50%' if ((state_changed \$Motion) eq 'on'); > Set \$lamp '0%' if ((state_changed \$Motion) eq 'off'); What you want is really something more like: set \$lamp '+50' if ((state_changed \$Motion) eq 'on'); set \$lamp '-90' if ((state_changed \$Motion) eq 'off'); And I think the case is significant too. I haven't upgraded in quite a while, but this is what works for me. The '-90' is obviously more than necessary but it makes any inaccuracies self-correcting. (It also gets things back in line if somebody manually messed with the light.) In other words, don't expect the following to work right: set \$lamp OFF set \$lamp ON set \$lamp '-30' # Should be at 70% set \$lamp '-30' # Should be at 40% set \$lamp '+30' # Should be at 70% set \$lamp '-30' # Should be at 40% set \$lamp '+30' # Should be at 70% set \$lamp '-30' # Should be at 40% set \$lamp '+30' # Should be at 70% Dimming just isn't accurate like that. And things will get even worse if you try: set \$lamp '-10' # Should be at 60% set \$lamp '-10' # Should be at 50% set \$lamp '-10' # Should be at 40% set \$lamp '+30' # Should be at 70% set \$lamp '-10' # Should be at 60% set \$lamp '-10' # Should be at 50% set \$lamp '-10' # Should be at 40% set \$lamp '+30' # Should be at 70% set \$lamp '-10' # Should be at 60% set \$lamp '-10' # Should be at 50% set \$lamp '-10' # Should be at 40% set \$lamp '+30' # Should be at 70% So whenever I dim to 0% I go way over it, and if I ever plan on brightening to 100% I go way over it too. In fact, I think the "driver" should recognize these two and over-correct for them. -- Paul Chamberlain, tif@... ```
 [misterhouse-users] Problem with state checking. From: R P - 2002-10-01 16:30:53 ``` I've been trying to figure out what's wrong with my coding for my lights and can't get it working right, so I'm seeking outside asssitance. What I would like to do is roughly a hour before sunset I want to fade up a couple of lights to 30% PROVIDED THAT THEY ARE OFF PRESENTLY. Then I wish to take it one step further and kick them up to 60% an hour after sunset, ONLY IF THEY ARE AT 30%.... I can't even get the (state_now \$light eq 'off') check to work properly (and yet, my motion sensors work fine). I've even gone to the degree of explicitly turning the lamps off when MH is running to ensure that they are known as off. -Ryan Pomaski Quite puzzled... :) __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com ```
 RE: [misterhouse-users] Problem with state checking. From: Bill Sobel - 2002-10-01 22:43:05 ```> can't even get the (state_now \$light eq 'off') check to work properly (and yet, my motion sensors work fine). I've even gone to the degree of explicitly turning the lamps off when MH is running to ensure that they are known as off. Hi Ryan, (From memory as I'm not at my MH setup right now, but...) If you can post your code that should definitely help, but I suspect what is happening is that you're comparing what you want with state_now vs state. State_now comparisions evaluate to true if the state was just set during the previous MH pass. So, state_now \$light eq 'off' will be true during the MH pass right after the light is turned off. State \$light eq 'off' should be true the entire time the light is off. Bill ```
 RE: [misterhouse-users] Problem with state checking. From: R P - 2002-10-02 05:39:58 ```Bill, Here's the code file in question. (I would attach the .pl, but I don't think attachments would go through) Any suggestions/corrections would be appreciated! :^) -Ryan #----------------------------------- # Module to control the lights in the living room and dining room #----------------------------------- \$timer_liv_motion = new Timer(); \$signs_of_life = new Timer(); #if (expired \$timer_liv_motion) { # set \$liv_flrlamp 'off'; # set \$dining_hang 'off'; # print_log "Motion Timer expired in living room, killing lights"; #} if ((state_now \$liv_sensor eq 'motion') and \$Dark) { set \$liv_flrlamp '30%' if ((state \$liv_flrlamp) eq 'off'); set \$dining_hang '30%' if ((state \$dining_hang) eq 'off'); set \$timer_liv_motion 240; print_log "Motion detected in liv, Setting timer"; } \$liv_sensor -> tie_event('set \$signs_of_life 600'); #10 minutes if ((time_greater_than('12:00 AM')) and (expired \$signs_of_life)) { print_log "No signs of life, and after midnight, killing lights"; set \$dining_hang 'off'; set \$liv_flrlamp 'off'; } if (time_now eq "\$Time_Sunset - 0:30") { print_log "Getting Dark....."; set \$liv_flrlamp '30%' if (state \$liv_flrlamp eq 'off'); set \$dining_hang '30%' if (state \$dining_hang eq 'off'); } if (time_now eq "\$Time_Sunset + 0:30") { print_log "Should be dark, cranking lights up further"; set \$liv_flrlamp '60%' if (level \$liv_flrlamp eq '50%'); set \$dining_hang '60%' if (level \$dining_hang eq '50%'); } __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com ```
 RE: [misterhouse-users] Problem with state checking. From: Bruce Winter - 2002-10-02 12:43:36 ```> Here's the code file in question. (I would attach > the .pl, but I don't think attachments would go > through) > > Any suggestions/corrections would be appreciated! :^) I forgot what the problem was your code was. Can you outline what does and does not work with the code you posted? > if ((time_greater_than('12:00 AM')) and (expired > \$signs_of_life)) { > print_log "No signs of life, and after midnight, > killing lights"; > set \$dining_hang 'off'; > set \$liv_flrlamp 'off'; > } This looks ok. If you wanted to be a bit more effecient, you could swap those tests and do the 'expired' test first (it quickly returns a simple true/false flag) and the more expensive 'time_greather_than' second (it must re-calculate and compare times on every call). > if (time_now eq "\$Time_Sunset + 0:30") { > print_log "Should be dark, cranking lights up > further"; > set \$liv_flrlamp '60%' if (level \$liv_flrlamp eq > '50%'); > set \$dining_hang '60%' if (level \$dining_hang eq > '50%'); > } level returns a number, 0 -> 100, without the %, so those tests will never be true. Bruce ```
 RE: [misterhouse-users] Problem with state checking. From: R P - 2002-10-02 15:04:43 ```Well, the level part was one of them, so I'll have to fix that tonight. :) The primary problem is that I want the lights to turn themselves on at a certain time ONLY if they aren't on already, for some reason they never seem to evaluate the state on the device. The second part was the level bit...I wanted them to brighten, provided that they weren't manually brightened/dimmed/turned off (manually - via X10 remote) > I forgot what the problem was your code was. Can > you outline what does and > does not work with the code you posted? > __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com ```