Skip to content

Commit

Permalink
Merge pull request #412 from krkeegan/insteon_fix_state
Browse files Browse the repository at this point in the history
Insteon: Force Dimmable Items to Report off Rather than 0%
  • Loading branch information
krkeegan committed Jun 13, 2014
2 parents bb2f050 + 69a3734 commit 0523572
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Insteon/Lighting.pm
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,14 @@ sub derive_link_state
if (grep(/$p_state/i, @{['on_fast', 'off', 'off_fast']})) {
$link_state = $p_state;
}
elsif ($p_state =~ /\d+%?/)
elsif ($p_state =~ /(\d+)%?/)
{
$p_state =~ /(\d+)%?/;
$link_state = $1 . '%';
if ($1 == 0) {
$link_state = 'off';
}
else {
$link_state = $1 . '%';
}
}
return $link_state;
}
Expand Down

0 comments on commit 0523572

Please sign in to comment.