From: Norby <no...@no...> - 2000-12-18 05:32:49
|
I looked at the Irrigation code and what you said makes sense. I was trying to figure out exactly how to go about coding that when I came up with this question: What happens if we redefine a state that's already defined from a parent object? What I did in the following code is make sure all 5% increments were defined with non-extended preset dim commands, but also included the non-5% increments so all status messages from the Switchlinc are trapped as well. (The Switchlinc, when controlled locally, will also transmit on the powerline it's command / status. If it's turned on, it'll send out an a4aON, if it's dimmed locally, it'll send out it's dim level, etc.) The code seems to work fine, so I'm assuming that existing states can be redefined in a child object? I also added added support for the X10_Switchlinc class in read_table_A.pl just after the section that checks for X10_Items: elsif($type eq "X10SL") { ($address, $name, $grouplist, @other) = @item_info; $other = join ', ', (map {"'$_'"} @other); $object = "X10_Switchlinc('$address', $other)"; } If all this stuff makes sense, I can send you the complete files, or diffs from the originals. Dan Ratzlaff no...@no... package X10_Switchlinc; @X10_Switchlinc::ISA = ('X10_Item'); sub new { my $self = &X10_Item::new(@_); my $id = $self->{x10_id}; $self-> add ($id . 'M' . 'PRESET_DIM1', '0%'); $self-> add ($id . 'N' . 'PRESET_DIM1', '3%'); $self-> add ($id . 'O' . 'PRESET_DIM1', '5%'); $self-> add ($id . 'P' . 'PRESET_DIM1', '10%'); $self-> add ($id . 'C' . 'PRESET_DIM1', '13%'); $self-> add ($id . 'D' . 'PRESET_DIM1', '15%'); $self-> add ($id . 'A' . 'PRESET_DIM1', '20%'); $self-> add ($id . 'B' . 'PRESET_DIM1', '23%'); $self-> add ($id . 'E' . 'PRESET_DIM1', '25%'); $self-> add ($id . 'F' . 'PRESET_DIM1', '30%'); $self-> add ($id . 'G' . 'PRESET_DIM1', '32%'); $self-> add ($id . 'H' . 'PRESET_DIM1', '35%'); $self-> add ($id . 'K' . 'PRESET_DIM1', '40%'); $self-> add ($id . 'L' . 'PRESET_DIM1', '42%'); $self-> add ($id . 'I' . 'PRESET_DIM1', '45%'); $self-> add ($id . 'J' . 'PRESET_DIM1', '50%'); $self-> add ($id . 'M' . 'PRESET_DIM2', '52%'); $self-> add ($id . 'N' . 'PRESET_DIM2', '55%'); $self-> add ($id . 'O' . 'PRESET_DIM2', '58%'); $self-> add ($id . 'P' . 'PRESET_DIM2', '60%'); $self-> add ($id . 'C' . 'PRESET_DIM2', '65%'); $self-> add ($id . 'D' . 'PRESET_DIM2', '68%'); $self-> add ($id . 'A' . 'PRESET_DIM2', '70%'); $self-> add ($id . 'B' . 'PRESET_DIM2', '75%'); $self-> add ($id . 'E' . 'PRESET_DIM2', '77%'); $self-> add ($id . 'F' . 'PRESET_DIM2', '80%'); $self-> add ($id . 'G' . 'PRESET_DIM2', '85%'); $self-> add ($id . 'H' . 'PRESET_DIM2', '87%'); $self-> add ($id . 'K' . 'PRESET_DIM2', '90%'); $self-> add ($id . 'L' . 'PRESET_DIM2', '95%'); $self-> add ($id . 'I' . 'PRESET_DIM2', '97%'); $self-> add ($id . 'J' . 'PRESET_DIM2', '100%'); $self-> add ($id . 'OGNGMGPGMG', 'clear'); $self-> add ($id . 'OGPGNGMGMG', 'setramprate'); $self-> add ($id . 'PGNGMGOGMG', 'setonlevel'); $self-> add ($id . 'MGNGOGPG', 'addscenemembership'); $self-> add ($id . 'OGPGMGNG', 'deletescenemembership'); $self-> add ($id . 'NGOGPGMG', 'setsceneramprate'); $self-> add ($id . 'MGNGPGOGPG', 'disablex10transmit'); $self-> add ($id . 'OGMGNGPGPG', 'enablex10transmit'); return $self; } ----- Original Message ----- From: "Bruce Winter" <br...@mi...> To: <mis...@li...> Sent: Saturday, December 16, 2000 10:47 PM Subject: RE: [misterhouse-users] Switchlincs > I'm now wondering what the best thing would be to do to handle these > switches. I've been able to add these states to the > X10_Switchlinc code in > X10_Items.pm, but how does that affect states that have already > been created > on the object? For instance, I've can add non-extended preset > dims for 39% > and 42% to the Switchlinc object, but does that mean that a 40% command > would still try to issue a &P## command? > > I can create a Serial_Item in my user code for each of my switchlincs, but > as I already have two and will probably get more, that seems like an awful > lot of code to duplicate. Maybe the best way to allow map ##% levels to one of the 64 non-extended preset dims is to create a private set method in the X10_Switchlinc package. >From there, you can call the normal method. Looks like Bill (I think) did that in X10_IrrigationController. Any of that make sense? If not, let me know and I can give it a try. Bruce ________________________________________________________ To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365 |