diff --git a/fhem/FHEM/98_EDIPLUG.pm b/fhem/FHEM/98_EDIPLUG.pm
index 5223cfdfe..57c6771a0 100644
--- a/fhem/FHEM/98_EDIPLUG.pm
+++ b/fhem/FHEM/98_EDIPLUG.pm
@@ -1,6 +1,6 @@
################################################################
#
-# $Id: $
+# $Id:$
#
# (c) 2014 Copyright: Wzut based on 98_EDIPLUG.pm tre (ternst)
# All rights reserved
@@ -26,6 +26,7 @@
# 2014-12-08 add schedule and list (Wzut)
# 2014-12-09 add dellist (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->{GetFn} = "EDIPLUG_Get";
$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;
}
@@ -199,7 +200,7 @@ sub EDIPLUG_Read($$$)
readingsBeginUpdate($hash);
- # EDIPLUGs geben ein nichtgueltigen Zeichensatz zurueck ( UTF8 instead utf-8 )
+ # EDIPLUGs geben ein nicht gueltigen Zeichensatz zurueck ( UTF8 instead utf-8 )
$buffer =~s/UTF8/utf-8/g;
my $xmlres = XMLin($buffer);
@@ -244,8 +245,8 @@ sub EDIPLUG_Read($$$)
readingsBulkUpdate($hash, "power_day", $xmlres->{CMD}->{NOW_POWER}->{'Device.System.Power.NowEnergy.Day'}." 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");
-
- $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($@) {
my ($hash, $name , @a) = @_;
-
- return "set $name needs at least one argument" if(int(@a) < 1);
-
my $cmd = $a[0];
+
+ 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 $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( !grep( $_ =~ /^$cmd($|:)/, split( ' ', $list)));
+
$hash->{timeout} = AttrVal($name, "timeout", 2);
my $oldcmd = $hash->{LASTCMD}; $hash->{LASTCMD}="";
@@ -599,37 +602,36 @@ requires XML:Simple -> sudo apt-get install libxml-simple-perl
- define myediplug EDIPLUG 192.168.0.99 - define myediplug EDIPLUG ediplug.myhome.net -+
- on => switch power on - off => switch power off - 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 - 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 - dellist => remove a existing on/off time : DayOfWeek(0-6) Starttime(hh:mm) Endtime(hh:mm) e.g. 1 10:00 11:30 - delete => delete timelist of one day : DayOfWeek(0-6) - day => enable/disable timeschedule for one day : DayOfWeek(0-6) on/off -- + Set +
- info => shows MAC , Firmware Version , Model , Name - power => shows all Power informations ( model SP-2101W only) - schedule => show all internal on/off timetables - status => show on/off state -+
- define myediplug EDIPLUG 192.168.0.99 - define myediplug EDIPLUG ediplug.meinnetz.net -+
- on => schalte an - off => schalte aus - 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 - addlist => fü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 - dellist => löscht eine bestimmte Schaltzeit eines Tages : Wochentag(0-6) Startzeit(hh:mm) Endezeit(hh:mm) Bsp. 1 10:00 11:30 - delete => löscht die Liste eines ganzen Tages : Wochentag(0-6) - day => schaltet die Zeitplanung eines Tages ein oder aus : Wochentag(0-6) on/off Bsp. 5 on -- + Set +
- info => Anzeige von MAC , Firmware Version , Modell , Name - power => zeigt alle Stromverbrauchswerte ( nur Modell SP-2101W ) - schedule => zeigt alle internen Schaltzeiten - status => zeigt an/aus Status der Schaltdose -+ Get +