2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

Lots of small changes, see the CHANGED file

git-svn-id: https://svn.fhem.de/fhem/trunk@350 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2009-02-11 12:58:22 +00:00
parent 818a4a1914
commit 3f04247252
10 changed files with 45 additions and 17 deletions

View File

@ -489,4 +489,5 @@
- feature: Common Module calling for CUL/FHZ/CM11
- feature: Store CUL sensitivity info
- feature: avoid the "unknown/help me" message for unloaded devices
- feature: structure module for big installations
- feature: Cost Control in 15_CUL_EM (CostPerUnit, BasisFeePerMonth)

View File

@ -498,9 +498,8 @@ CUL_Read($)
my $dev = $hash->{DeviceName};
Log 1, "USB device $dev disconnected, waiting to reappear";
$hash->{PortObj}->close();
DoTrigger($name, "DISCONNECTED");
delete($hash->{PortObj});
delete($hash->{FD});
delete($selectlist{"$name.$dev"});
$readyfnlist{"$name.$dev"} = $hash; # Start polling
$hash->{STATE} = "disconnected";
@ -509,6 +508,7 @@ CUL_Read($)
# and following opens block infinitely. Only a reboot helps.
sleep(5);
DoTrigger($name, "DISCONNECTED");
return "";
}

View File

@ -364,6 +364,8 @@ FHZ_Undef($$)
}
}
$hash->{PortObj}->close() if($hash->{PortObj});
delete($hash->{PortObj});
delete($hash->{FD});
return undef;
}
@ -618,9 +620,8 @@ FHZ_Read($)
Log 1, "USB device $dev disconnected, waiting to reappear";
delete($hash->{FD});
$hash->{PortObj}->close();
DoTrigger($name, "DISCONNECTED");
delete($hash->{PortObj});
delete($hash->{FD});
delete($selectlist{"$name.$dev"});
$readyfnlist{"$name.$dev"} = $hash; # Start polling
$hash->{STATE} = "disconnected";
@ -628,6 +629,8 @@ FHZ_Read($)
# Without the following sleep the open of the device causes a SIGSEGV,
# and following opens block infinitely. Only a reboot helps.
sleep(5);
DoTrigger($name, "DISCONNECTED");
}

View File

@ -27,6 +27,7 @@ CUL_WS_Initialize($)
$hash->{Match} = "^K.....";
$hash->{DefFn} = "CUL_WS_Define";
$hash->{UndefFn} = "CUL_WS_Undef";
$hash->{AttrFn} = "CUL_WS_Attr";
$hash->{ParseFn} = "CUL_WS_Parse";
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:S300TH,KS300 loglevel";
}
@ -70,7 +71,6 @@ sub
CUL_WS_Parse($$)
{
my ($hash,$msg) = @_;
my $name = $hash->{NAME};
my %tlist = ("0"=>"temp",
"1"=>"temp/hum",
"2"=>"rain",
@ -87,17 +87,18 @@ CUL_WS_Parse($$)
my $cde = ($firstbyte&7) + 1;
my $type = $tlist{$a[2]} ? $tlist{$a[2]} : "unknown";
my $def = $defptr{$cde};
my $def = $defptr{$hash->{NAME} . "." . $cde};
$def = $defptr{$cde} if(!$def);
return "" if($def->{IODev} && $def->{IODev}{NAME} ne $hash->{NAME});
if(!$defptr{$cde})
if(!$def)
{
Log 1, "CUL_WS UNDEFINED $type sensor detected, code $cde";
# return "UNDEFINED CUL_WS: $cde";
}
my $tm=TimeNow();
$hash = $defptr{$cde};
$hash = $def;
my $typbyte = hex($a[2]) & 7;
my $sfirstbyte = $firstbyte & 7;
@ -226,7 +227,7 @@ else
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 $tmp = sprintf("%0.1f", ("$a[6]$a[3].$a[4]"+ $hash->{corr1}),
(($a[1] & 0xC) ? -1 : 1));
my $ir = ((hex($a[1]) & 2)) ? "yes" : "no";
@ -243,7 +244,8 @@ else
}
}
Log GetLogLevel($name,3), "CUL_WS $devtype $name: $val";
my $name = $hash->{NAME};
Log GetLogLevel($name,4), "CUL_WS $devtype $name: $val";
$hash->{STATE} = $val; # List overview
$hash->{READINGS}{state}{TIME} = TimeNow(); # For list
@ -255,4 +257,21 @@ $hash->{READINGS}{$devtype}{TIME}=$tm;
return $name;
}
sub
CUL_WS_Attr(@)
{
my @a = @_;
# Make possible to use the same code for different logical devices when they
# are received through different physical devices.
return if($a[0] ne "set" || $a[2] ne "IODev");
my $hash = $defs{$a[1]};
my $iohash = $defs{$a[3]};
my $cde = $hash->{CODE};
delete($defptr{$cde});
$defptr{$iohash->{NAME} . "." . $cde} = $hash;
return undef;
}
1;

View File

@ -66,6 +66,7 @@ SCIVT_Define($$)
$init_done = $oid;
return undef;
}
#####################################
sub
SCIVT_Set($@)

View File

@ -15,7 +15,8 @@ install:install-base
cp examples/sample_fhem $(VARDIR)/fhem.cfg
@echo
@echo
@echo Edit $(VARDIR)/fhem.cfg then type perl $(BINDIR)/fhem.pl $(VARDIR)/fhem.cfg
@echo Edit $(VARDIR)/fhem.cfg then type
@echo perl $(BINDIR)/fhem.pl $(VARDIR)/fhem.cfg
install-pgm2:install-base
cp webfrontend/pgm2/* $(MODDIR)/FHEM
@ -25,9 +26,11 @@ install-pgm2:install-base
cd examples; for i in *; do cp $$i $(MODDIR)/FHEM/example.$$i; done
@echo
@echo
@echo Edit $(VARDIR)/fhem.cfg then start perl $(BINDIR)/fhem.pl $(VARDIR)/fhem.cfg
@echo Edit $(VARDIR)/fhem.cfg then type
@echo perl $(BINDIR)/fhem.pl $(VARDIR)/fhem.cfg
install-base:
mkdir -p $(BINDIR) $(MODDIR) $(VARDIR)
cp fhem.pl $(BINDIR)
cp -r FHEM $(MODDIR)
mkdir -p $(VARDIR)

View File

@ -1,8 +1,8 @@
FHEM:
- Remote serial device via IP (for the FHZ1300 WLAN)
- Common buffer for parallel use of two devices: CUL+FHZ, (WS300/EM1000PC?)
- holiday database
- fhem-to-fhem module
- Remote serial device via IP
- CUR built-in MENU creation support
Webpgm2

View File

@ -30,7 +30,7 @@
- JsonList
99_JsonList.pm adds a jsonlist command, which is list in JSON format.
See JsonList/README.JsonList for more. By Martin.
- fhem2speech
- fhem-speech
Martins instructions on how to make FHEM talk using the MBROLA speech
synthesizer
- init-scripts

View File

@ -26,7 +26,7 @@
<ul>
Install & start fhem with the command:<pre>
make install-pgm2
perl /usr/local/bin/fhem.pl fhem.cfg</pre>
perl /usr/local/bin/fhem.pl /var/log/fhem/fhem.cfg</pre>
The logfile should look like:<pre>
2008.06.15 16:17:03 2: FHEMWEB port 8083 opened

View File

@ -135,6 +135,8 @@ use vars qw(%cmds); # Global command name hash. To be expanded
use vars qw($reread_active);
my $AttrList = "room comment";
my $server; # Server socket
my $currlogfile; # logfile, without wildcards
my $logopened = 0; # logfile opened or using stdout
@ -148,8 +150,7 @@ my %defaultattr; # Default attributes
my %intAt; # Internal at timer hash.
my $nextat; # Time when next timer will be triggered.
my $intAtCnt=0;
my $AttrList = "room comment";
my $cvsid = '$Id: fhem.pl,v 1.68 2009-01-27 08:01:34 rudolfkoenig Exp $';
my $cvsid = '$Id: fhem.pl,v 1.69 2009-02-11 12:58:22 rudolfkoenig Exp $';
my $namedef =
"where <name> is either:\n" .
"- a single device name\n" .