# Some presetable devices, like the Leviton 6381, will remain addressed
# after a preset command and will accept subsequent unrelated
# commands unless they are set to ON.
if ($self->{type} =~ /preset2/i and $state =~ /^\d+\%$/) {
$self->{interface}->send_x10_data($self->{interface}, $self->{x10_id}) ;
&self->{interface}->send_x10_data($self->{interface}, 'X' . substr($self->{x10_id},1,1) . 'J') ;
}
WTF? Obviously that first line inside the clause is wrong (scalar prefix on function call.) This Leviton-specific (and highly suspect) code is the only place that &send_x10_data is called in X10_Items. That doesn't seem right.
From X10_Items:
# Note: this method is overriden by Serial_Item::send_x10_data
sub send_x10_data {
my ($self, $interface, $data, $module_type)=@_;
$self->write_data($data);
}
Overriden (sic) by Serial_Item::send_x10_data? So we have come full circle back to Serial_Item. This is the loopiest, looniest code I have ever seen. I have to admit, at first glance it is impossible to decipher what is going on here (which doesn't bode well for less experienced MH/X10 developers.)