2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

98_EDIPLUG:add attr readonly, fix attr interval, update command.ref

git-svn-id: https://svn.fhem.de/fhem/trunk@8072 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
wzut 2015-02-22 18:42:22 +00:00
parent 4acbc05ba6
commit 5841dcf806

View File

@ -26,6 +26,7 @@
# 2014-12-08 add schedule and list (Wzut) # 2014-12-08 add schedule and list (Wzut)
# 2014-12-09 add dellist (Wzut) # 2014-12-09 add dellist (Wzut)
# 2015-02-21 first svn version (Wzut) # 2015-02-21 first svn version (Wzut)
# 2015-02-22 add attr read-only, fix attr interval, update command.ref
# #
################################################################ ################################################################
@ -90,7 +91,7 @@ sub EDIPLUG_Initialize($)
$hash->{SetFn} = "EDIPLUG_Set"; $hash->{SetFn} = "EDIPLUG_Set";
$hash->{GetFn} = "EDIPLUG_Get"; $hash->{GetFn} = "EDIPLUG_Get";
$hash->{AttrFn} = "EDIPLUG_Attr"; $hash->{AttrFn} = "EDIPLUG_Attr";
$hash->{AttrList} = "interval timeout disable:0,1 model:SP1101W,SP2101W,unknow interval user password ".$readingFnAttributes; $hash->{AttrList} = "interval timeout disable:0,1 model:SP1101W,SP2101W,unknow read-only:0,1 user password ".$readingFnAttributes;
} }
@ -245,7 +246,7 @@ sub EDIPLUG_Read($$$)
readingsBulkUpdate($hash, "power_week", $xmlres->{CMD}->{NOW_POWER}->{'Device.System.Power.NowEnergy.Week'}." kW/h"); readingsBulkUpdate($hash, "power_week", $xmlres->{CMD}->{NOW_POWER}->{'Device.System.Power.NowEnergy.Week'}." kW/h");
readingsBulkUpdate($hash, "power_month", $xmlres->{CMD}->{NOW_POWER}->{'Device.System.Power.NowEnergy.Month'}." kW/h"); readingsBulkUpdate($hash, "power_month", $xmlres->{CMD}->{NOW_POWER}->{'Device.System.Power.NowEnergy.Month'}." kW/h");
$state = $hash->{POWER}." / ".$hash->{helper}{power}. " W / ".$hash->{helper}{current}." A"; $state = ($hash->{POWER} ne "OFF") ? $hash->{POWER}." / ".$hash->{helper}{power}. " W / ".$hash->{helper}{current}." A" : $hash->{POWER};
} }
@ -360,15 +361,17 @@ sub EDIPLUG_Attr(@)
sub EDIPLUG_Set($@) { sub EDIPLUG_Set($@) {
my ($hash, $name , @a) = @_; my ($hash, $name , @a) = @_;
my $cmd = $a[0];
return "set $name needs at least one argument" if(int(@a) < 1); return "set $name needs at least one argument" if(int(@a) < 1);
return ($cmd eq "?") ? undef : "no set commands are allowed on a read-only device !" if ($attr{$name}{'read-only'} eq "1");
my $cmd = $a[0];
my $list = "on off list addlist delete:0,1,2,3,4,5,6 dellist day clear_error"; my $list = "on off list addlist delete:0,1,2,3,4,5,6 dellist day clear_error";
return SetExtensions($hash, $list, $name, @a) if( $cmd eq "?" ); return SetExtensions($hash, $list, $name, @a) if( $cmd eq "?" );
return SetExtensions($hash, $list, $name, @a) if( !grep( $_ =~ /^$cmd($|:)/, split( ' ', $list))); return SetExtensions($hash, $list, $name, @a) if( !grep( $_ =~ /^$cmd($|:)/, split( ' ', $list)));
$hash->{timeout} = AttrVal($name, "timeout", 2); $hash->{timeout} = AttrVal($name, "timeout", 2);
my $oldcmd = $hash->{LASTCMD}; $hash->{LASTCMD}=""; my $oldcmd = $hash->{LASTCMD}; $hash->{LASTCMD}="";
@ -599,36 +602,35 @@ requires XML:Simple -> sudo apt-get install libxml-simple-perl<br>
<ul> <ul>
define &lt;name&gt; EDIPLUG &lt; IP_EDIMAX_Device (or FQDN) &gt;<br> define &lt;name&gt; EDIPLUG &lt; IP_EDIMAX_Device (or FQDN) &gt;<br>
Example:<br> Example:<br>
<pre> <li>define myediplug EDIPLUG 192.168.0.99</li>
define myediplug EDIPLUG 192.168.0.99 <li>define myediplug EDIPLUG ediplug.myhome.net</li>
define myediplug EDIPLUG ediplug.myhome.net
</pre>
</ul> </ul>
<a name="EDIPLUGset"></a> <a name="EDIPLUGset"></a>
<b>Set</b><ul> <b>Set</b>
Currently, the following commands are defined<br>&nbsp;<br><pre> <ul>
on => switch power on <li>on => switch power on</li>
off => switch power off <li>off => switch power off</li>
list => set a new list for one day with one entry : DayOfWeek(0-6) Starttime(hh:mm) Endtime(hh:mm) Command(on/off) e.g. 1 10:00 11:30 on <li>list => set a new list for one day with one entry : DayOfWeek(0-6) Starttime(hh:mm) Endtime(hh:mm) Command(on/off) e.g. 1 10:00 11:30 on</li>
addlist => add a new on/off time : DayOfWeek(0-6) Starttime(hh:mm) Endtime(hh:mm) Command(on/off) e.g. 1 10:00 11:30 on <li>addlist => add a new on/off time : DayOfWeek(0-6) Starttime(hh:mm) Endtime(hh:mm) Command(on/off) e.g. 1 10:00 11:30 on</li>
dellist => remove a existing on/off time : DayOfWeek(0-6) Starttime(hh:mm) Endtime(hh:mm) e.g. 1 10:00 11:30 <li>dellist => remove a existing on/off time : DayOfWeek(0-6) Starttime(hh:mm) Endtime(hh:mm) e.g. 1 10:00 11:30</li>
delete => delete timelist of one day : DayOfWeek(0-6) <li>delete => delete timelist of one day : DayOfWeek(0-6)</li>
day => enable/disable timeschedule for one day : DayOfWeek(0-6) on/off <li>day => enable/disable timeschedule for one day : DayOfWeek(0-6) on/off</li>
</pre>
</ul> </ul>
<a name="EDIPLUGget"></a> <a name="EDIPLUGget"></a>
<b>Get</b><ul> <b>Get</b><ul>
Currently, the following commands are defined<br>&nbsp;<br><pre> <li>info => shows MAC , Firmware Version , Model , Name</li>
info => shows MAC , Firmware Version , Model , Name <li>power => shows all Power informations ( model SP-2101W only)</li>
power => shows all Power informations ( model SP-2101W only) <li>schedule => show all internal on/off timetables</li>
schedule => show all internal on/off timetables <li>status => show on/off state</li>
status => show on/off state
</pre>
</ul> </ul>
<a name="EDIPLUGattr"></a> <a name="EDIPLUGattr"></a>
<b>Attributes</b> <b>Attributes</b>
<ul> <ul>
<li>interval , polling interval (default 60)</li> <li>interval => polling interval (default 60)</li>
<li>timeout => max. time to wait in seconds (default 2)</li>
<li>read-only => only read (Get) from device (default 0)</li>
<li>user => username (default admin)</li>
<li>password => password (default 1234)</li>
</ul> </ul>
<br> <br>
<b>Readings</b> <b>Readings</b>
@ -664,44 +666,41 @@ ben&oml;ntigt XML:Simple -> sudo apt-get install libxml-simple-perl
<a name="EDIPLUGdefine"></a> <a name="EDIPLUGdefine"></a>
<b>Define</b> <b>Define</b>
<ul> <ul>
define &lt;name&gt; EDIPLUG &lt; IP_des_EDIMAX (oder Name im Netz) INTERVAL (default 60) Device user (default admin) password (default 1234) &gt;<br> define &lt;name&gt; EDIPLUG IP_des_EDIPlug (oder FQDN Name)<br>
Beispiel:<br> Beispiel:<br>
<pre> <li>define myediplug EDIPLUG 192.168.0.99</li>
define myediplug EDIPLUG 192.168.0.99 <li>define myediplug EDIPLUG ediplug.fritz.box</li>
define myediplug EDIPLUG ediplug.meinnetz.net
</pre>
</ul> </ul>
<br> <br>
<a name="EDIPLUGset"></a> <a name="EDIPLUGset"></a>
<b>Set</b><ul> <b>Set</b>
zur Zeit werden folgende Kommandos unterst&uuml;tzt<br>&nbsp;<br><pre> <ul>
on => schalte an <li>on => schalte an</li>
off => schalte aus <li>off => schalte aus</li>
list => erzeugt eine neue Zeitplan Liste mit einem Eintrag : Wochentag(0-6) Startzeit(hh:mm) Endezeit(hh:mm) Kommando(on/off) Bsp. 1 10:00 11:30 on <li>list => erzeugt eine neue Zeitplan Liste mit einem Eintrag : Wochentag(0-6) Startzeit(hh:mm) Endezeit(hh:mm) Kommando(on/off) Bsp. 1 10:00 11:30 on</li>
addlist => f&uuml;gt eine neue Schaltzeit einer bestehenden Zeitplan Liste hinzu : Wochentag(0-6) Startzeit(hh:mm) Endtezeit(hh:mm) Kommando(on/off) Bsp. 1 10:00 11:30 on <li>addlist => f&uuml;gt eine neue Schaltzeit einer bestehenden Zeitplan Liste hinzu : Wochentag(0-6) Startzeit(hh:mm) Endtezeit(hh:mm) Kommando(on/off) Bsp. 1 10:00 11:30 on</li>
dellist => l&ouml;scht eine bestimmte Schaltzeit eines Tages : Wochentag(0-6) Startzeit(hh:mm) Endezeit(hh:mm) Bsp. 1 10:00 11:30 <li>dellist => l&ouml;scht eine bestimmte Schaltzeit eines Tages : Wochentag(0-6) Startzeit(hh:mm) Endezeit(hh:mm) Bsp. 1 10:00 11:30</li>
delete => l&ouml;scht die Liste eines ganzen Tages : Wochentag(0-6) <li>delete => l&ouml;scht die Liste eines ganzen Tages : Wochentag(0-6)</li>
day => schaltet die Zeitplanung eines Tages ein oder aus : Wochentag(0-6) on/off Bsp. 5 on <li>day => schaltet die Zeitplanung eines Tages ein oder aus : Wochentag(0-6) on/off Bsp. 5 on</li>
</pre>
</ul> </ul>
<br> <br>
<a name="EDIPLUGget"></a> <a name="EDIPLUGget"></a>
<b>Get</b><ul> <b>Get</b>
zur Zeit werden folgende Kommandos unterst&uuml;tzt<br>&nbsp;<br><pre> <ul>
info => Anzeige von MAC , Firmware Version , Modell , Name <li>info => Anzeige von MAC , Firmware Version , Modell , Name</li>
power => zeigt alle Stromverbrauchswerte ( nur Modell SP-2101W ) <li>power => zeigt alle Stromverbrauchswerte ( nur Modell SP-2101W )</li>
schedule => zeigt alle internen Schaltzeiten <li>schedule => zeigt alle internen Schaltzeiten (ACHTUNG : Firmware Version beachten !)</li>
status => zeigt an/aus Status der Schaltdose <li>status => zeigt an/aus Status der Schaltdose</li>
</pre>
</ul> </ul>
<br> <br>
<a name="EDIPLUGattr"></a> <a name="EDIPLUGattr"></a>
<b>Attributes</b> <b>Attributes</b>
<ul> <ul>
<li>interval , polling interval (default 60)</li> <li>interval => polling interval (default 60)</li>
<li>timeout , </li> <li>timeout => max. Wartezeit in Sekunden (default 2)</li>
<li>user , Username (default admin)</li> <li>read-only => es ist nur lesen (Get) erlaubt (default 0)</li>
<li>password , Passwort (default 1234)</li> <li>user => Username (default admin)</li>
<li>password => Passwort (default 1234)</li>
</ul> </ul>
<br> <br>
<b>Readings</b> <b>Readings</b>