diff --git a/bin/mh b/bin/mh index e03d34636..d0bca5ac7 100755 --- a/bin/mh +++ b/bin/mh @@ -3167,12 +3167,12 @@ sub list_files_by_webname { } sub list_groups_by_object { - my ($object) = @_; + my ($object, $no_child_members) = @_; my @groups; for my $group_name (&list_objects_by_type('Group')) { my $group = &get_object_by_name($group_name); # print "testing group=$group_name -> $group\n"; - for my $object2 (list $group) { + for my $object2 ($group->list(undef, undef,$no_child_members)) { push @groups, $group if $object eq $object2; } } diff --git a/bin/mhl b/bin/mhl index fd57bf9d0..32b43cf33 100755 --- a/bin/mhl +++ b/bin/mhl @@ -6,6 +6,9 @@ # Call Switch User if you call this script as root so mh does not run as root # su xyz +# Set current working directory to location of this script (bin/) +cd "$( cd "$( dirname "$0" )" && pwd )" + while [ 1 = 1 ]; do echo diff --git a/lib/Door_Item.pm b/lib/Door_Item.pm index 21e643c89..4db943edf 100644 --- a/lib/Door_Item.pm +++ b/lib/Door_Item.pm @@ -85,6 +85,7 @@ sub initialize $$self{'alarm_action'} = ''; $$self{last_open} = 0; $$self{last_closed} = 0; + @{$$self{states}} = ('open','closed'); } # If an alarm is set, the specified action is executed if the diff --git a/lib/Generic_Item.pm b/lib/Generic_Item.pm index 591db2ca0..69c3f10d2 100644 --- a/lib/Generic_Item.pm +++ b/lib/Generic_Item.pm @@ -1490,7 +1490,7 @@ sub android_xml { # Add tags name, state, and optional state_log my @f = qw( name ); - if (scalar($self->get_states( )) > 0) { + if ( ((defined $self->{states}) && (scalar(@{$$self{states}}) > 0)) || (defined $self->state( ))) { push @f, qw ( state ); } if ($log_size > 0) { @@ -1521,8 +1521,14 @@ sub android_xml { } if ($f eq "state") { - my @states = $self->get_states( ); - my $numStates = @states; + my @states = (); + push (@states,@{$$self{states}}) if defined $self->{states}; + my $numStates = scalar(@states); + my $state = $self->state( ); + &::print_log("android_xml: numStates: $numStates state: $state states: @states") if $::Debug{android}; + if (($numStates eq 0) && (defined $state) && (length($state) < 20)) { + push (@states, $state); + } $attributes->{type} ="text"; if ($numStates eq 2) { $attributes->{type} = "toggle"; diff --git a/lib/Insteon/BaseInsteon.pm b/lib/Insteon/BaseInsteon.pm index c38f0ccf8..892bb461e 100755 --- a/lib/Insteon/BaseInsteon.pm +++ b/lib/Insteon/BaseInsteon.pm @@ -251,7 +251,7 @@ sub set $$self{pending_setby} = $p_setby; $$self{pending_response} = $p_response; } - $self->level($p_state) if $self->isa("Insteon::BaseDevice"); # update the level value + $self->level($p_state) if ($self->isa("Insteon::BaseDevice") && $self->can('level')); # update the level value # $self->SUPER::set($p_state,$p_setby,$p_response) if defined $p_state; } else { &::print_log("[Insteon::BaseObject] failed state validation with state=$p_state"); @@ -444,7 +444,7 @@ sub _is_info_request &::print_log("[Insteon::BaseObject] received status for " . $self->{object_name} . " with on-level: $ack_on_level%, " . "hops left: $msg{hopsleft}") if $main::Debug{insteon}; - $self->level($ack_on_level); # update the level value + $self->level($ack_on_level) if $self->can('level'); # update the level value if ($ack_on_level == 0) { $self->SUPER::set('off', $ack_setby); } elsif ($ack_on_level > 0 and !($self->isa('Insteon::DimmableLight'))) { @@ -945,7 +945,12 @@ sub get_root { } else { - return &Insteon::get_object($self->device_id, '01'); + my $root_obj = &Insteon::get_object($self->device_id, '01'); + ::print_log ("[Insteon::BaseDevice] ERROR! Cannot find the root object for " + . $self->get_object_name . ". Please check your mht file to make sure " + . "that device id " . $self->device_id . ":01 is defined.") + if (!defined($root_obj)); + return $root_obj; } } diff --git a/lib/Insteon/Message.pm b/lib/Insteon/Message.pm index 9a377f0d1..841553322 100755 --- a/lib/Insteon/Message.pm +++ b/lib/Insteon/Message.pm @@ -116,7 +116,8 @@ sub send $self->setby->default_hop_count($self->setby->default_hop_count + 1); } } - elsif (defined($$self{no_hop_increase}) && $main::Debug{insteon}){ + elsif (defined($$self{no_hop_increase}) && $main::Debug{insteon} + && $self->setby->isa('Insteon::BaseObject')){ &main::print_log("[Insteon::BaseMessage] Hop count not increased for " . $self->setby->get_object_name . " because no_hop_increase flag was set."); $$self{no_hop_increase} = undef;