From: Chris B. <ch...@ba...> - 2006-05-01 09:32:19
|
Hi Michael, Here's how I've done it. I have the housecode on the pad set to K and the following in my .MHT file: X10I, K1, KP_1, Hidden X10I, K2, KP_2, Hidden X10I, K3, KP_3, Hidden X10I, K4, KP_4, Hidden X10I, K5, KP_5, Hidden X10I, K6, KP_6, Hidden X10I, K7, KP_7, Hidden X10I, K8, KP_8, Hidden X10I, K9, KP_9, Hidden X10I, KA, KP_10, Hidden X10I, KB, KP_11, Hidden X10I, KC, KP_12, Hidden X10I, KD, KP_13, Hidden X10I, KE, KP_14, Hidden X10I, KF, KP_15, Hidden X10I, KG, KP_16, Hidden The "Hidden" tags are so that these items don't appear in the web interface. I then have the following code in my main code file: set $LoungeRoom_light $state if ($state = state_now $KP_1); toggle_light($stripey_light,$state) if ($state = state_now $KP_2); toggle_light($snable_light,$state) if ($state = state_now $KP_3); toggle_light($flower_light,$state) if ($state = state_now $KP_4); toggle_light($reading_light,$state) if ($state = state_now $KP_5); set $DiningRoom_light $state if ($state = state_now $KP_6); set $Kitchen_light_row1 $state if ($state = state_now $KP_7); set $Kitchen_light_row2 $state if ($state = state_now $KP_8); set $Entry_light $state if ($state = state_now $KP_9); set $Hall_light $state if ($state = state_now $KP_10); set $Christmas_lights $state if ($state = state_now $KP_11); #set $xxx $state if ($state = state_now $KP_12); #set $xxx $state if ($state = state_now $KP_13); &announce_weather("conditions") if (state_now $KP_14 eq ON); &announce_weather("forecast") if (state_now $KP_14 eq OFF); &HeaterBooster($state) if ($state = state_now $KP_15); set $dishwasher $state if ($state = state_now $KP_16); sub toggle_light { my ($light,$switch_state) = @_; if ($switch_state eq OFF) { set $light OFF; } elsif ( (get_idle_time $light > 2) && ($switch_state eq ON) && (state $light eq OFF) ) { set $light ON; } elsif ( (get_idle_time $light > 2) && ($switch_state eq ON) && ((state $light eq ON) || (state $light eq '+50')) ) { set $light '50%'; } elsif ( (get_idle_time $light > 2) && ($switch_state eq ON) && (state $light eq '-50') ) { set $light '100%'; } } Basically, the Dim and Brighten buttons on the keypad aren't used and I use the toggle_light routine to toggle a light between 100% and 50% brightness with multiple presses on the relevant ON button. > -----Original Message----- > From: mis...@li... [mailto:misterhouse- > use...@li...] On Behalf Of Michael W. Oliver > Sent: Monday, 1 May 2006 4:57 AM > To: mis...@li... > Subject: [mh] bright/dim with w800 and palm pads > > Hi guys, > > So, I just got my W800 yesterday, and installed it this morning. WOW!! > This thing is amazing, and my wireless response time is great! One > thing I have having trouble with is a way to implement bright/dim with > the palm pads through the W800. From debugging, I can see that the W800 > sends a XAL for bright and XAM for dim (assuming housecode 'A'). What I > am not having luck with is capturing the "Previous units" from the last > X10 item to use in conjunction with the bright/dim commands. Here is > what I am testing right now... > > -----8<----- > $palmpad_01 = new Serial_Item('XA1AJ', ON); > $palmpad_01 ->add('XA1AK', OFF); > $palmpad_01 ->add('XAL', BRIGHTEN); > $palmpad_01 ->add('XAM', DIM); > > $palmpad_02 = new Serial_Item('XA2AJ', ON); > $palmpad_02 ->add('XA2AK', OFF); > $palmpad_02 ->add('XAL', BRIGHTEN); > $palmpad_02 ->add('XAM', DIM); > > if (state_now $palmpad_01 eq ON) { set $Entertainment_Center_Lamp ON; } > if (state_now $palmpad_01 eq OFF) { set $Entertainment_Center_Lamp OFF; } > if (state_now $palmpad_01 eq DIM) { set $Entertainment_Center_Lamp -10; } > if (state_now $palmpad_01 eq BRIGHTEN) { set $Entertainment_Center_Lamp > +10; } > > if (state_now $palmpad_02 eq ON) { set $Couch_Lamp ON; } > if (state_now $palmpad_02 eq OFF) { set $Couch_Lamp OFF; } > if (state_now $palmpad_02 eq DIM) { set $Couch_Lamp -10; } > if (state_now $palmpad_02 eq BRIGHTEN) { set $Couch_Lamp +10; } > > -----8<----- > > Now, when I press 1/ON on the palm pad, the E.C. Lamp turns on, which is > fine. Likewise when I press 2/ON for the Couch Lamp. However, when I > then press the dim button, the log shows that a XAM is received and BOTH > lights dim. Likewise for bright with XAL. When I change the palm pad > to the actual housecode for those lamps (B) and bypass my script, I can > see from the log that there is a "X10: Previous units=B3 reset_flag=1" > line that indicates which unit is to receive the bright/dim command. > > How can I replicate this behavior with my module? The reason that I am > using a custom module is because I want to control multiple housecodes > from the one palm pad (using 'A') without having to fiddle the housecode > dial... a 'relay' of sorts. > > Thanks guys. > > -- > Mike Oliver, KI4OFU > [see complete headers for contact information] |