2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 14:16:42 +00:00

55_weco.pm - some code cleanup

git-svn-id: https://svn.fhem.de/fhem/trunk@5515 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2014-04-12 22:32:18 +00:00
parent 05f0cc1aa2
commit 0c955f4876

View File

@ -40,17 +40,14 @@ use HttpUtils;
sub weco_Initialize($) { sub weco_Initialize($) {
my ($hash) = @_; my ($hash) = @_;
my $name = $hash->{NAME};
my $found;
$hash->{DefFn} = "weco_Define"; $hash->{DefFn} = "weco_Define";
$hash->{UndefFn} = "weco_Undef"; $hash->{UndefFn} = "weco_Undef";
$hash->{AttrList} = "disable:0,1 ". $hash->{AttrList} = "disable:1,0 ".
"wecoInterval:600,1800,3600 wecotest:true,false ". "wecoInterval:600,1800,3600 wecotest:true,false ".
"wecohu wecote wecodp wecopr wecopcv wecopcf wecowd wecows wecowsbft wecowg wecopa ". "wecohu wecote wecodp wecopr wecopcv wecopcf wecowd wecows wecowsbft wecowg wecopa ".
"wecopai wecopaest wecouv wecosd wecosc wecovi wecoch wecocm wecocl wecodc wecoww ". "wecopai wecopaest wecouv wecosd wecosc wecovi wecoch wecocm wecocl wecodc wecoww ".
$readingFnAttributes; $readingFnAttributes;
} }
sub weco_Define($$$) { sub weco_Define($$$) {
@ -102,8 +99,8 @@ sub weco_send($) {
$key = substr($key,4,length($key)-4); $key = substr($key,4,length($key)-4);
($d, $r, $o) = split(":", $value); ($d, $r, $o) = split(":", $value);
if(defined($r)) { if(defined($r)) {
$o = 0 if(!defined($o)); $o = (defined($o)) ? $o : 0;
$value = ReadingsVal($d, $r, "") + $o; $value = ReadingsVal($d, $r, 0) + $o;
} }
$data .= "&$key=$value"; $data .= "&$key=$value";
} }