2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 01:09:47 +00:00

Switch eliminated. Some perl implementations have problems with switch command.

git-svn-id: https://svn.fhem.de/fhem/trunk@827 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
wherzig 2011-02-05 20:25:37 +00:00
parent 805a00c61b
commit 8152274692

View File

@ -42,7 +42,6 @@ package main;
use strict;
use warnings;
use Switch;
my $time_old = 0;
@ -51,8 +50,8 @@ OREGON_Initialize($)
{
my ($hash) = @_;
#$hash->{Match} = "^[\x38-\x78].*";
$hash->{Match} = "^[^\x30]";
$hash->{Match} = "^[\x38-\x78].*";
#$hash->{Match} = "^[^\x30]";
$hash->{DefFn} = "OREGON_Define";
$hash->{UndefFn} = "OREGON_Undef";
$hash->{ParseFn} = "OREGON_Parse";
@ -805,8 +804,7 @@ OREGON_Parse($$)
foreach $i (@res){
#print "!> i=".$i."\n";
#printf "%s\t",$i->{device};
switch ($i->{type}) {
case "temp" {
if ($i->{type} eq "temp") {
#printf "Temperatur %2.1f %s ; ",$i->{current},$i->{units};
$val .= "T: ".$i->{current}." ";
@ -815,7 +813,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{current};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current};
}
case "humidity" {
elsif ($i->{type} eq "humidity") {
#printf "Luftfeuchtigkeit %d%s, %s ;",$i->{current},$i->{units},$i->{string};
$val .= "H: ".$i->{current}." ";
@ -824,7 +822,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{current};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current};;
}
case "battery" {
elsif ($i->{type} eq "battery") {
#printf "Batterie %d%s; ",$i->{current},$i->{units};
# do not add it due to problems with hms.gplot
#$val .= "Bat: ".$i->{current}." ";
@ -834,7 +832,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{current};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current};;
}
case "pressure" {
elsif ($i->{type} eq "pressure") {
#printf "Luftdruck %d %s, Vorhersage=%s ; ",$i->{current},$i->{units},$i->{forecast};
# do not add it due to problems with hms.gplot
#$val .= "P: ".$i->{current}." ";
@ -849,7 +847,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{forecast};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{forecast};;
}
case "speed" {
elsif ($i->{type} eq "speed") {
$val .= "W: ".$i->{current}." ";
$val .= "WA: ".$i->{average}." ";
@ -863,7 +861,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{average};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{average};;
}
case "direction" {
elsif ($i->{type} eq "direction") {
$val .= "WD: ".$i->{current}." ";
$val .= "WDN: ".$i->{string}." ";
@ -872,7 +870,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{current} . " " . $i->{string};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current} . " " . $i->{string};;
}
case "rain" {
elsif ($i->{type} eq "rain") {
$val .= "RR: ".$i->{current}." ";
$sensor = "rain_rate";
@ -880,7 +878,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{current};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current};;
}
case "train" {
elsif ($i->{type} eq "train") {
$val .= "TR: ".$i->{current}." ";
$sensor = "rain_total";
@ -888,7 +886,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{current};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current};;
}
case "flip" {
elsif ($i->{type} eq "flip") {
#$val .= "F: ".$i->{current}." ";
$sensor = "rain_flip";
@ -896,7 +894,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{current};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current};;
}
case "uv" {
elsif ($i->{type} eq "uv") {
$val .= "UV: ".$i->{current}." ";
$val .= "UVR: ".$i->{risk}." ";
@ -910,7 +908,7 @@ OREGON_Parse($$)
$def->{READINGS}{$sensor}{VAL} = $i->{risk};
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{risk};;
}
case "hexline" {
elsif ($i->{type} eq "hexline") {
$sensor = "hexline";
$def->{READINGS}{$sensor}{TIME} = $tm;
$def->{READINGS}{$sensor}{VAL} = $i->{current};
@ -922,7 +920,6 @@ OREGON_Parse($$)
print "Value: ".$i->{current}."\n";
}
}
}
if ("$val" ne "") {
# remove heading and trailing space chars from $val