Misterhouse: EIBG => Abfrage Garagentor

0

Hallo zusammen,

ich habe die EIBW Klasse von RaK adaptiert und zur Garagentorabfrage angepasst. Es sind zwei Kontakte notwendig, die z.B. bei mir über einen Binäreingang von ABB 4.20.1 abgefragt werden.

K(unten) = zu & K(oben) = offen => Tor zu
K(unten) = offen & K(oben) = offen => Tor in Bewegung
K(unten) = offen & K(oben) = zu => Tor offen

Das ganze wird bei mir mit den beigefügten Icons auf dem iTouch angezeigt (Danke RaK)

Zum Nachbau ein kleines How-To nachfolgend.

Besten Gruß
Joerg

##############################################################
Datei =/opt/misterhouse/mh/lib/EIB_Items.pm

# Garage Door
package EIBG_Item;
@EIBG_Item::ISA = ('EIB_Item');
# new: create an EIBG_Item. Instantiate the three underlying items.
sub new {
my ($class, $id) = @_;
my @groups;
my ($subid, $item);
my $self = $class->SUPER::new($id);
@groups = split(/\|/, $id);
print "Two group addresses required for garage door. Found $#groups in $id\n" if ($#groups != 1);
$subid = $groups[0];
$item = new EIBG1_Item($subid, "R", $id);
$item->add($subid . 'on', 'on');
$item->add($subid . 'off', 'off');
$self->{Top} = $subid;
if ($groups[0] ne $groups[1]) {
$subid = $groups[1];
$item = new EIBG1_Item($subid, "", $id);
$item->add($subid . 'on', 'on');
$item->add($subid . 'off', 'off');
}
$self->{Bottom} = $subid;
$self->add($id . 'open', 'open');
$self->add($id . 'working', 'working');
$self->add($id . 'close', 'close');
return $self;
}
sub eis_type {
return 'w';
}
# position: return "position" sub-item
sub top {
my ($self) = @_;
my $subitem;
return unless defined $self->{Top};
return $eib_item_by_id{$self->{Top}};
}
# control: return "control" sub-item
sub bottom {
my ($self) = @_;
my $subitem;
return unless defined $self->{Bottom};
return $eib_item_by_id{$self->{Bottom}};
}
# set_receive: received an event from one of the sub_items.
sub set_receive {
my ($self, $state, $set_by, $target) = @_;
my $top = $self->top()->state_final();
my $bottom = $self->bottom()->state_final();
$state = "closed" if ($top eq "off" && $bottom eq "on");
$state = "working" if ($top eq "on" && $bottom eq "on");
$state = "open" if ($top eq "on" && $bottom eq "off");
#&main::print_log("################### t:$top b:$bottom w:$state ");
$self->SUPER::set_receive($state, $set_by, $target);
}
# EIS 2 subitem: generic class for the three dimming sub-functions
package EIBG_Subitem;
@EIBG_Subitem::ISA = ('EIB_Item');
sub new {
my ($class, $id, $mode, $gdoorid) = @_;
my @args;
my $self = $class->SUPER::new($id, $mode);
$self->{'GDoor'} = $gdoorid;
return $self;
}
sub gdoor {
my ($self) = @_;
my $subitem;
return unless defined $self->{GDoor};
return $eib_item_by_id{$self->{GDoor}};
}
# set_receive: forward to meta-item
sub set_receive {
my ($self, $state, $set_by, $target) = @_;
$self->SUPER::set_receive($state, $set_by, $target);
my $gdoor = gdoor $self;
if (defined $gdoor) {
$gdoor->set_receive($state, $set_by, $target);
}
else {
&main::print_log("No Garage Door defined for Garage Door subitem $self->{groupaddr}");
}
}
package EIBG1_Item;
# Multiple inheritance -- use encode/decode methods from EIB1_Item, and the rest from
# EIBG_Subitem
@EIBG1_Item::ISA = ('EIBG_Subitem', 'EIB1_Item'); # order is important!
sub eis_type {
return 'w.3';
}

##############################################################
Datei =/opt/misterhouse/code/iphone.pl

} elsif ($object->isa('Network_Item')) {
} elsif ($object->isa('EIBW_Item')) {
$name =~ s/^://;
$einheit = "%s";
$state = "gekippt" if ($state eq "tilt");
$state = "offen" if ($state eq "open");
$state = "zu" if ($state eq "closed");
$html .= "
  • " . sprintf($einheit,$state) . "$icon$name
 "; } elsif ($object->isa('EIBG_Item')) { $name =~ s/^://; $einheit = "%s"; $state = "zu" if ($state eq "closed"); $state = "in Bewegung" if ($state eq "working"); $state = "offen" if ($state eq "open"); $html .= "
  • " . sprintf($einheit,$state) . "$icon$name
 "; } elsif ($object->isa('EIBRB_Item')) {

##############################################################
EIB_ITEMS.mht

EIBG, 0/8/15|0/8/16, Garagentor, Status

Ich habe mich für die Startseite von RaK entschieden und daher seine html als index.html im /opt/misterhouse/mh/web/iphone bennant

############################################################