mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
36_Shelly.pm: Update mit Bugfix
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@18086 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
cc79ae7dcb
commit
e5cfc98dc1
@ -38,7 +38,7 @@ use vars qw{%attr %defs};
|
|||||||
sub Log($$);
|
sub Log($$);
|
||||||
|
|
||||||
#-- globals on start
|
#-- globals on start
|
||||||
my $version = "1.7";
|
my $version = "1.8";
|
||||||
|
|
||||||
#-- these we may get on request
|
#-- these we may get on request
|
||||||
my %gets = (
|
my %gets = (
|
||||||
@ -635,7 +635,6 @@ sub Shelly_pwd($){
|
|||||||
my ($subs,$ison,$overpower,$rpower,$rstate,$power,$rstopreason,$rcurrpos,$position,$rlastdir,$pct,$pctnormal);
|
my ($subs,$ison,$overpower,$rpower,$rstate,$power,$rstopreason,$rcurrpos,$position,$rlastdir,$pct,$pctnormal);
|
||||||
|
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdateIfChanged($hash,"state","OK");
|
|
||||||
readingsBulkUpdateIfChanged($hash,"network","connected",1);
|
readingsBulkUpdateIfChanged($hash,"network","connected",1);
|
||||||
|
|
||||||
#-- we have a Shelly 1, Shelly 4, Shelly 2 or ShellyPlug switch type device
|
#-- we have a Shelly 1, Shelly 4, Shelly 2 or ShellyPlug switch type device
|
||||||
@ -649,6 +648,11 @@ sub Shelly_pwd($){
|
|||||||
|
|
||||||
readingsBulkUpdateIfChanged($hash,"relay".$subs,$ison);
|
readingsBulkUpdateIfChanged($hash,"relay".$subs,$ison);
|
||||||
readingsBulkUpdateIfChanged($hash,"overpower".$subs,$overpower);
|
readingsBulkUpdateIfChanged($hash,"overpower".$subs,$overpower);
|
||||||
|
if($model eq "shelly1"){
|
||||||
|
readingsBulkUpdateIfChanged($hash,"state",$ison)
|
||||||
|
}else{
|
||||||
|
readingsBulkUpdateIfChanged($hash,"state","OK");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for( my $i=0;$i<$meters;$i++){
|
for( my $i=0;$i<$meters;$i++){
|
||||||
$subs = ($meters == 1) ? "" : "_".$i;
|
$subs = ($meters == 1) ? "" : "_".$i;
|
||||||
@ -685,8 +689,6 @@ sub Shelly_pwd($){
|
|||||||
|
|
||||||
#-- we have data from the device, take that one
|
#-- we have data from the device, take that one
|
||||||
if( defined($rcurrpos) && ($rcurrpos =~ /\d\d?\d?/) ){
|
if( defined($rcurrpos) && ($rcurrpos =~ /\d\d?\d?/) ){
|
||||||
Log3 $name,1,"[Shelly_status] device $name with model=shelly2 returns a blind position, consider chosing a different model=shelly2"
|
|
||||||
if( $model eq "shelly2" );
|
|
||||||
$pct = $pctnormal ? $rcurrpos : 100-$rcurrpos;
|
$pct = $pctnormal ? $rcurrpos : 100-$rcurrpos;
|
||||||
$position = ($rcurrpos==100) ? "open" : ($rcurrpos==0 ? "closed" : $pct);
|
$position = ($rcurrpos==100) ? "open" : ($rcurrpos==0 ? "closed" : $pct);
|
||||||
|
|
||||||
@ -914,7 +916,11 @@ sub Shelly_updown2($){
|
|||||||
my $subs = ($shelly_models{$model}[0] ==1) ? "" : "_".$channel;
|
my $subs = ($shelly_models{$model}[0] ==1) ? "" : "_".$channel;
|
||||||
|
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdate($hash,"state","OK");
|
if($model eq "shelly1"){
|
||||||
|
readingsBulkUpdateIfChanged($hash,"state",$ison)
|
||||||
|
}else{
|
||||||
|
readingsBulkUpdate($hash,"state","OK");
|
||||||
|
}
|
||||||
readingsBulkUpdate($hash,"relay".$subs,$ison);
|
readingsBulkUpdate($hash,"relay".$subs,$ison);
|
||||||
readingsBulkUpdate($hash,"overpower".$subs,$overpower)
|
readingsBulkUpdate($hash,"overpower".$subs,$overpower)
|
||||||
if( $shelly_models{$model}[2] > 0);
|
if( $shelly_models{$model}[2] > 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user