mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 08:03:40 +00:00
See the changes file
git-svn-id: https://svn.fhem.de/fhem/trunk@284 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1a16f8b12a
commit
873ccc570c
@ -1,12 +1,12 @@
|
|||||||
- 2005-10-27 (1.3)
|
- 2005-10-27 (1.3)
|
||||||
- Bugfix: multiple at commands at the same time.</pre>
|
- Bugfix: multiple at commands at the same time.
|
||||||
|
|
||||||
- 2005-11-10 (1.4)
|
- 2005-11-10 (1.4)
|
||||||
- Reformatting the package and the documentation
|
- Reformatting the package and the documentation
|
||||||
- New links
|
- New links
|
||||||
|
|
||||||
- 2005-12-26 (1.5)
|
- 2005-12-26 (1.5)
|
||||||
- "modularized" in preparation for the FHZ80B -> each device has a type
|
- "modularized" in preparation for the FHT80B -> each device has a type
|
||||||
- added relative "at" commands (with +HH:MM:SS)
|
- added relative "at" commands (with +HH:MM:SS)
|
||||||
- multiple commands on one line separated with ;
|
- multiple commands on one line separated with ;
|
||||||
- sleeping 0.22 seconds after an ST command
|
- sleeping 0.22 seconds after an ST command
|
||||||
@ -450,9 +450,11 @@
|
|||||||
- feature: CUL / CUL_EM / CUL_WS documentation
|
- feature: CUL / CUL_EM / CUL_WS documentation
|
||||||
- feature: do not block fhem when the CUR is disconnected
|
- feature: do not block fhem when the CUR is disconnected
|
||||||
- bugfix: correct correction factors for EMEM in 15_CUL_EM.pm
|
- bugfix: correct correction factors for EMEM in 15_CUL_EM.pm
|
||||||
|
- bugfix: more stable CUL initialization
|
||||||
- feature: reworked 15_CUL_EM.pm to account for timer wraparounds, more
|
- feature: reworked 15_CUL_EM.pm to account for timer wraparounds, more
|
||||||
readings added
|
readings added
|
||||||
- feature: speed gain through disabled refreshvalues query to all FHTs at
|
- feature: speed gain through disabled refreshvalues query to all FHTs at
|
||||||
definition; if you want it back at a "set myFHT report1 255
|
definition; if you want it back at a "set myFHT report1 255
|
||||||
report2 255" command to the config file.
|
report2 255" command to the config file.
|
||||||
|
- feature: fhem commands may be added in modules. XmlList is external now.
|
||||||
|
- bugfix: rereadcfg from webpgm2 does not crash fhem.pl
|
||||||
|
@ -208,7 +208,8 @@ CM11_Undef($$)
|
|||||||
defined($defs{$d}{IODev}) &&
|
defined($defs{$d}{IODev}) &&
|
||||||
$defs{$d}{IODev} == $hash)
|
$defs{$d}{IODev} == $hash)
|
||||||
{
|
{
|
||||||
Log GetLogLevel($name,2), "deleting port for $d";
|
my $lev = ($reread_active ? 4 : 2);
|
||||||
|
Log GetLogLevel($name,$lev), "deleting port for $d";
|
||||||
delete $defs{$d}{IODev};
|
delete $defs{$d}{IODev};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,8 @@ CUL_Undef($$)
|
|||||||
defined($defs{$d}{IODev}) &&
|
defined($defs{$d}{IODev}) &&
|
||||||
$defs{$d}{IODev} == $hash)
|
$defs{$d}{IODev} == $hash)
|
||||||
{
|
{
|
||||||
Log GetLogLevel($name,2), "deleting port for $d";
|
my $lev = ($reread_active ? 4 : 2);
|
||||||
|
Log GetLogLevel($name,$lev), "deleting port for $d";
|
||||||
delete $defs{$d}{IODev};
|
delete $defs{$d}{IODev};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,7 +198,7 @@ GOTBW:
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
return "Expecting a 0-padded hex number"
|
return "Expecting a 0-padded hex number"
|
||||||
if((length($arg)&1) == 1 && $type ne "raw");
|
if((length($arg)&1) == 0 && $type ne "raw");
|
||||||
$initstr = "X$arg" if($type eq "verbose");
|
$initstr = "X$arg" if($type eq "verbose");
|
||||||
Log GetLogLevel($name,4), "set $name $type $arg";
|
Log GetLogLevel($name,4), "set $name $type $arg";
|
||||||
CUL_Write($hash, $sets{$type}, $arg);
|
CUL_Write($hash, $sets{$type}, $arg);
|
||||||
@ -409,21 +410,21 @@ CUL_Write($$$)
|
|||||||
my $bstring = "$fn$msg\n";
|
my $bstring = "$fn$msg\n";
|
||||||
|
|
||||||
if($fn eq "F") {
|
if($fn eq "F") {
|
||||||
if(!$hash->{QUEUECNT}) {
|
|
||||||
CUL_XmitLimitCheck($hash, $bstring);
|
if(!$hash->{QUEUE}) {
|
||||||
|
|
||||||
|
CUL_XmitLimitCheck($hash,$bstring);
|
||||||
|
$hash->{QUEUE} = [ $bstring ];
|
||||||
$hash->{PortObj}->write($bstring);
|
$hash->{PortObj}->write($bstring);
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# Write the next buffer not earlier than 0.227 seconds (= 65.6ms + 10ms +
|
# Write the next buffer not earlier than 0.22 seconds (= 65.6ms + 10ms +
|
||||||
# 65.6ms + 10ms + 65.6ms + 10ms)
|
# 65.6ms + 10ms + 65.6ms), else it will be discarded by the FHZ1X00 PC
|
||||||
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
|
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
|
||||||
|
|
||||||
} elsif($hash->{QUEUECNT} == 1) {
|
|
||||||
$hash->{QUEUE} = [ $bstring ];
|
|
||||||
} else {
|
} else {
|
||||||
push(@{$hash->{QUEUE}}, $bstring);
|
push(@{$hash->{QUEUE}}, $bstring);
|
||||||
}
|
}
|
||||||
$hash->{QUEUECNT}++;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -438,14 +439,18 @@ sub
|
|||||||
CUL_HandleWriteQueue($)
|
CUL_HandleWriteQueue($)
|
||||||
{
|
{
|
||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
if($hash->{QUEUECNT} > 0) {
|
my $arr = $hash->{QUEUE};
|
||||||
$hash->{QUEUECNT}--;
|
|
||||||
my $bstring = shift(@{$hash->{QUEUE}});
|
if(defined($arr) && @{$arr} > 0) {
|
||||||
if(defined($bstring)) {
|
shift(@{$arr});
|
||||||
CUL_XmitLimitCheck($hash,$bstring);
|
if(@{$arr} == 0) {
|
||||||
$hash->{PortObj}->write($bstring);
|
delete($hash->{QUEUE});
|
||||||
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
|
return;
|
||||||
}
|
}
|
||||||
|
my $bstring = $arr->[0];
|
||||||
|
CUL_XmitLimitCheck($hash,$bstring);
|
||||||
|
$hash->{PortObj}->write($bstring);
|
||||||
|
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,8 @@ FHZ_Undef($$)
|
|||||||
defined($defs{$d}{IODev}) &&
|
defined($defs{$d}{IODev}) &&
|
||||||
$defs{$d}{IODev} == $hash)
|
$defs{$d}{IODev} == $hash)
|
||||||
{
|
{
|
||||||
Log GetLogLevel($name,2), "deleting port for $d";
|
my $lev = ($reread_active ? 4 : 2);
|
||||||
|
Log GetLogLevel($name,$lev), "deleting port for $d";
|
||||||
delete $defs{$d}{IODev};
|
delete $defs{$d}{IODev};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,8 @@ CUL_WS_Parse($$)
|
|||||||
|
|
||||||
my $firstbyte = hex($a[1]);
|
my $firstbyte = hex($a[1]);
|
||||||
my $cde = ($firstbyte&7) + 1;
|
my $cde = ($firstbyte&7) + 1;
|
||||||
|
|
||||||
my $type = $tlist{$a[2]} ? $tlist{$a[2]} : "unknown";
|
my $type = $tlist{$a[2]} ? $tlist{$a[2]} : "unknown";
|
||||||
|
|
||||||
if(!$defptr{$cde}) {
|
if(!$defptr{$cde}) {
|
||||||
Log 1, "CUL_WS UNDEFINED $type sensor detected, code $cde";
|
Log 1, "CUL_WS UNDEFINED $type sensor detected, code $cde";
|
||||||
return "UNDEFINED CUL_WS: $cde";
|
return "UNDEFINED CUL_WS: $cde";
|
||||||
@ -87,78 +87,110 @@ CUL_WS_Parse($$)
|
|||||||
|
|
||||||
$hash = $defptr{$cde};
|
$hash = $defptr{$cde};
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
my $typbyte = hex($a[2]) & 7;
|
||||||
|
my $sfirstbyte = $firstbyte & 7;
|
||||||
my $val = "";
|
my $val = "";
|
||||||
|
my $devtype = "unknown";
|
||||||
|
|
||||||
if(@a == 5) { # 433MHz RainSensor
|
if($sfirstbyte == 7) {
|
||||||
|
|
||||||
my $c = $hash->{corr1} ? $hash->{corr1} : 1;
|
|
||||||
$val = "R: " . (hex($a[5].$a[2].$a[3]) * $c);
|
|
||||||
|
|
||||||
} elsif(@a == 9) { # S300TH
|
|
||||||
|
|
||||||
my $sgn = ($firstbyte&8) ? -1 : 1;
|
|
||||||
my $tmp = $sgn * ($a[6].$a[3].".".$a[4]) + $hash->{corr1};
|
|
||||||
my $hum = ($a[7].$a[8].".".$a[5]) + $hash->{corr2};
|
|
||||||
$val = "T: $tmp H: $hum";
|
|
||||||
|
|
||||||
} elsif(@a == 13) { # WS7000 sensors
|
|
||||||
|
|
||||||
|
|
||||||
if($type eq "brightness") {
|
if($typbyte == 0) {
|
||||||
|
my $sgn = ($firstbyte&8) ? -1 : 1;
|
||||||
|
my $tmp = $sgn * ($a[6].$a[3].".".$a[4]) + $hash->{corr1};
|
||||||
|
$val = "T: $tmp";
|
||||||
|
$devtype = "CUL_WS WS7000 Temp";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
# TODO
|
if($typbyte == 1) {
|
||||||
my $br = hex($a[3].$a[4].$a[5].$a[6]) + $hash->{corr1};
|
my $sgn = ($firstbyte&8) ? -1 : 1;
|
||||||
|
my $tmp = $sgn * ($a[6].$a[3].".".$a[4]) + $hash->{corr1};
|
||||||
|
my $hum = ($a[7].$a[8].".".$a[5]) + $hash->{corr2};
|
||||||
|
$val = "T: $tmp H: $hum";
|
||||||
|
$devtype = "CUL_WS WS7000 Temp/Hum";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($typbyte == 2) {
|
||||||
|
#my $more = ($firstbyte&8) ? 0 : 1000;
|
||||||
|
my $c = $hash->{corr1} ? $hash->{corr1} : 1;
|
||||||
|
my $hexcount = hex($a[5].$a[3].$a[4]) + $c;
|
||||||
|
$val = "R: $hexcount";
|
||||||
|
$devtype = "CUL_WS WS7000 Rain";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($typbyte == 3) {
|
||||||
|
my $hun = ($firstbyte&8) ? 100 : 0;
|
||||||
|
my $speed = ($a[6].$a[3].".".$a[4])+$hun;
|
||||||
|
my $dir = (($a[7]&3).$a[8].$a[5])+0;
|
||||||
|
my $swing = ($a[7]&6) >> 2;
|
||||||
|
$val = "W: $speed D: $dir A: $swing";
|
||||||
|
$devtype = "CUL_WS WS7000 Wind";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($typbyte == 4) {
|
||||||
|
my $sgn = ($firstbyte&8) ? -1 : 1;
|
||||||
|
my $tmp = $sgn * ($a[6].$a[3].".".$a[4]) + $hash->{corr1};
|
||||||
|
my $hum = ($a[7].$a[8].".".$a[5]) + $hash->{corr2};
|
||||||
|
my $prs = ($a[9].$a[10])+ 900 + $hash->{corr3};
|
||||||
|
if ($prs < 930) {
|
||||||
|
$prs = $prs + 100;
|
||||||
|
}
|
||||||
|
if(@a == 13) {
|
||||||
|
$val = "T: $tmp H: $hum P: $prs";
|
||||||
|
} else {
|
||||||
|
$val = "T: $tmp H: $hum P: $prs lenerr";
|
||||||
|
}
|
||||||
|
$devtype = "CUL_WS WS7000 Indoor";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($typbyte == 5) {
|
||||||
|
my $fakt = 1;
|
||||||
|
my $rawfakt = ($a[5])+0;
|
||||||
|
if($rawfakt == 1) { $fakt = 10; }
|
||||||
|
if($rawfakt == 2) { $fakt = 100; }
|
||||||
|
if($rawfakt == 3) { $fakt = 1000; }
|
||||||
|
|
||||||
|
my $br = (hex($a[5].$a[4].$a[3])*$fakt) + $hash->{corr1};
|
||||||
$val = "B: $br";
|
$val = "B: $br";
|
||||||
|
$devtype = "CUL_WS WS7000 Brightness";
|
||||||
|
}
|
||||||
|
|
||||||
} elsif($type eq "temp/hum/press") {
|
if($typbyte == 6) { #wurde nie gebaut
|
||||||
|
$devtype = "CUL_WS WS7000 Pyro";
|
||||||
|
}
|
||||||
|
if($typbyte == 7) {
|
||||||
|
$devtype = "CUL_WS unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(@a == 9) { # S300TH
|
||||||
|
|
||||||
my $sgn = ($firstbyte&8) ? -1 : 1;
|
my $sgn = ($firstbyte&8) ? -1 : 1;
|
||||||
my $tmp = $sgn * ($a[6].$a[3].".".$a[4]) + $hash->{corr1};
|
my $tmp = $sgn * ($a[6].$a[3].".".$a[4]) + $hash->{corr1};
|
||||||
my $hum = ($a[7].$a[8].".".$a[5]) + $hash->{corr2};
|
my $hum = ($a[7].$a[8].".".$a[5]) + $hash->{corr2};
|
||||||
my $prs = ($a[9].$a[10].".".$a[11]) + $hash->{corr3};
|
$val = "T: $tmp H: $hum";
|
||||||
$val = "T: $tmp H: $hum P: $prs";
|
$devtype = "S300TH";
|
||||||
|
|
||||||
} elsif($type eq "wind") {
|
} elsif(@a == 15) { # KS300/2
|
||||||
|
|
||||||
# TODO
|
my $c = $hash->{corr4} ? $hash->{corr4} : 255;
|
||||||
my $wnd = hex($a[3].$a[4].$a[5].$a[6]) + $hash->{corr1};
|
my $rain = sprintf("%0.1f", hex("$a[14]$a[11]$a[12]") * $c / 1000);
|
||||||
$val = "W: $wnd";
|
my $wnd = sprintf("%0.1f", "$a[9]$a[10].$a[7]" + $hash->{corr3});
|
||||||
|
my $hum = sprintf( "%02d", "$a[8]$a[5]" + $hash->{corr2});
|
||||||
} elsif($type eq "rain") {
|
my $tmp = sprintf("%0.1f", ("$a[6]$a[3].$a[4]"+$hash->{corr1}) *
|
||||||
|
|
||||||
# TODO
|
|
||||||
my $c = $hash->{corr1} ? $hash->{corr1} : 1;
|
|
||||||
my $rain = hex($a[3].$a[4].$a[5].$a[6]) * $c;
|
|
||||||
$val = "R: $rain";
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
Log 1, "CUL_WS UNKNOWN sensor detected, $msg";
|
|
||||||
return "UNKNOWN CUL_WS: $cde";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} elsif(@a == 15) { # KS300/2
|
|
||||||
|
|
||||||
my $c = $hash->{corr4} ? $hash->{corr4} : 255;
|
|
||||||
my $rain = sprintf("%0.1f", hex("$a[14]$a[11]$a[12]") * $c / 1000);
|
|
||||||
my $wnd = sprintf("%0.1f", "$a[9]$a[10].$a[7]" + $hash->{corr3});
|
|
||||||
my $hum = sprintf( "%02d", "$a[8]$a[5]" + $hash->{corr2});
|
|
||||||
my $tmp = sprintf("%0.1f", ("$a[6]$a[3].$a[4]"+$hash->{corr1}) *
|
|
||||||
(($a[3] & 8) ? -1 : 1));
|
(($a[3] & 8) ? -1 : 1));
|
||||||
my $ir = ((hex($a[1]) & 0x2)) ? "yes" : "no";
|
my $ir = ((hex($a[1]) & 0x2)) ? "yes" : "no";
|
||||||
|
|
||||||
$val = "T: $tmp H: $hum W: $wnd R: $rain IR: $ir";
|
$val = "T: $tmp H: $hum W: $wnd R: $rain IR: $ir";
|
||||||
|
$devtype = "KS300/2";
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
|
||||||
Log 1, "CUL_WS UNKNOWN sensor detected, $msg";
|
|
||||||
return "UNKNOWN CUL_WS: $cde";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log GetLogLevel($name,4), "CUL_WS $name: $val";
|
Log GetLogLevel($name,4), "CUL_WS $devtype sensor $name: $val";
|
||||||
|
|
||||||
$hash->{STATE} = $val; # List overview
|
$hash->{STATE} = $val; # List overview
|
||||||
$hash->{READINGS}{state}{TIME} = TimeNow(); # For list
|
$hash->{READINGS}{state}{TIME} = TimeNow(); # For list
|
||||||
|
@ -30,7 +30,7 @@ CUL_EM_Define($$)
|
|||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
|
|
||||||
return "wrong syntax: define <name> CUL_EM <code> [corr1 corr2]"
|
return "wrong syntax: define <name> CUL_EM <code> [corr1 corr2]"
|
||||||
if(int(@a) != 3 && int(@a) != 5);
|
if(int(@a) < 3 || int(@a) > 5);
|
||||||
return "Define $a[0]: wrong CODE format: valid is 1-12"
|
return "Define $a[0]: wrong CODE format: valid is 1-12"
|
||||||
if($a[2] !~ m/^\d$/ || $a[2] < 1 || $a[2] > 12);
|
if($a[2] !~ m/^\d$/ || $a[2] < 1 || $a[2] > 12);
|
||||||
|
|
||||||
@ -45,11 +45,11 @@ CUL_EM_Define($$)
|
|||||||
# corr1 is the correction factor for power
|
# corr1 is the correction factor for power
|
||||||
$hash->{corr1} = (int(@a) > 3 ? $a[3] : 0.01);
|
$hash->{corr1} = (int(@a) > 3 ? $a[3] : 0.01);
|
||||||
# corr2 is the correction factor for energy
|
# corr2 is the correction factor for energy
|
||||||
$hash->{corr2} = (int(@a) > 3 ? $a[4] : 0.001);
|
$hash->{corr2} = (int(@a) > 4 ? $a[4] : 0.001);
|
||||||
|
|
||||||
} elsif($a[2] >= 9 && $a[2] <= 12) { # EMGZ: 0.01
|
} elsif($a[2] >= 9 && $a[2] <= 12) { # EMGZ: 0.01
|
||||||
$hash->{corr1} = (int(@a) > 3 ? $a[3] : 0.01);
|
$hash->{corr1} = (int(@a) > 3 ? $a[3] : 0.01);
|
||||||
$hash->{corr2} = (int(@a) > 3 ? $a[4] : 0.01);
|
$hash->{corr2} = (int(@a) > 4 ? $a[4] : 0.01);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$hash->{corr1} = 1;
|
$hash->{corr1} = 1;
|
||||||
|
@ -85,7 +85,8 @@ EM_Undef($$)
|
|||||||
defined($defs{$d}{IODev}) &&
|
defined($defs{$d}{IODev}) &&
|
||||||
$defs{$d}{IODev} == $hash)
|
$defs{$d}{IODev} == $hash)
|
||||||
{
|
{
|
||||||
Log GetLogLevel($name,2), "deleting port for $d";
|
my $lev = ($reread_active ? 4 : 2);
|
||||||
|
Log GetLogLevel($name, $lev), "deleting port for $d";
|
||||||
delete $defs{$d}{IODev};
|
delete $defs{$d}{IODev};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,8 @@ M232_Undef($$)
|
|||||||
defined($defs{$d}{IODev}) &&
|
defined($defs{$d}{IODev}) &&
|
||||||
$defs{$d}{IODev} == $hash)
|
$defs{$d}{IODev} == $hash)
|
||||||
{
|
{
|
||||||
Log GetLogLevel($name,2), "deleting port for $d";
|
my $lev = ($reread_active ? 4 : 2);
|
||||||
|
Log GetLogLevel($name,$lev), "deleting port for $d";
|
||||||
delete $defs{$d}{IODev};
|
delete $defs{$d}{IODev};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,3 +349,9 @@
|
|||||||
- speed gain through disabled refreshvalues query to all FHTs at definition;
|
- speed gain through disabled refreshvalues query to all FHTs at definition;
|
||||||
if you want it back at a "set myFHT report1 255 report2 255" command to the
|
if you want it back at a "set myFHT report1 255 report2 255" command to the
|
||||||
config file.
|
config file.
|
||||||
|
|
||||||
|
- Mon Dec 8 21:26 MET 2008 (Rudi)
|
||||||
|
- Modules can now modify the cmds hash, i.e. modules can add / overwrite /
|
||||||
|
delete internal fhem commands. See 99_XmlList.pm for an example. Since this
|
||||||
|
modules is called 99_xxx, it will be always loaded, but user of webpgm2 do
|
||||||
|
not need it.
|
||||||
|
@ -59,7 +59,6 @@
|
|||||||
<a href="#EMWZ">EMWZ</a>
|
<a href="#EMWZ">EMWZ</a>
|
||||||
<a href="#FHT">FHT</a>
|
<a href="#FHT">FHT</a>
|
||||||
<a href="#FHZ">FHZ</a>
|
<a href="#FHZ">FHZ</a>
|
||||||
<a href="#FS10">FS10</a>
|
|
||||||
<a href="#FS20">FS20</a>
|
<a href="#FS20">FS20</a>
|
||||||
<a href="#HMS">HMS</a>
|
<a href="#HMS">HMS</a>
|
||||||
<a href="#FHEMWEB">FHEMWEB</a>
|
<a href="#FHEMWEB">FHEMWEB</a>
|
||||||
@ -2353,26 +2352,6 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="FS10"></a>
|
|
||||||
<h3>FS10</h3>
|
|
||||||
<ul>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<b>Define</b> <ul>N/A</ul><br>
|
|
||||||
|
|
||||||
<b>Set </b> <ul>N/A</ul><br>
|
|
||||||
|
|
||||||
<b>Get</b> <ul>N/A</ul><br>
|
|
||||||
|
|
||||||
<b>Attributes</b>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#loglevel">loglevel</a></li>
|
|
||||||
<li><a href="#model">model</a> (FS10)</li>
|
|
||||||
</ul>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<a name="WS2000"></a>
|
<a name="WS2000"></a>
|
||||||
<h3>WS2000</h3>
|
<h3>WS2000</h3>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Common part
|
# Common part
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /tmp/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath . # where our FHEM directory is
|
attr global modpath /tmp/fhem/fhem # where our FHEM directory is
|
||||||
|
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||||
|
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
|
|
||||||
# Common part
|
# Common part
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /tmp/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity
|
attr global verbose 3 # "normal" verbosity
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath . # where our FHEM directory is
|
attr global modpath /tmp/fhem/fhem # where our FHEM directory is
|
||||||
|
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
# After about 5-10 minutes, check if "list wz" returns something meaningful
|
# After about 5-10 minutes, check if "list wz" returns something meaningful
|
||||||
#
|
#
|
||||||
|
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /tmp/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity
|
attr global verbose 3 # "normal" verbosity
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath . # where our FHEM directory is
|
attr global modpath /tmp/fhem/fhem # where our FHEM directory is
|
||||||
|
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||||
|
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
# contrib/91_DbLog.pm
|
# contrib/91_DbLog.pm
|
||||||
#
|
#
|
||||||
|
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /tmp/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity
|
attr global verbose 3 # "normal" verbosity
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath . # where our FHEM directory is
|
attr global modpath /tmp/fhem/fhem # where our FHEM directory is
|
||||||
|
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
# if there is no definition for it. Check the commandref.html define, Type HMS
|
# if there is no definition for it. Check the commandref.html define, Type HMS
|
||||||
# section for details
|
# section for details
|
||||||
|
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /tmp/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath . # where our FHEM directory is
|
attr global modpath /tmp/fhem/fhem # where our FHEM directory is
|
||||||
|
|
||||||
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
define FHZ FHZ /dev/tts/USB0 # the serial port of an FHZ 1000 PC
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#
|
#
|
||||||
# Minimalistic fhem.pl configfile. Take a look at the other examples for more.
|
# Minimalistic fhem.pl configfile. Take a look at the other examples for more.
|
||||||
#
|
#
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /tmp/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath . # where our FHEM directory is
|
attr global modpath /tmp/fhem/fhem # where our FHEM directory is
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
# Minimalistic fhem.pl & pgm2 configfile. Take a look at the other examples for
|
# Minimalistic fhem.pl & pgm2 configfile. Take a look at the other examples for
|
||||||
# more.
|
# more.
|
||||||
#
|
#
|
||||||
attr global logfile /tmp/fhem-%Y-%m.log
|
attr global logfile /tmp/fhem/fhem-%Y-%m.log
|
||||||
attr global statefile /tmp/fhem.save # where to save the state of the devices
|
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
|
||||||
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
attr global verbose 3 # "normal" verbosity (min 1, max 5)
|
||||||
attr global port 7072 # our TCP/IP port (localhost only)
|
attr global port 7072 # our TCP/IP port (localhost only)
|
||||||
attr global modpath . # where our FHEM directory is
|
attr global modpath /tmp/fhem/fhem # where our FHEM directory is
|
||||||
|
|
||||||
define WEB FHEMWEB 8083
|
define WEB FHEMWEB 8083
|
||||||
attr WEB plotmode SVG
|
attr WEB plotmode SVG
|
||||||
|
|
||||||
# Fake logfile, to access the global log
|
# Fake logfile, to access the global log
|
||||||
define Logfile FileLog /tmp/fhem-%Y-%m.log fakelog
|
define Logfile FileLog /tmp/fhem/fhem-%Y-%m.log fakelog
|
||||||
|
107
fhem/fhem.pl
107
fhem/fhem.pl
@ -4,7 +4,8 @@
|
|||||||
#
|
#
|
||||||
# Copyright notice
|
# Copyright notice
|
||||||
#
|
#
|
||||||
# (c) 2005 Copyright: Rudolf Koenig (r dot koenig at koeniglich dot de)
|
# (c) 2005-2008
|
||||||
|
# Copyright: Rudolf Koenig (r dot koenig at koeniglich dot de)
|
||||||
# All rights reserved
|
# All rights reserved
|
||||||
#
|
#
|
||||||
# This script free software; you can redistribute it and/or modify
|
# This script free software; you can redistribute it and/or modify
|
||||||
@ -48,7 +49,6 @@ sub DoClose($);
|
|||||||
sub FmtDateTime($);
|
sub FmtDateTime($);
|
||||||
sub FmtTime($);
|
sub FmtTime($);
|
||||||
sub GetLogLevel(@);
|
sub GetLogLevel(@);
|
||||||
sub GlobalAttr($$);
|
|
||||||
sub GetTimeSpec($);
|
sub GetTimeSpec($);
|
||||||
sub HandleArchiving($);
|
sub HandleArchiving($);
|
||||||
sub HandleTimeout();
|
sub HandleTimeout();
|
||||||
@ -89,7 +89,6 @@ sub CommandSet($$);
|
|||||||
sub CommandSetstate($$);
|
sub CommandSetstate($$);
|
||||||
sub CommandSleep($$);
|
sub CommandSleep($$);
|
||||||
sub CommandShutdown($$);
|
sub CommandShutdown($$);
|
||||||
sub CommandXmlList($$);
|
|
||||||
sub CommandTrigger($$);
|
sub CommandTrigger($$);
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
@ -131,7 +130,9 @@ use vars qw(%value); # Current values, see commandref.html
|
|||||||
use vars qw(%oldvalue); # Old values, see commandref.html
|
use vars qw(%oldvalue); # Old values, see commandref.html
|
||||||
use vars qw($init_done); #
|
use vars qw($init_done); #
|
||||||
use vars qw($internal_data); #
|
use vars qw($internal_data); #
|
||||||
|
use vars qw(%cmds); # Global command name hash. To be expanded
|
||||||
|
|
||||||
|
use vars qw($reread_active);
|
||||||
|
|
||||||
my $server; # Server socket
|
my $server; # Server socket
|
||||||
my $currlogfile; # logfile, without wildcards
|
my $currlogfile; # logfile, without wildcards
|
||||||
@ -146,9 +147,8 @@ my %defaultattr; # Default attributes
|
|||||||
my %intAt; # Internal at timer hash.
|
my %intAt; # Internal at timer hash.
|
||||||
my $nextat; # Time when next timer will be triggered.
|
my $nextat; # Time when next timer will be triggered.
|
||||||
my $intAtCnt=0;
|
my $intAtCnt=0;
|
||||||
my $reread_active = 0;
|
|
||||||
my $AttrList = "room comment";
|
my $AttrList = "room comment";
|
||||||
my $cvsid = '$Id: fhem.pl,v 1.58 2008-12-03 16:42:48 rudolfkoenig Exp $';
|
my $cvsid = '$Id: fhem.pl,v 1.59 2008-12-09 14:12:40 rudolfkoenig Exp $';
|
||||||
my $namedef =
|
my $namedef =
|
||||||
"where <name> is either:\n" .
|
"where <name> is either:\n" .
|
||||||
"- a single device name\n" .
|
"- a single device name\n" .
|
||||||
@ -165,9 +165,10 @@ $modules{_internal_}{AttrList} =
|
|||||||
"archivecmd allowfrom archivedir configfile lastinclude logfile " .
|
"archivecmd allowfrom archivedir configfile lastinclude logfile " .
|
||||||
"modpath nrarchive pidfilename port statefile title userattr " .
|
"modpath nrarchive pidfilename port statefile title userattr " .
|
||||||
"verbose:1,2,3,4,5 mseclog version nofork";
|
"verbose:1,2,3,4,5 mseclog version nofork";
|
||||||
|
$modules{_internal_}{AttrFn} = "GlobalAttr";
|
||||||
|
|
||||||
|
|
||||||
my %cmds = (
|
%cmds = (
|
||||||
"?" => { Fn=>"CommandHelp",
|
"?" => { Fn=>"CommandHelp",
|
||||||
Hlp=>",get this help" },
|
Hlp=>",get this help" },
|
||||||
"attr" => { Fn=>"CommandAttr",
|
"attr" => { Fn=>"CommandAttr",
|
||||||
@ -212,8 +213,6 @@ my %cmds = (
|
|||||||
Hlp=>"<sec>,sleep for sec, 3 decimal places" },
|
Hlp=>"<sec>,sleep for sec, 3 decimal places" },
|
||||||
"trigger" => { Fn=>"CommandTrigger",
|
"trigger" => { Fn=>"CommandTrigger",
|
||||||
Hlp=>"<devspec> <state>,trigger notify command" },
|
Hlp=>"<devspec> <state>,trigger notify command" },
|
||||||
"xmllist" => { Fn=>"CommandXmlList",
|
|
||||||
Hlp=>",list definitions and status info as xml" },
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -721,6 +720,8 @@ CommandRereadCfg($$)
|
|||||||
|
|
||||||
WriteStatefile();
|
WriteStatefile();
|
||||||
|
|
||||||
|
$reread_active=1;
|
||||||
|
|
||||||
foreach my $d (keys %defs) {
|
foreach my $d (keys %defs) {
|
||||||
my $ret = CallFn($d, "UndefFn", $defs{$d}, $d);
|
my $ret = CallFn($d, "UndefFn", $defs{$d}, $d);
|
||||||
return $ret if($ret);
|
return $ret if($ret);
|
||||||
@ -729,11 +730,11 @@ CommandRereadCfg($$)
|
|||||||
my $cfgfile = $attr{global}{configfile};
|
my $cfgfile = $attr{global}{configfile};
|
||||||
%defs = ();
|
%defs = ();
|
||||||
%attr = ();
|
%attr = ();
|
||||||
|
%selectlist = ();
|
||||||
|
%readyfnlist = ();
|
||||||
|
|
||||||
doGlobalDef($cfgfile);
|
doGlobalDef($cfgfile);
|
||||||
|
|
||||||
|
|
||||||
$reread_active=1;
|
|
||||||
|
|
||||||
my $ret = CommandInclude($cl, $cfgfile);
|
my $ret = CommandInclude($cl, $cfgfile);
|
||||||
if(!$ret && $attr{global}{statefile} && -r $attr{global}{statefile}) {
|
if(!$ret && $attr{global}{statefile} && -r $attr{global}{statefile}) {
|
||||||
$ret = CommandInclude($cl, $attr{global}{statefile});
|
$ret = CommandInclude($cl, $attr{global}{statefile});
|
||||||
@ -1061,7 +1062,6 @@ sub
|
|||||||
CommandDelete($$)
|
CommandDelete($$)
|
||||||
{
|
{
|
||||||
my ($cl, $def) = @_;
|
my ($cl, $def) = @_;
|
||||||
|
|
||||||
return "Usage: delete <name>$namedef\n" if(!$def);
|
return "Usage: delete <name>$namedef\n" if(!$def);
|
||||||
|
|
||||||
my @rets;
|
my @rets;
|
||||||
@ -1205,77 +1205,6 @@ CommandList($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
sub
|
|
||||||
XmlEscape($)
|
|
||||||
{
|
|
||||||
my $a = shift;
|
|
||||||
return "" if(!$a);
|
|
||||||
$a =~ s/\\\n/<br>/g; # Multi-line
|
|
||||||
$a =~ s/&/&/g;
|
|
||||||
$a =~ s/"/"/g;
|
|
||||||
$a =~ s/</</g;
|
|
||||||
$a =~ s/>/>/g;
|
|
||||||
$a =~ s/([^ -~])/sprintf("#%02x;", ord($1))/ge;
|
|
||||||
return $a;
|
|
||||||
}
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
sub
|
|
||||||
CommandXmlList($$)
|
|
||||||
{
|
|
||||||
my ($cl, $param) = @_;
|
|
||||||
my $str = "<FHZINFO>\n";
|
|
||||||
my $lt = "";
|
|
||||||
|
|
||||||
delete($modules{""}) if(defined($modules{""}));
|
|
||||||
for my $d (sort { my $x = $modules{$defs{$a}{TYPE}}{ORDER} cmp
|
|
||||||
$modules{$defs{$b}{TYPE}}{ORDER};
|
|
||||||
$x = ($a cmp $b) if($x == 0); $x; } keys %defs) {
|
|
||||||
|
|
||||||
my $p = $defs{$d};
|
|
||||||
my $t = $p->{TYPE};
|
|
||||||
|
|
||||||
if($t ne $lt) {
|
|
||||||
$str .= "\t</${lt}_LIST>\n" if($lt);
|
|
||||||
$str .= "\t<${t}_LIST>\n";
|
|
||||||
}
|
|
||||||
$lt = $t;
|
|
||||||
|
|
||||||
my $a1 = XmlEscape($p->{STATE});
|
|
||||||
my $a2 = XmlEscape(getAllSets($d));
|
|
||||||
my $a3 = XmlEscape(getAllAttr($d));
|
|
||||||
|
|
||||||
$str .= "\t\t<$t name=\"$d\" state=\"$a1\" sets=\"$a2\" attrs=\"$a3\">\n";
|
|
||||||
|
|
||||||
foreach my $c (sort keys %{$p}) {
|
|
||||||
next if(ref($p->{$c}));
|
|
||||||
$str .= sprintf("\t\t\t<INT key=\"%s\" value=\"%s\"/>\n",
|
|
||||||
XmlEscape($c), XmlEscape($p->{$c}));
|
|
||||||
}
|
|
||||||
$str .= sprintf("\t\t\t<INT key=\"IODev\" value=\"%s\"/>\n",
|
|
||||||
$p->{IODev}{NAME}) if($p->{IODev});
|
|
||||||
|
|
||||||
foreach my $c (sort keys %{$attr{$d}}) {
|
|
||||||
$str .= sprintf("\t\t\t<ATTR key=\"%s\" value=\"%s\"/>\n",
|
|
||||||
XmlEscape($c), XmlEscape($attr{$d}{$c}));
|
|
||||||
}
|
|
||||||
|
|
||||||
my $r = $p->{READINGS};
|
|
||||||
if($r) {
|
|
||||||
foreach my $c (sort keys %{$r}) {
|
|
||||||
$str .=
|
|
||||||
sprintf("\t\t\t<STATE key=\"%s\" value=\"%s\" measured=\"%s\"/>\n",
|
|
||||||
XmlEscape($c), XmlEscape($r->{$c}{VAL}), $r->{$c}{TIME});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$str .= "\t\t</$t>\n";
|
|
||||||
}
|
|
||||||
$str .= "\t</${lt}_LIST>\n" if($lt);
|
|
||||||
$str .= "</FHZINFO>\n";
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub
|
sub
|
||||||
CommandReload($$)
|
CommandReload($$)
|
||||||
@ -1379,7 +1308,9 @@ getAllSets($)
|
|||||||
sub
|
sub
|
||||||
GlobalAttr($$)
|
GlobalAttr($$)
|
||||||
{
|
{
|
||||||
my ($name, $val) = @_;
|
my ($type, $me, $name, $val) = @_;
|
||||||
|
|
||||||
|
return if($type ne "set");
|
||||||
|
|
||||||
################
|
################
|
||||||
if($name eq "logfile") {
|
if($name eq "logfile") {
|
||||||
@ -1497,14 +1428,6 @@ CommandAttr($$)
|
|||||||
$attr{$sdev}{$a[1]} = "1";
|
$attr{$sdev}{$a[1]} = "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($sdev eq "global") {
|
|
||||||
$ret = GlobalAttr($a[1], $a[2]);
|
|
||||||
if($ret) {
|
|
||||||
push @rets, $ret;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return join("\n", @rets);
|
return join("\n", @rets);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user