diff --git a/FHEM/09_BS.pm b/FHEM/09_BS.pm index a6c5b2372..620a9e4bc 100644 --- a/FHEM/09_BS.pm +++ b/FHEM/09_BS.pm @@ -24,7 +24,7 @@ BS_Initialize($) $hash->{DefFn} = "BS_Define"; $hash->{UndefFn} = "BS_Undef"; $hash->{ParseFn} = "BS_Parse"; - $hash->{AttrList} = "IODev do_not_notify:1,0 showtime:0,1 dummy:1,0 model:BSs loglevel:0,1,2,3,4,5,6"; + $hash->{AttrList} = "IODev do_not_notify:1,0 showtime:0,1 dummy:1,0 model:BS loglevel:0,1,2,3,4,5,6"; } @@ -36,20 +36,20 @@ BS_Define($$) my ($hash, $def) = @_; my @a = split("[ \t][ \t]*", $def); - my $u= "wrong syntax: define BS [factor]"; + my $u= "wrong syntax: define BS [RExt]"; return $u if((int(@a)< 3) || (int(@a)>4)); my $name = $a[0]; my $sensor = $a[2]; - if($sensor !~ /[1..9]/) { + if($sensor !~ /[123456789]/) { return "erroneous sensor specification $sensor, use one of 1..9"; } $sensor= "0$sensor"; - my $factor = 1.0; - $factor= $a[3] if(int(@a)==4); + my $RExt = 50000; # default is 50kOhm + $RExt= $a[3] if(int(@a)==4); $hash->{SENSOR}= "$sensor"; - $hash->{FACTOR}= $factor; + $hash->{RExt}= $RExt; my $dev= "a5cf $sensor"; $hash->{DEF}= $dev; @@ -96,10 +96,16 @@ BS_Parse($$) my $flags= hex(substr($msg, 24, 1)) & 0xdc; my $value= hex(substr($msg, 25, 3)) & 0x3ff; - my $factor= $def->{FACTOR}; - my $brightness= $value/10.24*$factor; + my $RExt= $def->{RExt}; + my $brightness= $value/10.24; # Vout in percent of reference voltage 1.1V - my $state= sprintf("brightness: %.2f flags: %d", $brightness, $flags); + # brightness in lux= 100lux*(VOut/RExt/1.8muA)^2; + my $VOut= $value*1.1/1024.0; + my $temp= $VOut/$RExt/1.8E-6; + my $lux= 100.0*$temp*$temp; + + my $state= sprintf("brightness: %.2f lux: %.0f flags: %d", + $brightness, $lux, $flags); $def->{CHANGED}[0] = $state; $def->{STATE} = $state; @@ -109,6 +115,8 @@ BS_Parse($$) $def->{READINGS}{brightness}{TIME} = $t; $def->{READINGS}{brightness}{VAL} = $brightness; + $def->{READINGS}{lux}{TIME} = $t; + $def->{READINGS}{lux}{VAL} = $lux; $def->{READINGS}{flags}{TIME} = $t; $def->{READINGS}{flags}{VAL} = $flags; diff --git a/FHEM/11_FHT.pm b/FHEM/11_FHT.pm index ac0d9c24f..a6f997985 100755 --- a/FHEM/11_FHT.pm +++ b/FHEM/11_FHT.pm @@ -144,7 +144,7 @@ FHT_Initialize($) $hash->{UndefFn} = "FHT_Undef"; $hash->{ParseFn} = "FHT_Parse"; $hash->{AttrList} = "IODev do_not_notify:0,1 model;fht80b dummy:0,1 " . - "showtime:0,1 loglevel:0,1,2,3,4,5,6 retrycount minfhtbuffer". + "showtime:0,1 loglevel:0,1,2,3,4,5,6 retrycount minfhtbuffer ". "lazy tmpcorr"; } @@ -237,7 +237,9 @@ FHT_Set($@) } - if($lazy && defined($readings->{$cmd}) && $readings->{$cmd}{VAL} eq $val) { + if($lazy && + $cmd ne "report1" && $cmd ne "report2" && $cmd ne "refreshvalues" && + defined($readings->{$cmd}) && $readings->{$cmd}{VAL} eq $val) { $ret .= "Lazy mode ignores $cmd"; Log GetLogLevel($name,2), "Lazy mode ignores $cmd $val"; diff --git a/HISTORY b/HISTORY index 12b16175f..bb1f1e45d 100644 --- a/HISTORY +++ b/HISTORY @@ -425,4 +425,11 @@ - 00_CM11.pm: feature: get time, fwrev, set reopen for CM11 (Boris 2009-09-12) - Sun Sep 20 2009 (Boris) - - Module 09_BS.pm for brightness sensor added (Boris 2009-09-20) \ No newline at end of file + - Module 09_BS.pm for brightness sensor added (Boris 2009-09-20) + +- Sat Oct 03 2009 (Boris) + - bugfix: missing blank in attribute list for FHT; exclude report from lazy + - typos and anchors in documentation corrected + + - Sun Oct11 2009 (Boris) + - finalized 09_BS.pm and documentation diff --git a/docs/commandref.html b/docs/commandref.html index ed723e95e..f08ce8054 100644 --- a/docs/commandref.html +++ b/docs/commandref.html @@ -49,6 +49,7 @@
    global
    + BS   CM11   CUL   CUL_EM   @@ -1009,7 +1010,7 @@ A line ending with \ will be concatenated with the next one, so long lines Disable FileLog/notify/inform notification for a device. This affects the received signal, the set and trigger commands.
    -
  • dummy

  • +
  • dummy

  • filtertimeout
    @@ -1425,7 +1426,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes
    • do_not_notify

    • -
    • dummy

    • +
    • dummy

    • loglevel

    • model (fht80b)

    • showtime

    • @@ -1625,7 +1626,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes
      • do_not_notify

      • -
      • dummy

      • +
      • dummy

      • filtertimeout

      • repeater

      • showtime

      • @@ -1787,7 +1788,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes
        @@ -1849,7 +1850,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes @@ -1903,7 +1904,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes @@ -1950,7 +1951,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes @@ -2078,7 +2079,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes @@ -2182,7 +2183,7 @@ A line ending with \ will be concatenated with the next one, so long lines + +

        BS

        +
          + The module BS allows to collect data from a brightness sensor through a + FHZ device. For details on the brightness sensor see + busware wiki. + You can have at most nine different brightness sensors in range of your + FHZ.
          +
          + + The state contains the brightness in % (reading brightness) and + the brightness in lux (reading lux). The flags + reading is always zero. The meaning of these readings is explained in more + detail on the above mentioned wiki page.
          +
          + + + Define +
            + define <name> BS <sensor#> [<RExt>] +

            + + <sensor#> is the number of sensor in the brightness + sensor address system that runs from 1 to 9.
            +
            + <RExt> is the value of the resistor on your brightness + sensor in Ω (Ohm). The brightness reading in % is proportional to the resistance, the + lux reading is proportional to the resistance squared. The value is + optional. The default resistance is RExt= 50.000Ω.
            +
            + + Example:
            +
              + define bs1 BS 1 40000
              +
            +
          +
          + + Set +
            + N/A +
          +
          + + Get +
            + N/A +
          +
          + + Attributes + +
          + +
        + + +

        SCIVT

        @@ -2610,7 +2674,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes @@ -2657,7 +2721,7 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes