mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
bugfix: make BS known to CUL to avoid lost messages if both FHZ1300 and CUL are connected, adjust matching rule
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@641 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d99a49d0d1
commit
612c66c222
2
CHANGED
2
CHANGED
@ -11,6 +11,8 @@
|
|||||||
- feature: Dimmer function of X10 module changed to match FS20
|
- feature: Dimmer function of X10 module changed to match FS20
|
||||||
- feature: allow only meaningful readings (fill level > -5%) in USF1000
|
- feature: allow only meaningful readings (fill level > -5%) in USF1000
|
||||||
- feature: device attr links in commandref.html
|
- feature: device attr links in commandref.html
|
||||||
|
- bugfix: make BS known to CUL to avoid lost messages if both FHZ1300 and CUL
|
||||||
|
are connected, adjust matching rule
|
||||||
|
|
||||||
- 2010-03-13 (4.9)
|
- 2010-03-13 (4.9)
|
||||||
- bugfix: changed the fhem prompt from FHZ> to fhem>
|
- bugfix: changed the fhem prompt from FHZ> to fhem>
|
||||||
|
@ -55,19 +55,20 @@ CUL_Initialize($)
|
|||||||
$hash->{ReadFn} = "CUL_Read";
|
$hash->{ReadFn} = "CUL_Read";
|
||||||
$hash->{WriteFn} = "CUL_Write";
|
$hash->{WriteFn} = "CUL_Write";
|
||||||
$hash->{Clients} =
|
$hash->{Clients} =
|
||||||
":FS20:FHT:KS300:CUL_EM:CUL_WS:USF1000:HMS:CUL_FHTTK:CUL_RFR:FHT8V".
|
":FS20:FHT:KS300:CUL_EM:CUL_WS:USF1000:BS:HMS:CUL_FHTTK:CUL_RFR:FHT8V".
|
||||||
":CUL_HOERMANN:";
|
":CUL_HOERMANN:";
|
||||||
my %mc = (
|
my %mc = (
|
||||||
"1:USF1000" => "^81..(04|0c)..0101a001a5ceaa00....",
|
"1:USF1000" => "^81..(04|0c)..0101a001a5ceaa00....",
|
||||||
"2:FS20" => "^81..(04|0c)..0101a001",
|
"2:BS" => "^81..(04|0c)..0101a001a5cf",
|
||||||
"3:FHT" => "^81..(04|09|0d)..(0909a001|83098301|c409c401)..",
|
"3:FS20" => "^81..(04|0c)..0101a001",
|
||||||
"4:KS300" => "^810d04..4027a001",
|
"4:FHT" => "^81..(04|09|0d)..(0909a001|83098301|c409c401)..",
|
||||||
"5:CUL_WS" => "^K.....",
|
"5:KS300" => "^810d04..4027a001",
|
||||||
"6:CUL_EM" => "^E0.................\$",
|
"6:CUL_WS" => "^K.....",
|
||||||
"7:HMS" => "^810e04....(1|5|9).a001",
|
"7:CUL_EM" => "^E0.................\$",
|
||||||
"8:CUL_FHTTK" => "^T........",
|
"8:HMS" => "^810e04....(1|5|9).a001",
|
||||||
"9:CUL_RFR" => "^[0-9A-F]{4}U.",
|
"9:CUL_FHTTK" => "^T........",
|
||||||
"A:CUL_HOERMANN"=> "^R..........",
|
"A:CUL_RFR" => "^[0-9A-F]{4}U.",
|
||||||
|
"B:CUL_HOERMANN"=> "^R..........",
|
||||||
);
|
);
|
||||||
$hash->{MatchList} = \%mc;
|
$hash->{MatchList} = \%mc;
|
||||||
$hash->{ReadyFn} = "CUL_Ready";
|
$hash->{ReadyFn} = "CUL_Ready";
|
||||||
|
@ -60,7 +60,7 @@ FHZ_Initialize($)
|
|||||||
$hash->{Clients} = ":FHZ:FS20:FHT:HMS:KS300:USF1000:BS:";
|
$hash->{Clients} = ":FHZ:FS20:FHT:HMS:KS300:USF1000:BS:";
|
||||||
my %mc = (
|
my %mc = (
|
||||||
"1:USF1000" => "^81..(04|0c)..0101a001a5ceaa00....",
|
"1:USF1000" => "^81..(04|0c)..0101a001a5ceaa00....",
|
||||||
"2:BS" => "^81..(04|0c)..0101a001a5cf......",
|
"2:BS" => "^81..(04|0c)..0101a001a5cf",
|
||||||
"3:FS20" => "^81..(04|0c)..0101a001",
|
"3:FS20" => "^81..(04|0c)..0101a001",
|
||||||
"4:FHT" => "^81..(04|09|0d)..(0909a001|83098301|c409c401)..",
|
"4:FHT" => "^81..(04|09|0d)..(0909a001|83098301|c409c401)..",
|
||||||
"5:HMS" => "^810e04....(1|5|9).a001",
|
"5:HMS" => "^810e04....(1|5|9).a001",
|
||||||
|
@ -10,15 +10,13 @@ package main;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
my $PI= 3.141592653589793238;
|
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
sub
|
sub
|
||||||
BS_Initialize($)
|
BS_Initialize($)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
$hash->{Match} = "^81..(04|0c)..0101a001a5cf......";
|
$hash->{Match} = "^81..(04|0c)..0101a001a5cf";
|
||||||
$hash->{DefFn} = "BS_Define";
|
$hash->{DefFn} = "BS_Define";
|
||||||
$hash->{UndefFn} = "BS_Undef";
|
$hash->{UndefFn} = "BS_Undef";
|
||||||
$hash->{ParseFn} = "BS_Parse";
|
$hash->{ParseFn} = "BS_Parse";
|
||||||
@ -27,7 +25,6 @@ BS_Initialize($)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
sub
|
sub
|
||||||
BS_Define($$)
|
BS_Define($$)
|
||||||
@ -35,8 +32,8 @@ BS_Define($$)
|
|||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
|
|
||||||
my $u= "wrong syntax: define <name> BS <sensor> [RExt]";
|
my $u= "wrong syntax: define <name> BS <sensor> [[RExt] luxOffset]";
|
||||||
return $u if((int(@a)< 3) || (int(@a)>4));
|
return $u if((int(@a)< 3) || (int(@a)>5));
|
||||||
|
|
||||||
my $name = $a[0];
|
my $name = $a[0];
|
||||||
my $sensor = $a[2];
|
my $sensor = $a[2];
|
||||||
@ -46,9 +43,12 @@ BS_Define($$)
|
|||||||
$sensor= "0$sensor";
|
$sensor= "0$sensor";
|
||||||
|
|
||||||
my $RExt = 50000; # default is 50kOhm
|
my $RExt = 50000; # default is 50kOhm
|
||||||
$RExt= $a[3] if(int(@a)==4);
|
$RExt= $a[3] if(int(@a)>=4);
|
||||||
|
my $luxOffset= 0; # default is no offset
|
||||||
|
$luxOffset= $a[4] if(int(@a)>=5);
|
||||||
$hash->{SENSOR}= "$sensor";
|
$hash->{SENSOR}= "$sensor";
|
||||||
$hash->{RExt}= $RExt;
|
$hash->{RExt}= $RExt;
|
||||||
|
$hash->{luxOffset}= $luxOffset;
|
||||||
|
|
||||||
my $dev= "a5cf $sensor";
|
my $dev= "a5cf $sensor";
|
||||||
$hash->{DEF}= $dev;
|
$hash->{DEF}= $dev;
|
||||||
@ -97,12 +97,14 @@ BS_Parse($$)
|
|||||||
my $value= hex(substr($msg, 25, 3)) & 0x3ff;
|
my $value= hex(substr($msg, 25, 3)) & 0x3ff;
|
||||||
|
|
||||||
my $RExt= $def->{RExt};
|
my $RExt= $def->{RExt};
|
||||||
|
my $luxOffset= $def->{luxOffset};
|
||||||
my $brightness= $value/10.24; # Vout in percent of reference voltage 1.1V
|
my $brightness= $value/10.24; # Vout in percent of reference voltage 1.1V
|
||||||
|
|
||||||
# brightness in lux= 100lux*(VOut/RExt/1.8muA)^2;
|
# brightness in lux= 100lux*(VOut/RExt/1.8muA)^2;
|
||||||
my $VOut= $value*1.1/1024.0;
|
my $VOut= $value*1.1/1024.0;
|
||||||
my $temp= $VOut/$RExt/1.8E-6;
|
my $temp= $VOut/$RExt/1.8E-6;
|
||||||
my $lux= 100.0*$temp*$temp;
|
my $lux= 100.0*$temp*$temp;
|
||||||
|
$lux+= $luxOffset; # add lux offset
|
||||||
|
|
||||||
my $state= sprintf("brightness: %.2f lux: %.0f flags: %d",
|
my $state= sprintf("brightness: %.2f lux: %.0f flags: %d",
|
||||||
$brightness, $lux, $flags);
|
$brightness, $lux, $flags);
|
||||||
|
@ -205,6 +205,15 @@ DbLog_ParseEvent($$)
|
|||||||
if($reading eq "humidity") { $unit= "%"; }
|
if($reading eq "humidity") { $unit= "%"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# BS
|
||||||
|
elsif($type eq "BS") {
|
||||||
|
if($event =~ m(brightness:.*)) {
|
||||||
|
@parts= split(/ /,$event);
|
||||||
|
$reading= "lux";
|
||||||
|
$value= $parts[4]*1.;
|
||||||
|
$unit= "lux";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@result= ($reading,$value,$unit);
|
@result= ($reading,$value,$unit);
|
||||||
return @result;
|
return @result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user