2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

98_ModbusElsnerWS: windStrength calculation corrected

git-svn-id: https://svn.fhem.de/fhem/trunk@22864 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
klaus.schauer 2020-09-27 06:42:19 +00:00
parent f84e255c45
commit cfb3880a11

View File

@ -4,6 +4,7 @@
package main;
use strict;
use warnings;
use DevIo;
sub ModbusElsnerWS_Initialize($);
my %ModbusElsnerWS_ParseInfo = (
@ -42,7 +43,6 @@ my %ModbusElsnerWS_DeviceInfo = (
sub ModbusElsnerWS_Initialize($) {
my ($hash) = @_;
require "$attr{global}{modpath}/FHEM/DevIo.pm";
LoadModule "Modbus";
$hash->{parseInfo} = \%ModbusElsnerWS_ParseInfo; # defines registers, inputs, coils etc. for this Modbus Device
@ -202,7 +202,7 @@ sub ModbusElsnerWS_Eval($$$) {
$windSpeed = ModbusElsnerWS_readingsBulkUpdate($hash, "windSpeed", $windSpeed, 0.1, 0.3, "%0.1f");
my @windStrength = (0.2, 1.5, 3.3, 5.4, 7.9, 10.7, 13.8, 17.1, 20.7, 24.4, 28.4, 32.6);
my $windStrength = 0;
while($windSpeed > $windStrength[$windStrength] && $windStrength <= @windStrength + 1) {
while($windSpeed > $windStrength[$windStrength] && $windStrength < @windStrength) {
$windStrength ++;
}
if ($hash->{INTERVAL} =~ m/^1$/ && (!exists($hash->{helper}{timer}{lastUpdate}) || $hash->{helper}{timer}{lastUpdate} < gettimeofday() - 60)) {