mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-16 04:36:02 +00:00
rereadcfg patches
git-svn-id: https://svn.fhem.de/fhem/trunk@283 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1c265347ce
commit
1a16f8b12a
@ -87,21 +87,20 @@ FW_Define($$)
|
||||
($global && $global ne "global"));
|
||||
|
||||
$hash->{STATE} = "Initialized";
|
||||
$hash->{PORT} = IO::Socket::INET->new(
|
||||
$hash->{SERVERSOCKET} = IO::Socket::INET->new(
|
||||
Proto => 'tcp',
|
||||
LocalHost => (($global && $global eq "global") ? undef : "localhost"),
|
||||
LocalPort => $port,
|
||||
Listen => 10,
|
||||
ReuseAddr => 1);
|
||||
|
||||
return "Can't open server port at $port: $!" if(!$hash->{PORT});
|
||||
return "Can't open server port at $port: $!" if(!$hash->{SERVERSOCKET});
|
||||
|
||||
$hash->{FD} = $hash->{PORT}->fileno();
|
||||
$hash->{FD} = $hash->{SERVERSOCKET}->fileno();
|
||||
$hash->{PORT} = $port;
|
||||
|
||||
$selectlist{"$name.$port"} = $hash;
|
||||
$hash->{SERVERSOCKET} = 1;
|
||||
Log(2, "FHEMWEB port $port opened");
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
@ -110,8 +109,19 @@ sub
|
||||
FW_Undef($$)
|
||||
{
|
||||
my ($hash, $arg) = @_;
|
||||
close($hash->{CD}) if(defined($hash->{CD})); # Clients
|
||||
close($hash->{PORT}) if(defined($hash->{PORT})); # Server
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
return undef if($hash->{INUSE});
|
||||
|
||||
if(defined($hash->{CD})) { # Clients
|
||||
close($hash->{CD});
|
||||
delete($selectlist{$hash->{NAME}});
|
||||
}
|
||||
if(defined($hash->{SERVERSOCKET})) { # Server
|
||||
close($hash->{SERVERSOCKET});
|
||||
$name = $name . "." . $hash->{PORT};
|
||||
delete($selectlist{$name});
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
@ -120,11 +130,11 @@ sub
|
||||
FW_Read($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
if($hash->{SERVERSOCKET}) { # Accept and create a child
|
||||
|
||||
my @clientinfo = $hash->{PORT}->accept();
|
||||
my $name = $hash->{NAME};
|
||||
my @clientinfo = $hash->{SERVERSOCKET}->accept();
|
||||
my $ll = GetLogLevel($name,4);
|
||||
|
||||
if(!@clientinfo) {
|
||||
@ -162,8 +172,8 @@ FW_Read($)
|
||||
my $ret = sysread($hash->{CD}, $buf, 1024);
|
||||
|
||||
if(!defined($ret) || $ret <= 0) {
|
||||
my $r = CommandDelete(undef, $hash->{NAME});
|
||||
Log($ll, "Connection closed for $hash->{NAME}");
|
||||
my $r = CommandDelete(undef, $name);
|
||||
Log($ll, "Connection closed for $name");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -175,9 +185,17 @@ FW_Read($)
|
||||
my ($mode, $arg, $method) = split(" ", $lines[0]);
|
||||
$hash->{BUF} = "";
|
||||
|
||||
Log($ll, "HTTP $hash->{NAME} GET $arg");
|
||||
Log($ll, "HTTP $name GET $arg");
|
||||
$hash->{INUSE} = 1;
|
||||
|
||||
my $cacheable = FW_AnswerCall($arg);
|
||||
|
||||
delete($hash->{INUSE});
|
||||
if(!$selectlist{$name}) { # removed by rereadcfg, reinsert
|
||||
$selectlist{$name} = $hash;
|
||||
$defs{$name} = $hash;
|
||||
}
|
||||
|
||||
my $c = $hash->{CD};
|
||||
my $l = length($__RET);
|
||||
my $e = ($cacheable? ("Expires: ".localtime(time()+900)." GMT\r\n") : "");
|
||||
|
@ -1,7 +1,8 @@
|
||||
############################
|
||||
# Display the power reported by the EM1010
|
||||
# Corresponding FileLog definition:
|
||||
# define ememlog FileLog /var/log/fhem/emem-%Y.log emem:power.*
|
||||
# define ememlog FileLog /var/log/fhem/em-%Y.log emem:power.*
|
||||
# define emwzlog FileLog /var/log/fhem/em-%Y.log emwz:power.*
|
||||
|
||||
set terminal png transparent size <SIZE> crop
|
||||
set output '<OUT>.png'
|
||||
|
32
fhem/webfrontend/pgm2/cul_emem.gplot
Normal file
32
fhem/webfrontend/pgm2/cul_emem.gplot
Normal file
@ -0,0 +1,32 @@
|
||||
############################
|
||||
# Display the power reported by the EM1000FM received bei CUL
|
||||
|
||||
#set terminal png transparent size <SIZE> crop
|
||||
set terminal png size <SIZE> crop
|
||||
set output '<OUT>.png'
|
||||
set xdata time
|
||||
set timefmt "%Y-%m-%d_%H:%M:%S"
|
||||
set xlabel "Energiemonitor EM1000EM"
|
||||
|
||||
set title '<TL>'
|
||||
set ylabel "Power (kW)"
|
||||
set y2label "Power (kWh)"
|
||||
set grid
|
||||
set ytics
|
||||
set y2tics
|
||||
set logscale y
|
||||
set logscale y2
|
||||
set format y "%.1f"
|
||||
set format y2 "%.1f"
|
||||
|
||||
#FileLog 8::0:
|
||||
#FileLog 10::0:
|
||||
|
||||
|
||||
plot \
|
||||
"< awk '/5MIN:/ {print $1, $8}' <IN>"\
|
||||
using 1:2 axes x1y2 title 'kWh' with lines lw 1,\
|
||||
"< awk '/TOP:/ {print $1, $10}' <IN>"\
|
||||
using 1:2 axes x1y1 title 'Spitze kW' with lines lw 2\
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user