2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-12 16:46:35 +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:
rudolfkoenig 2008-12-09 14:12:40 +00:00
parent 1a16f8b12a
commit 873ccc570c
18 changed files with 166 additions and 215 deletions

View File

@ -1,12 +1,12 @@
- 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)
- Reformatting the package and the documentation
- New links
- 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)
- multiple commands on one line separated with ;
- sleeping 0.22 seconds after an ST command
@ -450,9 +450,11 @@
- feature: CUL / CUL_EM / CUL_WS documentation
- feature: do not block fhem when the CUR is disconnected
- 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
readings added
- feature: 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 config file.
- feature: fhem commands may be added in modules. XmlList is external now.
- bugfix: rereadcfg from webpgm2 does not crash fhem.pl

View File

@ -208,7 +208,8 @@ CM11_Undef($$)
defined($defs{$d}{IODev}) &&
$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};
}
}

View File

@ -128,7 +128,8 @@ CUL_Undef($$)
defined($defs{$d}{IODev}) &&
$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};
}
}
@ -197,7 +198,7 @@ GOTBW:
} else {
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");
Log GetLogLevel($name,4), "set $name $type $arg";
CUL_Write($hash, $sets{$type}, $arg);
@ -409,21 +410,21 @@ CUL_Write($$$)
my $bstring = "$fn$msg\n";
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);
##############
# Write the next buffer not earlier than 0.227 seconds (= 65.6ms + 10ms +
# 65.6ms + 10ms + 65.6ms + 10ms)
# Write the next buffer not earlier than 0.22 seconds (= 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);
} elsif($hash->{QUEUECNT} == 1) {
$hash->{QUEUE} = [ $bstring ];
} else {
push(@{$hash->{QUEUE}}, $bstring);
}
$hash->{QUEUECNT}++;
} else {
@ -438,14 +439,18 @@ sub
CUL_HandleWriteQueue($)
{
my $hash = shift;
if($hash->{QUEUECNT} > 0) {
$hash->{QUEUECNT}--;
my $bstring = shift(@{$hash->{QUEUE}});
if(defined($bstring)) {
CUL_XmitLimitCheck($hash,$bstring);
$hash->{PortObj}->write($bstring);
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
my $arr = $hash->{QUEUE};
if(defined($arr) && @{$arr} > 0) {
shift(@{$arr});
if(@{$arr} == 0) {
delete($hash->{QUEUE});
return;
}
my $bstring = $arr->[0];
CUL_XmitLimitCheck($hash,$bstring);
$hash->{PortObj}->write($bstring);
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
}
}

View File

@ -326,7 +326,8 @@ FHZ_Undef($$)
defined($defs{$d}{IODev}) &&
$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};
}
}

View File

@ -78,8 +78,8 @@ CUL_WS_Parse($$)
my $firstbyte = hex($a[1]);
my $cde = ($firstbyte&7) + 1;
my $type = $tlist{$a[2]} ? $tlist{$a[2]} : "unknown";
if(!$defptr{$cde}) {
Log 1, "CUL_WS UNDEFINED $type sensor detected, code $cde";
return "UNDEFINED CUL_WS: $cde";
@ -87,78 +87,110 @@ CUL_WS_Parse($$)
$hash = $defptr{$cde};
my $name = $hash->{NAME};
my $typbyte = hex($a[2]) & 7;
my $sfirstbyte = $firstbyte & 7;
my $val = "";
my $devtype = "unknown";
if(@a == 5) { # 433MHz RainSensor
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($sfirstbyte == 7) {
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
my $br = hex($a[3].$a[4].$a[5].$a[6]) + $hash->{corr1};
if($typbyte == 1) {
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";
$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 $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].".".$a[11]) + $hash->{corr3};
$val = "T: $tmp H: $hum P: $prs";
$val = "T: $tmp H: $hum";
$devtype = "S300TH";
} elsif($type eq "wind") {
} elsif(@a == 15) { # KS300/2
# TODO
my $wnd = hex($a[3].$a[4].$a[5].$a[6]) + $hash->{corr1};
$val = "W: $wnd";
} elsif($type eq "rain") {
# 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}) *
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));
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->{READINGS}{state}{TIME} = TimeNow(); # For list

View File

@ -30,7 +30,7 @@ CUL_EM_Define($$)
my @a = split("[ \t][ \t]*", $def);
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"
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
$hash->{corr1} = (int(@a) > 3 ? $a[3] : 0.01);
# 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
$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 {
$hash->{corr1} = 1;

View File

@ -85,7 +85,8 @@ EM_Undef($$)
defined($defs{$d}{IODev}) &&
$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};
}
}

View File

@ -96,7 +96,8 @@ M232_Undef($$)
defined($defs{$d}{IODev}) &&
$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};
}
}

View File

@ -349,3 +349,9 @@
- 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
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.

View File

@ -59,7 +59,6 @@
<a href="#EMWZ">EMWZ</a> &nbsp;
<a href="#FHT">FHT</a> &nbsp;
<a href="#FHZ">FHZ</a> &nbsp;
<a href="#FS10">FS10</a> &nbsp;
<a href="#FS20">FS20</a> &nbsp;
<a href="#HMS">HMS</a> &nbsp;
<a href="#FHEMWEB">FHEMWEB</a> &nbsp;
@ -2353,26 +2352,6 @@ A line ending with \ will be concatenated with the next one, so long lines
</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>
<h3>WS2000</h3>
<ul>

View File

@ -7,11 +7,11 @@
#
# Common part
attr global logfile /tmp/fhem-%Y-%m.log
attr global statefile /tmp/fhem.save # where to save the state of the devices
attr global logfile /tmp/fhem/fhem-%Y-%m.log
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 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

View File

@ -10,11 +10,11 @@
# Common part
attr global logfile /tmp/fhem-%Y-%m.log
attr global statefile /tmp/fhem.save # where to save the state of the devices
attr global logfile /tmp/fhem/fhem-%Y-%m.log
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
attr global verbose 3 # "normal" verbosity
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

View File

@ -8,11 +8,11 @@
# After about 5-10 minutes, check if "list wz" returns something meaningful
#
attr global logfile /tmp/fhem-%Y-%m.log
attr global statefile /tmp/fhem.save # where to save the state of the devices
attr global logfile /tmp/fhem/fhem-%Y-%m.log
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
attr global verbose 3 # "normal" verbosity
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

View File

@ -4,11 +4,11 @@
# contrib/91_DbLog.pm
#
attr global logfile /tmp/fhem-%Y-%m.log
attr global statefile /tmp/fhem.save # where to save the state of the devices
attr global logfile /tmp/fhem/fhem-%Y-%m.log
attr global statefile /tmp/fhem/fhem.save # where to save the state of the devices
attr global verbose 3 # "normal" verbosity
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

View File

@ -8,11 +8,11 @@
# if there is no definition for it. Check the commandref.html define, Type HMS
# section for details
attr global logfile /tmp/fhem-%Y-%m.log
attr global statefile /tmp/fhem.save # where to save the state of the devices
attr global logfile /tmp/fhem/fhem-%Y-%m.log
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 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

View File

@ -1,8 +1,8 @@
#
# Minimalistic fhem.pl configfile. Take a look at the other examples for more.
#
attr global logfile /tmp/fhem-%Y-%m.log
attr global statefile /tmp/fhem.save # where to save the state of the devices
attr global logfile /tmp/fhem/fhem-%Y-%m.log
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 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

View File

@ -2,14 +2,14 @@
# Minimalistic fhem.pl & pgm2 configfile. Take a look at the other examples for
# more.
#
attr global logfile /tmp/fhem-%Y-%m.log
attr global statefile /tmp/fhem.save # where to save the state of the devices
attr global logfile /tmp/fhem/fhem-%Y-%m.log
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 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
attr WEB plotmode SVG
# 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

View File

@ -4,7 +4,8 @@
#
# 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
#
# This script free software; you can redistribute it and/or modify
@ -48,7 +49,6 @@ sub DoClose($);
sub FmtDateTime($);
sub FmtTime($);
sub GetLogLevel(@);
sub GlobalAttr($$);
sub GetTimeSpec($);
sub HandleArchiving($);
sub HandleTimeout();
@ -89,7 +89,6 @@ sub CommandSet($$);
sub CommandSetstate($$);
sub CommandSleep($$);
sub CommandShutdown($$);
sub CommandXmlList($$);
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($init_done); #
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 $currlogfile; # logfile, without wildcards
@ -146,9 +147,8 @@ my %defaultattr; # Default attributes
my %intAt; # Internal at timer hash.
my $nextat; # Time when next timer will be triggered.
my $intAtCnt=0;
my $reread_active = 0;
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 =
"where <name> is either:\n" .
"- a single device name\n" .
@ -165,9 +165,10 @@ $modules{_internal_}{AttrList} =
"archivecmd allowfrom archivedir configfile lastinclude logfile " .
"modpath nrarchive pidfilename port statefile title userattr " .
"verbose:1,2,3,4,5 mseclog version nofork";
$modules{_internal_}{AttrFn} = "GlobalAttr";
my %cmds = (
%cmds = (
"?" => { Fn=>"CommandHelp",
Hlp=>",get this help" },
"attr" => { Fn=>"CommandAttr",
@ -212,8 +213,6 @@ my %cmds = (
Hlp=>"<sec>,sleep for sec, 3 decimal places" },
"trigger" => { Fn=>"CommandTrigger",
Hlp=>"<devspec> <state>,trigger notify command" },
"xmllist" => { Fn=>"CommandXmlList",
Hlp=>",list definitions and status info as xml" },
);
@ -721,6 +720,8 @@ CommandRereadCfg($$)
WriteStatefile();
$reread_active=1;
foreach my $d (keys %defs) {
my $ret = CallFn($d, "UndefFn", $defs{$d}, $d);
return $ret if($ret);
@ -729,11 +730,11 @@ CommandRereadCfg($$)
my $cfgfile = $attr{global}{configfile};
%defs = ();
%attr = ();
%selectlist = ();
%readyfnlist = ();
doGlobalDef($cfgfile);
$reread_active=1;
my $ret = CommandInclude($cl, $cfgfile);
if(!$ret && $attr{global}{statefile} && -r $attr{global}{statefile}) {
$ret = CommandInclude($cl, $attr{global}{statefile});
@ -1061,7 +1062,6 @@ sub
CommandDelete($$)
{
my ($cl, $def) = @_;
return "Usage: delete <name>$namedef\n" if(!$def);
my @rets;
@ -1205,77 +1205,6 @@ CommandList($$)
}
#####################################
sub
XmlEscape($)
{
my $a = shift;
return "" if(!$a);
$a =~ s/\\\n/<br>/g; # Multi-line
$a =~ s/&/&amp;/g;
$a =~ s/"/&quot;/g;
$a =~ s/</&lt;/g;
$a =~ s/>/&gt;/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
CommandReload($$)
@ -1379,7 +1308,9 @@ getAllSets($)
sub
GlobalAttr($$)
{
my ($name, $val) = @_;
my ($type, $me, $name, $val) = @_;
return if($type ne "set");
################
if($name eq "logfile") {
@ -1497,14 +1428,6 @@ CommandAttr($$)
$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);
}