mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
group code simplified, avoid "uninitialized" message.
git-svn-id: https://svn.fhem.de/fhem/trunk@1500 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6c88f82831
commit
702cefc2fd
@ -909,25 +909,18 @@ FW_showRoom()
|
|||||||
# array of all device names in the room except weblinkes
|
# array of all device names in the room except weblinkes
|
||||||
my @devs= grep { ($FW_rooms{$FW_room}{$_}||$FW_room eq "all") &&
|
my @devs= grep { ($FW_rooms{$FW_room}{$_}||$FW_room eq "all") &&
|
||||||
!IsIgnored($_) } keys %defs;
|
!IsIgnored($_) } keys %defs;
|
||||||
# hash devicename => groups, the name of the default group is the name of the device type
|
|
||||||
my %group;
|
my %group;
|
||||||
my @groups;
|
|
||||||
my %seen = ();
|
|
||||||
foreach my $dev (@devs) {
|
foreach my $dev (@devs) {
|
||||||
# ignore weblinks
|
next if($defs{$dev}{TYPE} eq "weblink");
|
||||||
next if($defs{$dev}{TYPE} eq "weblink");
|
$group{AttrVal($dev, "group", $defs{$dev}{TYPE})}{$dev} = 1;
|
||||||
# please note that a device can be in more than one group: attr <name> group <group1>,<group2>,<group3>
|
}
|
||||||
# we determine it here once including its default value; in the future the default might become
|
|
||||||
# configurable
|
|
||||||
$group{$dev}= AttrVal($dev,"group",$defs{$dev}{TYPE});
|
|
||||||
push @groups, grep { !$seen{$_}++ } split(",",$group{$dev}); # unique addition
|
|
||||||
}
|
|
||||||
|
|
||||||
# row counter
|
# row counter
|
||||||
my $row=1;
|
my $row=1;
|
||||||
|
|
||||||
# iterate over the distinct groups
|
# iterate over the distinct groups
|
||||||
foreach my $g (sort @groups) {
|
foreach my $g (sort keys %group) {
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Check if there is a device of this type in the room
|
# Check if there is a device of this type in the room
|
||||||
@ -937,16 +930,8 @@ FW_showRoom()
|
|||||||
FW_pO "<table class=\"block wide\" id=\"$g\">";
|
FW_pO "<table class=\"block wide\" id=\"$g\">";
|
||||||
|
|
||||||
foreach my $d (sort @devs) {
|
foreach my $d (sort @devs) {
|
||||||
next unless(grep {$_ =~ $g} $group{$d});
|
next if(!$group{$g}{$d});
|
||||||
|
|
||||||
|
|
||||||
# if(defined($devs{$d}{fhem}{interface})) {
|
|
||||||
# display the device according to the interface library items
|
|
||||||
# } else {
|
|
||||||
# display the device according to its device type (as below)
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
my $type = $defs{$d}{TYPE};
|
my $type = $defs{$d}{TYPE};
|
||||||
|
|
||||||
pF "\n<tr class=\"%s\">", ($row&1)?"odd":"even";
|
pF "\n<tr class=\"%s\">", ($row&1)?"odd":"even";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user