Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for KS300 weather station #27

Open
tetzlav opened this issue Aug 12, 2020 · 1 comment
Open

Add support for KS300 weather station #27

tetzlav opened this issue Aug 12, 2020 · 1 comment

Comments

@tetzlav
Copy link

tetzlav commented Aug 12, 2020

The messages of KS300 are nearly the same as S300TH + rain and wind info:
https://github.com/mhop/fhem-mirror/blob/master/fhem/FHEM/13_KS300.pm

Please add support for KS300TH...

@tetzlav
Copy link
Author

tetzlav commented Sep 20, 2020

I think it would be enough to support the elementary parse of data. The modul 13_KS300.pm does unnecessary stuff.

The raw data the station send eg.:
RAW: K1756610500A3E0DD

But i dont really understand the perl code (https://github.com/mhop/fhem-mirror/blob/master/fhem/FHEM/14_CUL_WS.pm; 280ff):

    } elsif(@a == 15 && int(@a) > 14) {          # KS300/2
      my $c = $hash->{corr4} ? $hash->{corr4} : 255;
      $rain = sprintf("%0.1f", hex("$a[14]$a[11]$a[12]") * $c / 1000);
      $wnd  = sprintf("%0.1f", "$a[9]$a[10].$a[7]" + $hash->{corr3});
      $hum  = sprintf( "%02d", "$a[8]$a[5]" + $hash->{corr2});
      $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";

      $val = "T: $tmp  H: $hum  W: $wnd  R: $rain  IR: $ir";
      $devtype = "KS300/2";
      $family = "WS300";
      $NotifyType="T H W R IR";
      $NotifyTemperature=$tmp;
      $NotifyHumidity=$hum;
      $NotifyWind=$wnd;
      $NotifyRain=$rain;
      $NotifyIsRaining=$ir;

Why compare an array with an integer? Perl...!?

And i also dont understand the javascript in https://github.com/hobbyquaker/cul/blob/master/lib/ws.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant