Skip to content

Commit

Permalink
Merge branch 'master' into the Fixes_for_Issue_141 branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
jame committed Mar 28, 2013
2 parents 81f5573 + 77e2a07 commit 58cc3ad
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bin/mh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
3 changes: 3 additions & 0 deletions bin/mhl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/Door_Item.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions lib/Generic_Item.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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";
Expand Down
11 changes: 8 additions & 3 deletions lib/Insteon/BaseInsteon.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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'))) {
Expand Down Expand Up @@ -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;
}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/Insteon/Message.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 58cc3ad

Please sign in to comment.