mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
PachLog doku
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@435 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d61e75362b
commit
b130dd4ebc
3
CHANGED
3
CHANGED
@ -526,4 +526,5 @@
|
||||
- feature: suppress inplausible readings from USF1000
|
||||
- bugfix: FHZ_ReadAnswer bugfix for Windows (Klaus, 20.8.2009)
|
||||
- feature: CUL: device acces code reorganized, TCP/IP support added
|
||||
- feature: Pachube module from Axel in contrib
|
||||
- feature: Pachube module from Axel
|
||||
- feature: dumpdef module from Axel in contrib
|
||||
|
@ -107,7 +107,8 @@ CUL_Define($$)
|
||||
}
|
||||
|
||||
$hash->{DeviceName} = $dev;
|
||||
return CUL_OpenDev($hash, 0);
|
||||
my $ret = CUL_OpenDev($hash, 0);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
@ -466,7 +467,7 @@ CUL_DoInit($)
|
||||
CUL_SimpleWrite($hash, "T01" . $hash->{FHTID});
|
||||
}
|
||||
|
||||
$hash->{STATE} = "Initialized";
|
||||
$hash->{STATE} = "Initialized" if(!$hash->{STATE});
|
||||
|
||||
# Reset the counter
|
||||
delete($hash->{XMIT_TIME});
|
||||
@ -913,16 +914,30 @@ CUL_OpenDev($$)
|
||||
my $name = $hash->{NAME};
|
||||
my $po;
|
||||
|
||||
|
||||
$hash->{PARTIAL} = "";
|
||||
Log 3, "CUL opening CUL device $dev"
|
||||
if(!$reopen);
|
||||
|
||||
if($dev =~ m/^(.+):([0-9]+)$/) { # host:port
|
||||
|
||||
# This part is called every time the timeout (5sec) is expired _OR_
|
||||
# somebody is communicating over another TCP connection. As the connect
|
||||
# for non-existent devices has a delay of 3 sec, we are sitting all the
|
||||
# time in this connect. NEXT_OPEN tries to avoid this problem.
|
||||
if($hash->{NEXT_OPEN} && time() < $hash->{NEXT_OPEN}) {
|
||||
return;
|
||||
}
|
||||
|
||||
my $conn = IO::Socket::INET->new(PeerAddr => $dev);
|
||||
if(!$conn) {
|
||||
if($conn) {
|
||||
delete($hash->{NEXT_OPEN})
|
||||
|
||||
} else {
|
||||
Log(3, "Can't connect to $dev: $!") if(!$reopen);
|
||||
$readyfnlist{"$name.$dev"} = $hash;
|
||||
$hash->{STATE} = "disconnected";
|
||||
$hash->{NEXT_OPEN} = time()+60;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
2
HISTORY
2
HISTORY
@ -419,4 +419,4 @@
|
||||
- 09_USF1000.pm: new module to support USF1000S devices.
|
||||
|
||||
- Fri Aug 08 2009 (Boris)
|
||||
- 09_USF1000.pm: suppress inplausible readings from USF1000
|
||||
- 09_USF1000.pm: suppress inplausible readings from USF1000
|
||||
|
@ -1,55 +1,53 @@
|
||||
##############################################
|
||||
# VarDump for FHEM-Devices
|
||||
##############################################
|
||||
# Installation
|
||||
# 99_dumpdef.pm ins FHEM-Verzeichis kopieren
|
||||
# dann: "reload 99_dumpdef.pm"
|
||||
##############################################
|
||||
# Aufruf: dumpdef "DEVICE-NAME"
|
||||
##############################################
|
||||
# Aufruf: dumpdef <XXX>
|
||||
# <MOD> = %modules
|
||||
# <SEL> = %selectlist
|
||||
# <VAL> = %value
|
||||
# <CMD> = %cmds
|
||||
# <DAT> = %data
|
||||
##############################################
|
||||
package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX;
|
||||
use Data::Dumper;
|
||||
sub Commanddumpdef($);
|
||||
|
||||
#####################################
|
||||
sub
|
||||
dumpdef_Initialize($)
|
||||
{
|
||||
my %lhash = ( Fn=>"Commanddumpdef",
|
||||
Hlp=>"Dump <devspec> to FHEMWEB & LOG" );
|
||||
$cmds{dumpdef} = \%lhash;
|
||||
}
|
||||
|
||||
|
||||
#####################################
|
||||
sub Commanddumpdef($)
|
||||
{
|
||||
my ($cl, $d) = @_;
|
||||
# $d = $a[1];
|
||||
return "Usage: dumpdef <DeviceName>" if(!$d);
|
||||
my($package, $filename, $line, $subroutine) = caller(3);
|
||||
my $r = "CALLER => $package: $filename LINE: $line SUB: $subroutine \n";
|
||||
$r .= "<h1>SUB-NAME: " .(caller(0))[3] . "</h1>\n";
|
||||
if($d eq "CMD") {$r .= Dumper(%cmds) . "\n"; return $r; }
|
||||
if($d eq "DAT") {$r .= Dumper(%data) . "\n"; return $r; }
|
||||
if($d eq "MOD") {$r .= Dumper(%modules) . "\n"; return $r; }
|
||||
if($d eq "SEL") {$r .= Dumper(%selectlist) . "\n"; return $r; }
|
||||
if(!defined($defs{$d})) {
|
||||
return "Unkown Device";}
|
||||
$r .= "DUMP-DEVICE: $d \n";
|
||||
$r .= Dumper($defs{$d}) . "\n";
|
||||
$r .= "DUMP-DEVICE-ATTR \n";
|
||||
$r .= Dumper($attr{$d}) . "\n";
|
||||
return $r;
|
||||
}
|
||||
1;
|
||||
##############################################
|
||||
# VarDump for FHEM-Devices
|
||||
##############################################
|
||||
# Installation
|
||||
# 99_dumpdef.pm ins FHEM-Verzeichis kopieren
|
||||
# dann: "reload 99_dumpdef.pm"
|
||||
##############################################
|
||||
# Aufruf: dumpdef "DEVICE-NAME"
|
||||
##############################################
|
||||
# Aufruf: dumpdef <XXX>
|
||||
# <MOD> = %modules
|
||||
# <SEL> = %selectlist
|
||||
# <CMD> = %cmds
|
||||
# <DAT> = %data
|
||||
##############################################
|
||||
package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX;
|
||||
use Data::Dumper;
|
||||
sub Commanddumpdef($);
|
||||
|
||||
#####################################
|
||||
sub
|
||||
dumpdef_Initialize($)
|
||||
{
|
||||
my %lhash = ( Fn=>"Commanddumpdef",
|
||||
Hlp=>"Dump <devspec> to FHEMWEB & LOG" );
|
||||
$cmds{dumpdef} = \%lhash;
|
||||
}
|
||||
|
||||
|
||||
#####################################
|
||||
sub Commanddumpdef($)
|
||||
{
|
||||
my ($cl, $d) = @_;
|
||||
return "Usage: dumpdef <DeviceName>" if(!$d);
|
||||
my($package, $filename, $line, $subroutine) = caller(3);
|
||||
my $r = "CALLER => $package: $filename LINE: $line SUB: $subroutine \n";
|
||||
$r .= "SUB-NAME: " .(caller(0))[3] . "\n";
|
||||
if($d eq "CMD") {$r .= Dumper(%cmds) . "\n"; return $r; }
|
||||
if($d eq "DAT") {$r .= Dumper(%data) . "\n"; return $r; }
|
||||
if($d eq "MOD") {$r .= Dumper(%modules) . "\n"; return $r; }
|
||||
if($d eq "SEL") {$r .= Dumper(%selectlist) . "\n"; return $r; }
|
||||
if(!defined($defs{$d})) {
|
||||
return "Unkown Device";}
|
||||
$r .= "DUMP-DEVICE: $d \n";
|
||||
$r .= Dumper($defs{$d}) . "\n";
|
||||
$r .= "DUMP-DEVICE-ATTR \n";
|
||||
$r .= Dumper($attr{$d}) . "\n";
|
||||
return $r;
|
||||
}
|
||||
1;
|
||||
|
@ -84,9 +84,11 @@
|
||||
<b>Helper modules</b>
|
||||
<ul>
|
||||
<a href="#FileLog">FileLog</a>
|
||||
<a href="#PachLog">PachLog</a>
|
||||
<a href="#SUNRISE_EL">SUNRISE_EL</a>
|
||||
<a href="#at">at</a>
|
||||
<a href="#dummy">dummy</a>
|
||||
<a href="#dumpdef">dumpdef</a>
|
||||
<a href="#holiday">holiday</a>
|
||||
<a href="#notify">notify</a>
|
||||
<a href="#watchdog">watchdog</a>
|
||||
@ -1537,11 +1539,13 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<a name="CUL"></a>
|
||||
<h3>CUL</h3>
|
||||
<ul>
|
||||
The CUL is an USB device sold by <a href="http://www.busware.de">busware.de
|
||||
</a>. With the opensource firmware (see this <a
|
||||
href="http://www.koeniglich.de/culfw/culfw.html">link</a>) it is
|
||||
capable to receive and send different 868MHz protocols
|
||||
(FS20/FHT/S300/EM/HMS).<br>
|
||||
The CUL/CUR/CUN is a family of RF devices sold by <a
|
||||
href="http://www.busware.de">busware.de</a>.
|
||||
|
||||
With the opensource firmware (see this <a
|
||||
href="http://www.koeniglich.de/culfw/culfw.html">link</a>) they are capable
|
||||
to receive and send different 868MHz protocols (FS20/FHT/S300/EM/HMS).<br>
|
||||
|
||||
<br>
|
||||
Some protocols (FS20/FHT) are converted by this module so that the same
|
||||
logical device can be used, irrespective if the radio telegram is received by
|
||||
@ -1554,17 +1558,24 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<a name="CULdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> CUL <serial-device> <housecode> [mobile]</code> <br>
|
||||
<code>define <name> CUL <device> <housecode></code> <br>
|
||||
<br>
|
||||
Specifies the serial port to communicate with the CUL or CUR.
|
||||
The name(s) of the serial-device(s) depends on your distribution,
|
||||
USB-connected devices (CUL/CUR/CUN):<br><ul>
|
||||
<device> specifies the serial port to communicate with the CUL or CUR.
|
||||
The name of the serial-device depends on your distribution,
|
||||
under linux the cdc_acm kernel module is responsible, and usually a
|
||||
/dev/ttyACM0 device will be created.
|
||||
/dev/ttyACM0 device will be created. If your distribution does not have a
|
||||
cdc_acm module, you can force usbserial to handle the CUL by the following
|
||||
command:<ul>modprobe usbserial vendor=0x03eb product=0x204b</ul>In this
|
||||
case the device is most probably /dev/ttyUSB0.<br>
|
||||
</ul>
|
||||
Network-connected devices (CUN):<br><ul>
|
||||
<device> specifies the host:port of the device. E.g. 192.168.0.244:2323
|
||||
</ul>
|
||||
<br>
|
||||
If the serial-device is called none, then no device will be opened, so you
|
||||
If the device is called none, then no device will be opened, so you
|
||||
can experiment without hardware attached.<br>
|
||||
If you specify the "mobile" parameter, then fhem.pl won't block if the
|
||||
device is removed. This is mainly intended for the CUR.<br>
|
||||
|
||||
The housecode is a 4 digit hex number, and it is used when the CUL/CUR
|
||||
talks to FHT devices or when CUR requests data.
|
||||
</ul>
|
||||
@ -3786,6 +3797,92 @@ isday, sunrise_coord</pre>
|
||||
</ul>
|
||||
|
||||
|
||||
<a name="PachLog"></a>
|
||||
<h3>PachLog</h3>
|
||||
<ul>
|
||||
The PachLog module logs sensor data like temperature and humidity to <a
|
||||
href=http://www.pachube.com>www.pachube.com</a>.<br>
|
||||
<br>
|
||||
<a name="PachLogdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<br><code>define <name> PachLog <Pachube-API-Key></code> <br>
|
||||
<br>
|
||||
<Pachube-API-Key>:<br>
|
||||
You need the Pachube-API-Key to authenticate your application to the
|
||||
Pachube service.<br>
|
||||
Don't share this with anyone: it's just like a password.<br>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
<a name="PachLog_Set"></a>
|
||||
<b>Set</b>
|
||||
<ul>
|
||||
<br>
|
||||
Add a new device for logging to www.pachube.com<br><br>
|
||||
<code>set <NAME> ADD <FHEM-DEVICENAME> FEED-NR:ID:READING:ID:READING</code><br><br>
|
||||
Example: KS300 weather data<br><br>
|
||||
READING: temperature humidity wind rain<br><br>
|
||||
1. Generate input feed on www.pachube.com => You get your
|
||||
FEED-NR: 1234<br>
|
||||
2. Add datastreams to the feed:<br>
|
||||
<ul>
|
||||
<table>
|
||||
<tr><td>ID</td><td>0</td><td>temperature</td></tr>
|
||||
<tr><td>ID</td><td>1</td><td>humidity</td></tr>
|
||||
<tr><td>ID</td><td>2</td><td>wind</td></tr>
|
||||
<tr><td>ID</td><td>3</td><td>rain</td></tr></table><br>
|
||||
</ul>
|
||||
3. Add the KS300 to your PachLog device<br><br>
|
||||
<code>set <NAME> ADD <My-KS300> 1234:0temperature:1:humidity:2:wind:3:rain</code><br><br>
|
||||
Delete a device form logging to www.pachube.com<br><br>
|
||||
<code>set <NAME> DEL <FHEM-DEVICENAME></code><br><br>
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
<b>Get</b> <ul>N/A</ul><br>
|
||||
<b>Attributes</b> <ul>N/A</ul><br>
|
||||
</ul>
|
||||
|
||||
|
||||
<a name="dumpdef"></a>
|
||||
<h3>dumpdef</h3>
|
||||
<ul>
|
||||
<code>dumpdef <options></code>
|
||||
<br><br>
|
||||
Data::Dumper for FHEM-Devices/Hashes<br><br>
|
||||
Dumps the content of <options> to FHEMWEB<br><br>
|
||||
Options:<br><br>
|
||||
<ul>
|
||||
<table>
|
||||
<tr><td><code>FHEM-DEVICENAME</code></td><td>=></td><td><code>%defs{FHEM-DEVICENAME}+%attr{FHEM-DEVICENAME}</code></td></tr>
|
||||
<tr><td><code>MOD</code></td><td>=></td><td><code>%modules</code></td></tr>
|
||||
<tr><td><code>SEL</code></td><td>=></td><td><code>%selectlist</code></td></tr>
|
||||
<tr><td><code>DAT</code></td><td>=></td><td><code>%data</code></td></tr>
|
||||
<tr><td><code>CMD</code></td><td>=></td><td><code>%cmd</code></td></tr>
|
||||
</table>
|
||||
</ul>
|
||||
<br><br>
|
||||
Example:
|
||||
<ul><br>
|
||||
<code>dumpdef TEST</code><br><br>
|
||||
<ul><code>CALLER => main: /opt/fhz/FHEM/01_FHEMWEB.pm LINE: 194 SUB: main::FW_AnswerCall<br>
|
||||
SUB-NAME: main::Commanddumpdef<br>
|
||||
DUMP-DEVICE: TEST <br>
|
||||
$VAR1 = {<ul><code>
|
||||
'IODev' => {},<br>
|
||||
'NAME' => 'TEST',<br>
|
||||
'NR' => 64,<br>
|
||||
'STATE' => '???',<br>
|
||||
'TYPE' => 'dummy'<br>
|
||||
};</code></ul>
|
||||
<code>DUMP-DEVICE-ATTR<br>
|
||||
$VAR1 = {</code><ul><code>
|
||||
'room' => 'DEF_DUMMY,GRP.TEST'<br>
|
||||
};</ul></code>
|
||||
</code></ul><br>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<a name="perl"></a>
|
||||
<h3>Perl specials</h3>
|
||||
|
8
fhem.pl
8
fhem.pl
@ -151,7 +151,7 @@ my %defaultattr; # Default attributes
|
||||
my %intAt; # Internal at timer hash.
|
||||
my $nextat; # Time when next timer will be triggered.
|
||||
my $intAtCnt=0;
|
||||
my $cvsid = '$Id: fhem.pl,v 1.79 2009-08-12 08:08:14 rudolfkoenig Exp $';
|
||||
my $cvsid = '$Id: fhem.pl,v 1.80 2009-09-11 07:34:12 rudolfkoenig Exp $';
|
||||
my $namedef =
|
||||
"where <name> is either:\n" .
|
||||
"- a single device name\n" .
|
||||
@ -287,7 +287,7 @@ Log 0, "Server started (version $attr{global}{version}, pid $$)";
|
||||
|
||||
################################################
|
||||
# Main Loop
|
||||
sub MAIN {MAIN:};#Dummy
|
||||
sub MAIN {MAIN:}; #Dummy
|
||||
while (1) {
|
||||
my ($rout, $rin) = ('', '');
|
||||
|
||||
@ -825,7 +825,9 @@ WriteStatefile()
|
||||
print SFH "define $d $defs{$d}{TYPE} $defs{$d}{DEF}\n"
|
||||
if($defs{$d}{VOLATILE});
|
||||
print SFH "setstate $d $defs{$d}{STATE}\n"
|
||||
if($defs{$d}{STATE} && $defs{$d}{STATE} ne "unknown");
|
||||
if($defs{$d}{STATE} &&
|
||||
$defs{$d}{STATE} ne "unknown" &&
|
||||
$defs{$d}{STATE} ne "Initialized");
|
||||
|
||||
#############
|
||||
# Now the detailed list
|
||||
|
Loading…
x
Reference in New Issue
Block a user