mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 17:12:32 +00:00
4.5 preparations
git-svn-id: https://svn.fhem.de/fhem/trunk@300 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c0e5d518dc
commit
2a30ad824b
@ -464,3 +464,4 @@
|
|||||||
- bugfix: attributes of at devices disappear
|
- bugfix: attributes of at devices disappear
|
||||||
- feature: attribute rainadjustment for KS300 (Boris 2008-12-17)
|
- feature: attribute rainadjustment for KS300 (Boris 2008-12-17)
|
||||||
- bugfix: deleting at / watchdog while active creates an empty device
|
- bugfix: deleting at / watchdog while active creates an empty device
|
||||||
|
- feature: ExactId trigger added for wildcard HMS devices
|
||||||
|
@ -567,6 +567,7 @@ CUL_Read($)
|
|||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
#Translate Message from CUL to FHZ
|
#Translate Message from CUL to FHZ
|
||||||
|
next if(!$dmsg || length($dmsg) < 1); # Bogus messages
|
||||||
my $fn = substr($dmsg,0,1);
|
my $fn = substr($dmsg,0,1);
|
||||||
my $len = length($dmsg);
|
my $len = length($dmsg);
|
||||||
|
|
||||||
|
@ -1,166 +0,0 @@
|
|||||||
##############################################
|
|
||||||
package main;
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
use Device::SerialPort;
|
|
||||||
use IO::Socket::INET;
|
|
||||||
|
|
||||||
my $fs10data = "";
|
|
||||||
my $pcwsdsocket;
|
|
||||||
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
sub
|
|
||||||
FS10_Initialize($)
|
|
||||||
{
|
|
||||||
my ($hash) = @_;
|
|
||||||
|
|
||||||
# Consumer
|
|
||||||
$hash->{DefFn} = "FS10_Define";
|
|
||||||
$hash->{AttrList}= "model:FS10 loglevel:0,1,2,3,4,5,6";
|
|
||||||
}
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
sub
|
|
||||||
FS10_Define($$)
|
|
||||||
{
|
|
||||||
my ($hash, $def) = @_;
|
|
||||||
my @a = split("[ \t][ \t]*", $def);
|
|
||||||
|
|
||||||
Log 3, "FS10 Define: $a[0] $a[1] $a[2] $a[3]";
|
|
||||||
|
|
||||||
return "Define the host and portnr as a parameter i.e. 127.0.0.1 4711"
|
|
||||||
if(@a != 4);
|
|
||||||
|
|
||||||
$hash->{Timer} = 600;
|
|
||||||
$hash->{Host} = $a[2];
|
|
||||||
$hash->{Port} = $a[3];
|
|
||||||
$hash->{STATE} = "Initialized";
|
|
||||||
|
|
||||||
my $dev = $a[2];
|
|
||||||
Log 1, "FS10 device is none, commands will be echoed only"
|
|
||||||
if($dev eq "none");
|
|
||||||
|
|
||||||
$hash->{DeviceName} = $dev;
|
|
||||||
|
|
||||||
FS10_GetStatus($hash);
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
sub
|
|
||||||
FS10_GetStatus($)
|
|
||||||
{
|
|
||||||
my ($hash) = @_;
|
|
||||||
my $buf;
|
|
||||||
#my $banner;
|
|
||||||
my $reqcmd;
|
|
||||||
my $fs10time;
|
|
||||||
my $dt;
|
|
||||||
my $x;
|
|
||||||
my $result = "";
|
|
||||||
|
|
||||||
Log 3, "FS10_GetStatus";
|
|
||||||
|
|
||||||
# Call us in 5 minutes again.
|
|
||||||
InternalTimer(gettimeofday()+300, "FS10_GetStatus", $hash, 0);
|
|
||||||
|
|
||||||
my $dnr = $hash->{DEVNR};
|
|
||||||
my $name = $hash->{NAME};
|
|
||||||
my $host = $hash->{Host};
|
|
||||||
my $port = $hash->{Port};
|
|
||||||
my %vals;
|
|
||||||
my $pcwsd ="$host:$port";
|
|
||||||
my $pcwsdsocket = IO::Socket::INET->new( $pcwsd )
|
|
||||||
or return "FS10 Can't bind to pcwsd" if(!$pcwsdsocket);
|
|
||||||
|
|
||||||
my $banner = $pcwsdsocket->getline();
|
|
||||||
my @x = split(" ", $banner);
|
|
||||||
my @y;
|
|
||||||
my $fs10name;
|
|
||||||
|
|
||||||
for(my $i = 0; $i < 8; $i++) #Outdoor
|
|
||||||
{
|
|
||||||
$fs10name ="Ta$i";
|
|
||||||
$reqcmd = "get od2temp $i\r\n";
|
|
||||||
$pcwsdsocket->print($reqcmd);
|
|
||||||
$buf = $pcwsdsocket->getline();
|
|
||||||
$result = "$result $buf";
|
|
||||||
|
|
||||||
@x = split(" ", $buf);
|
|
||||||
$fs10time = FmtDateTime($x[1]);
|
|
||||||
|
|
||||||
$hash->{CHANGED}[$i] = "Ta$i: $x[0]";
|
|
||||||
$hash->{READINGS}{$fs10name}{TIME} = $fs10time;
|
|
||||||
$hash->{READINGS}{$fs10name}{VAL} = $x[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$fs10name="Ti";
|
|
||||||
$reqcmd = "get idtemp 7\r\n";
|
|
||||||
$pcwsdsocket->print($reqcmd);
|
|
||||||
$buf = $pcwsdsocket->getline();
|
|
||||||
@x = split(" ", $buf);
|
|
||||||
$fs10time = FmtDateTime($x[1]);
|
|
||||||
|
|
||||||
$hash->{CHANGED}[8] = "Ti: $x[0]";
|
|
||||||
$hash->{READINGS}{$fs10name}{TIME} = $fs10time;
|
|
||||||
$hash->{READINGS}{$fs10name}{VAL} = $x[0];
|
|
||||||
|
|
||||||
$fs10name="Rain";
|
|
||||||
$reqcmd = "get rain 7\r\n";
|
|
||||||
$pcwsdsocket->print($reqcmd);
|
|
||||||
$buf = $pcwsdsocket->getline();
|
|
||||||
@x = split(" ", $buf);
|
|
||||||
$fs10time = FmtDateTime($x[1]);
|
|
||||||
|
|
||||||
$hash->{CHANGED}[9] = "Rain: $x[0]";
|
|
||||||
$hash->{READINGS}{$fs10name}{TIME} = $fs10time;
|
|
||||||
$hash->{READINGS}{$fs10name}{VAL} = $x[0];
|
|
||||||
|
|
||||||
$fs10name="Sun";
|
|
||||||
$reqcmd = "get bright 7\r\n";
|
|
||||||
$pcwsdsocket->print($reqcmd);
|
|
||||||
$buf = $pcwsdsocket->getline();
|
|
||||||
@x = split(" ", $buf);
|
|
||||||
$fs10time = FmtDateTime($x[1]);
|
|
||||||
|
|
||||||
$hash->{CHANGED}[10] = "Sun: $x[0]";
|
|
||||||
$hash->{READINGS}{$fs10name}{TIME} = $fs10time;
|
|
||||||
$hash->{READINGS}{$fs10name}{VAL} = $x[0];
|
|
||||||
|
|
||||||
$fs10name="Windspeed";
|
|
||||||
$reqcmd = "get wspd 7\r\n";
|
|
||||||
$pcwsdsocket->print($reqcmd);
|
|
||||||
$buf = $pcwsdsocket->getline();
|
|
||||||
@x = split(" ", $buf);
|
|
||||||
$fs10time = FmtDateTime($x[1]);
|
|
||||||
|
|
||||||
$hash->{CHANGED}[11] = "Windspeed: $x[0]";
|
|
||||||
$hash->{READINGS}{$fs10name}{TIME} = $fs10time;
|
|
||||||
$hash->{READINGS}{$fs10name}{VAL} = $x[0];
|
|
||||||
|
|
||||||
close($pcwsdsocket);
|
|
||||||
|
|
||||||
$result =~ s/[\r\n]//g;
|
|
||||||
DoTrigger($name, undef) if($init_done);
|
|
||||||
|
|
||||||
$hash->{STATE} = "$result";
|
|
||||||
Log 3,"FS10 Result: $result";
|
|
||||||
return $hash->{STATE};
|
|
||||||
}
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
sub
|
|
||||||
FS10Log($$)
|
|
||||||
{
|
|
||||||
my ($a1, $a2) = @_;
|
|
||||||
|
|
||||||
#define n31 notify fs10 {FS10Log("@", "%")}
|
|
||||||
#define here notify action
|
|
||||||
|
|
||||||
Log 2,"FS10 $a1 = $a2 old: $oldvalue{$a1}{TIME}=> $oldvalue{$a1}{VAL});";
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
Loading…
x
Reference in New Issue
Block a user