mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-30 18:12:28 +00:00
36_Shelly.pm: Version erlaubt Nutzung von ShellyEM
git-svn-id: https://svn.fhem.de/fhem/trunk@23391 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ec07561859
commit
51361e6ae5
@ -39,7 +39,7 @@ use vars qw{%attr %defs};
|
|||||||
sub Log($$);
|
sub Log($$);
|
||||||
|
|
||||||
#-- globals on start
|
#-- globals on start
|
||||||
my $version = "2.19";
|
my $version = "2.20";
|
||||||
|
|
||||||
#-- these we may get on request
|
#-- these we may get on request
|
||||||
my %gets = (
|
my %gets = (
|
||||||
@ -105,7 +105,8 @@ my %shelly_models = (
|
|||||||
"shellyplug" => [1,0,0,1],
|
"shellyplug" => [1,0,0,1],
|
||||||
"shelly4" => [4,0,0,4],
|
"shelly4" => [4,0,0,4],
|
||||||
"shellyrgbw" => [0,0,4,1],
|
"shellyrgbw" => [0,0,4,1],
|
||||||
"shellydimmer" => [0,0,1,1]
|
"shellydimmer" => [0,0,1,1],
|
||||||
|
"shellyem" => [1,0,0,2]
|
||||||
);
|
);
|
||||||
|
|
||||||
my %shelly_regs = (
|
my %shelly_regs = (
|
||||||
@ -953,8 +954,8 @@ sub Shelly_pwd($){
|
|||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdateIfChanged($hash,"network","<html>connected to <a href=\"http://".$hash->{TCPIP}."\">".$hash->{TCPIP}."</a></html>",1);
|
readingsBulkUpdateIfChanged($hash,"network","<html>connected to <a href=\"http://".$hash->{TCPIP}."\">".$hash->{TCPIP}."</a></html>",1);
|
||||||
|
|
||||||
#-- we have a Shelly 1/1pw, Shelly 4, Shelly 2/2.5 or ShellyPlug switch type device
|
#-- we have a Shelly 1/1pw, Shelly 4, Shelly 2/2.5, ShellyPlug or ShellyEM switch type device
|
||||||
if( ($model =~ /shelly1.*/) || ($model eq "shellyplug") || ($model eq "shelly4") || (($model =~ /shelly2.*/) && ($mode eq "relay")) ){
|
if( ($model =~ /shelly1.*/) || ($model eq "shellyplug") || ($model eq "shelly4") || ($model eq "shellyem") || (($model =~ /shelly2.*/) && ($mode eq "relay")) ){
|
||||||
for( my $i=0;$i<$channels;$i++){
|
for( my $i=0;$i<$channels;$i++){
|
||||||
$subs = (($channels == 1) ? "" : "_".$i);
|
$subs = (($channels == 1) ? "" : "_".$i);
|
||||||
$ison = $jhash->{'relays'}[$i]{'ison'};
|
$ison = $jhash->{'relays'}[$i]{'ison'};
|
||||||
@ -962,19 +963,25 @@ sub Shelly_pwd($){
|
|||||||
$ison =~ s/1|(true)/on/;
|
$ison =~ s/1|(true)/on/;
|
||||||
$overpower = $jhash->{'relays'}[$i]{'overpower'};
|
$overpower = $jhash->{'relays'}[$i]{'overpower'};
|
||||||
readingsBulkUpdateIfChanged($hash,"relay".$subs,$ison);
|
readingsBulkUpdateIfChanged($hash,"relay".$subs,$ison);
|
||||||
readingsBulkUpdateIfChanged($hash,"overpower".$subs,$overpower);
|
readingsBulkUpdateIfChanged($hash,"overpower".$subs,$overpower)
|
||||||
|
if(defined($overpower));
|
||||||
if($model =~ /shelly(1|(plug)).*/){
|
if($model =~ /shelly(1|(plug)).*/){
|
||||||
readingsBulkUpdateIfChanged($hash,"state",$ison)
|
readingsBulkUpdateIfChanged($hash,"state",$ison)
|
||||||
}else{
|
}else{
|
||||||
readingsBulkUpdateIfChanged($hash,"state","OK");
|
readingsBulkUpdateIfChanged($hash,"state","OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
my $metern = ($model eq "shellyem")?"emeters":"meters";
|
||||||
for( my $i=0;$i<$meters;$i++){
|
for( my $i=0;$i<$meters;$i++){
|
||||||
$subs = ($meters == 1) ? "" : "_".$i;
|
$subs = ($meters == 1) ? "" : "_".$i;
|
||||||
$power = $jhash->{'meters'}[$i]{'power'};
|
$power = $jhash->{$metern}[$i]{'power'};
|
||||||
$energy = int($jhash->{'meters'}[$i]{'total'}/6)/10;
|
$energy = int($jhash->{$metern}[$i]{'total'}/6)/10;
|
||||||
readingsBulkUpdateIfChanged($hash,"power".$subs,$power);
|
readingsBulkUpdateIfChanged($hash,"power".$subs,$power);
|
||||||
readingsBulkUpdateIfChanged($hash,"energy".$subs,$energy);
|
readingsBulkUpdateIfChanged($hash,"energy".$subs,$energy);
|
||||||
|
if ($model eq "shellyem") {
|
||||||
|
my $voltage = $jhash->{$metern}[$i]{'voltage'};
|
||||||
|
readingsBulkUpdateIfChanged($hash,'voltage'.$subs,$voltage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#-- we have a Shelly 2 roller type device
|
#-- we have a Shelly 2 roller type device
|
||||||
@ -1476,7 +1483,7 @@ sub Shelly_updown2($){
|
|||||||
<br />set the value of a configuration register</li>
|
<br />set the value of a configuration register</li>
|
||||||
<li>password <password><br>This is the only way to set the password for the Shelly web interface</li>
|
<li>password <password><br>This is the only way to set the password for the Shelly web interface</li>
|
||||||
</ul>
|
</ul>
|
||||||
For Shelly switching devices (model=shelly1|shelly1pm|shelly4|shellyplug or (model=shelly2/2.5 and mode=relay))
|
For Shelly switching devices (model=shelly1|shelly1pm|shelly4|shellyplug|shellyem or (model=shelly2/2.5 and mode=relay))
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<code>set <name> on|off|toggle [<channel>] </code>
|
<code>set <name> on|off|toggle [<channel>] </code>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user