50_HP1000.pm übergibt keine Nachkommastellen an logdb

Begonnen von flobeewan, 16 September 2019, 09:34:01

Vorheriges Thema - Nächstes Thema

flobeewan

Hi,
ich habe ein Problem mit meiner Wetterstation, logdb (SQLite3) und SVG. Bei den Devicelistings, Readings, ... werden alle Werte mit 1 bzw. 2 Nachkommastellen angezeigt. Soweit so gut. Allerdings werden diese beim loggen in eine SQLite3 DB über logdb abgeschnitten (nicht gerundet) und damit stimmen ganz viele SVG Plots nicht. Bei anderen Devices (zB Templogger funktioniert alles inkl. Nachkommastellen.
Hat jemand einen Tipp für mich, woran das liegen kann?
Ich habe schon viel gesucht aber immer nur Infos zu weniger Nachkommastellen bzw. runden gefunden.

Vielen Dank!
Liebe Grüße Florian

flobeewan

Hat denn niemand hier im Forum einen Hinweis für mich?  :(

flobeewan

 :'( :'( Hat denn wirklich niemand einen Tipp für mich, wie ich dem Problem Herr werden kann?
Grüße Florian

amenomade

#3
"list" von der Wetterstation und von der Definition der entspr. DbLog bitte
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

flobeewan

Hallo Amenomade!
Hier die gewünschten Details. Ich habe mittlerweile auf sql umgestellt, aber das Problem ist geblieben.
Internals:
   DEF        wetter wetterFBi
   FUUID      5d5748c3-f33f-360f-4260-e6e4d62ca217ecf7
   FVERSION   50_HP1000.pm:0.192630/2019-04-25
   FW         WEBweather
   ID         wetter
   INTERVAL   0
   IP         192.159.15.226
   NAME       Wetterstation
   NR         308
   PASSWORD   wetterFBi
   SERVER_TYPE php
   STATE      T: 3.0 °C, H: 86 %, P: 1011.2
   SWVERSION  WH2600 V2.2.8
   SYSTEMTIME_UTC 2012-08-22 2:14:45
   TYPE       HP1000
   UPLOAD_TYPE customize
   Helper:
     DBLOG:
       UV:
         logdb:
           TIME       1573310596.83321
           VALUE      1
       UVR:
         logdb:
           TIME       1573310596.83321
           VALUE      551
       humidity:
         logdb:
           TIME       1573310815.29849
           VALUE      86
       luminosity:
         logdb:
           TIME       1573310935.29032
           VALUE      5664
       pressure:
         logdb:
           TIME       1573310935.29032
           VALUE      1011
       rain_day:
         logdb:
           TIME       1573310596.83321
           VALUE      2
       rain_month:
         logdb:
           TIME       1573310596.83321
           VALUE      40
       rain_week:
         logdb:
           TIME       1573310596.83321
           VALUE      40
       solarradiation:
         logdb:
           TIME       1573310935.29032
           VALUE      45
       temperature:
         logdb:
           TIME       1573310596.83321
           VALUE      3.0
       wind_direction:
         logdb:
           TIME       1573310935.29032
           VALUE      112
       wind_gust:
         logdb:
           TIME       1573310935.29032
           VALUE      7
       wind_gust_mps:
         logdb:
           TIME       1573310935.29032
           VALUE      2
       wind_speed:
         logdb:
           TIME       1573310935.29032
           VALUE      6
       wind_speed_mps:
         logdb:
           TIME       1573310935.29032
           VALUE      1
   READINGS:
     2019-11-09 00:37:26   Activity        alive
     2019-11-09 15:48:55   UV              1
     2019-11-09 15:48:55   UVR             551
     2019-10-09 13:09:56   UVcondition     low
     2019-10-09 13:09:56   UVcondition_rgb 4C9329
     2019-11-09 15:43:16   condition       cloudy
     2019-11-09 15:43:16   daylight        1
     2019-11-09 15:48:55   dewpoint        0.9
     2019-11-09 15:48:55   dewpoint_f      33.6
     2019-11-09 15:48:55   humidity        86
     2019-11-09 15:48:55   humidityAbs     5.1
     2019-11-09 15:48:55   humidityAbs_f   38.4
     2019-11-07 20:37:47   humidityCondition wet
     2019-11-07 20:37:47   humidityCondition_rgb 0066CC
     2019-11-09 15:48:55   indoorDewpoint  12.3
     2019-11-09 15:48:55   indoorDewpoint_f 57.7
     2019-11-09 15:48:55   indoorHumidity  56
     2019-11-09 15:48:55   indoorHumidityAbs 10.5
     2019-11-09 15:48:55   indoorHumidityAbs_f 113.3
     2019-10-21 11:41:27   indoorHumidityCondition ideal
     2019-10-21 11:41:27   indoorHumidityCondition_rgb 4C9329
     2019-11-09 15:48:55   indoorTemperature 21.4
     2019-10-21 11:41:27   indoorTemperatureCondition ideal
     2019-10-21 11:41:27   indoorTemperatureCondition_rgb 4C9329
     2019-11-09 15:48:55   indoorTemperature_f 70.5
     2019-11-09 00:37:26   israining       0
     2019-11-09 15:48:55   luminosity      5664.8
     2019-11-09 15:48:55   pressure        1011.2
     2019-11-09 15:48:55   pressure_in     29.86
     2019-11-09 15:48:55   pressure_mm     7.6
     2019-11-09 15:48:55   rain            0.0
     2019-11-09 15:48:55   rain_day        2.0
     2019-11-09 15:48:55   rain_day_in     0.08
     2019-11-09 15:48:55   rain_in         0.00
     2019-11-09 15:48:55   rain_month      40.1
     2019-11-09 15:48:55   rain_month_in   1.58
     2019-11-09 15:48:55   rain_week       40.1
     2019-11-09 15:48:55   rain_week_in    1.58
     2019-11-09 15:48:55   rain_year       276.4
     2019-11-09 15:48:55   rain_year_in    10.88
     2019-11-09 15:48:55   solarradiation  44.71
     2019-11-09 15:48:55   state           T: 3,0 °C H: 86 %
     2019-11-09 15:48:55   temperature     3.0
     2019-11-09 15:48:55   temperature_f   37.4
     2019-11-09 15:48:55   wind_chill      1.4
     2019-11-09 15:48:55   wind_chill_f    34.5
     2019-11-09 15:48:55   wind_compasspoint ESE
     2019-11-09 15:48:55   wind_direction  112
     2019-11-09 15:48:55   wind_gust       7.9
     2019-11-09 15:48:55   wind_gust_bft   2
     2019-11-09 15:48:55   wind_gust_fts   7.2
     2019-11-09 15:48:55   wind_gust_kn    4.3
     2019-11-09 15:48:55   wind_gust_mph   4.92
     2019-11-09 15:48:55   wind_gust_mps   2.2
     2019-11-09 15:48:55   wind_speed      6.1
     2019-11-09 15:48:55   wind_speed_bft  2
     2019-11-09 15:48:55   wind_speed_fts  5.6
     2019-11-09 15:48:55   wind_speed_kn   3.3
     2019-11-09 15:48:55   wind_speed_mph  3.80
     2019-11-09 15:48:55   wind_speed_mps  1.7
   fhem:
     infix      updateweatherstation
Attributes:
   DbLogExclude wind_speed_mph,wind_speed_kn,wind_speed_fts,wind_speed_bft,wind_gust_mph,wind_gust_kn,wind_gust_fts,wind_gust_bft,temperature_f,rain_year_in,rain_week_in,rain_month_in,rain_day_in,rain_in,pressure_mm,pressure_in,humidityAbs,humidityAbs_f,humidityCondition,humidityCondition_rgb,rain_year
   event-min-interval 900
   event-on-change-reading UV,UVR,humidity,luminosity,pressure,rain,rain_day,rain_month,rain_week,rain_year,solarradiation,temperature,wind_direction,wind_speed,wind_speed_mps,wind_gust,wind_gust_mps
   room       Sensoren,CUL_HM,TEST
   stateFormat T: temperature °C, H: humidity %, P: pressure
   stateReadings temperature humidity
   stateReadingsFormat 1
   suppressReading wind_speed_mph,wind_speed_kn,wind_speed_fts,wind_speed_bft,wind_gust_mph,wind_gust_kn,wind_gust_fts,wind_gust_bft,temperature_f,rain_year_in,rain_week_in,rain_month_in,rain_day_in,rain_in,pressure_mm,pressure_in,humidityAbs,humidityAbs_f,humidityCondition,humidityCondition_rgb,rain_year
   webhookFWinstances WEBweather


Internals:
   COLUMNS    field length used for Device: 64, Type: 64, Event: 512, Reading: 64, Value: 128, Unit: 32
   CONFIGURATION ./db.conf
   DEF        ./db.conf .*:(desired|T|measured-temp|temperature|S300IA|d_T_Diff|6T.Kollektor|6T.Aussen|kWh-qm-IST|kWh-qm-SOLL|level|UV|UVR|UVcondition|humidity|pressure|rain|rain_day|solarradiation|wind_direction|wind_speed|wind_speed_mps|wind_gust_mps|wind_gust|israining|luminosity|S.Preis|G.Preis|WAN-Status).*
   FUUID      5c5c0d8f-f33f-360f-40f3-587618b71759a9d7
   FVERSION   93_DbLog.pm:v4.8.0-s20445/2019-11-03
   MODE       asynchronous
   MODEL      MYSQL
   NAME       logdb
   NR         16
   NTFY_ORDER 50-logdb
   PID        11056
   REGEXP     .*:(desired|T|measured-temp|temperature|S300IA|d_T_Diff|6T.Kollektor|6T.Aussen|kWh-qm-IST|kWh-qm-SOLL|level|UV|UVR|UVcondition|humidity|pressure|rain|rain_day|solarradiation|wind_direction|wind_speed|wind_speed_mps|wind_gust_mps|wind_gust|israining|luminosity|S.Preis|G.Preis|WAN-Status).*
   STATE      connected
   TYPE       DbLog
   UTF8       1
   dbconn     mysql:database=fhem;host=router-bkp;port=3306
   dbuser     fhemuser
   HELPER:
     COLSET     1
     DEVICECOL  64
     EVENTCOL   512
     OLDSTATE   connected
     PACKAGE    main
     READINGCOL 64
     TC         current
     TH         history
     TYPECOL    64
     UNITCOL    32
     VALUECOL   128
     VERSION    4.8.0
   READINGS:
     2019-11-09 15:53:27   CacheUsage      2
     2019-08-18 13:17:04   DbFileSize      2
     2019-11-09 15:53:13   NextSync        2019-11-09 16:03:13 or if CacheUsage 500 reached
     2019-10-21 10:55:31   countCurrent    66
     2019-10-21 10:55:31   countHistory    413
     2019-08-18 13:17:04   reduceLogState  Rows processed: 0, deleted: 0, time: 0.00sec
     2019-11-09 15:53:13   state           connected
Attributes:
   DbLogType  Current/History
   asyncMode  1
   group      Server
   room       CUL_HM,Logfiles,TEST
   syncInterval 600



Hoffentlich findest du etwas! Vielen Dank
Grüße Florian

amenomade

Ne, hier kann ich nichts finden.
Wie stellst Du fest, dass in der DB die Werte abgeschnitten werden?

Was ergibt z.B. get logdb current ALL - - Wetterstation:temperature o. humidity?
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Otto123

Nicht das danach gesucht wird?
Zitat2019-11-09 15:48:55   state           T: 3,0 °C H: 86 %

Gruß Otto
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

amenomade

Ja, aber STATE      T: 3.0 °C, H: 86 %, P: 1011.2

Deswegen interessiert mich das get direkt aus der DBLog ;)
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

flobeewan

Hier das Ergebnis zum "get logdb current ALL - - Wetterstation:temperature"
Timestamp: Device, Type, Event, Reading, Value, Unit
=====================================================
2019-11-09 20:38:56: Wetterstation, HP1000, temperature: 0.8, temperature, 0.8, °C
2019-11-09 20:38:56: Wetterstation, HP1000, temperature: 0.8, temperature, 0.8, °C
#Wetterstation:temperature:::


aufgefallen ist mir das ganze beim Wetterstation:wind_speed_mps (SVG:preprocessed input) hier gibt es keine nachkommastellen.
wobei im "list wetterstation" ein wind_speed_mps  1.7 angezeigt wird.

Ein get logdb history ALL - - Wetterstation:wind_speed_mps ergibt folgendes Ergebnis:

Timestamp: Device, Type, Event, Reading, Value, Unit
=====================================================
2019-11-09 01:16:20: Wetterstation, HP1000, wind_speed_mps: 1.5, wind_speed_mps, 1, m
2019-11-09 01:16:22: Wetterstation, HP1000, wind_speed_mps: 2.0, wind_speed_mps, 2, m
2019-11-09 01:18:01: Wetterstation, HP1000, wind_speed_mps: 2.8, wind_speed_mps, 2, m
...

Hier gibt es einen Unterschied zw. Event und Reading+Value. Schlau werde ich daraus aber nicht.

amenomade

#9
Zitat von: flobeewan am 09 November 2019, 21:03:07

Ein get logdb history ALL - - Wetterstation:wind_speed_mps ergibt folgendes Ergebnis:

Timestamp: Device, Type, Event, Reading, Value, Unit
=====================================================
2019-11-09 01:16:20: Wetterstation, HP1000, wind_speed_mps: 1.5, wind_speed_mps, 1, m
2019-11-09 01:16:22: Wetterstation, HP1000, wind_speed_mps: 2.0, wind_speed_mps, 2, m
2019-11-09 01:18:01: Wetterstation, HP1000, wind_speed_mps: 2.8, wind_speed_mps, 2, m
...



Und bei get logdb current ALL - - Wetterstation:wind_speed_mps, sind auch die Nachkommastellen weg?
Wenn nein, hast Du mal ein set reduceLog gemacht?
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

amenomade

#10
Das ist schon merkwürdig, weil im Event 1.5 steht und in Value dann 1... Und woher holt er sich diese Unit = m...

Und im Reading
     2019-11-09 15:48:55   wind_speed_mps  1.7

Im Helper:
       wind_speed_mps:
         logdb:
           TIME       1573310935.29032
           VALUE      1
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

amenomade

Kannst Du bitte verbose 5 auf der Wetterstration setzen, und die Log nach einer Aktualisierung posten?
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

flobeewan

Hier die Logeinträge:
2019.11.09 23:17:00 5: HP1000 Wetterstation: called function HP1000_SetAliveState()
2019.11.09 23:17:00 5: HP1000: received data (uptime=27233.3110659122):
$VAR1 = {
          'rtfreq' => '5',
          'yearlyrainin' => '10.88',
          'indoorhumidity' => '55',
          'windchillf' => '31.6',
          'action' => 'updateraw',
          'softwaretype' => 'WH2600 V2.2.8',
          'PASSWORD' => 'wetterFBi',
          'humidity' => '94',
          'UV' => '0',
          'solarradiation' => '0.00',
          'baromin' => '29.84',
          'dailyrainin' => '0.08',
          'dateutc' => '2012-08-22 2:14:45',
          'ID' => 'wetter',
          'windgustmph' => '2.46',
          'winddir' => '212',
          'windspeedmph' => '1.57',
          'tempf' => '31.6',
          'dewptf' => '30.0',
          'indoortempf' => '70.7',
          'rainin' => '0.00',
          'monthlyrainin' => '1.58',
          'weeklyrainin' => '1.58',
          'realtime' => '1'
        };

2019.11.09 23:17:00 5: HP1000: Adding calculated value for dewpoint=-1.1 from dewptf=30.0
2019.11.09 23:17:00 5: HP1000: Adding calculated value for outtemp=-0.2 from tempf=31.6
2019.11.09 23:17:00 5: HP1000: Adding calculated value for intemp=21.5 from indoortempf=70.7
2019.11.09 23:17:00 5: HP1000: Adding calculated value for windchill=-0.2 from windchillf=31.6
2019.11.09 23:17:00 5: HP1000: Adding calculated value for relbaro=1010.5 from baromin=29.84
2019.11.09 23:17:00 5: HP1000: Adding calculated value for rainrate=0.0 from rainin=0.00
2019.11.09 23:17:00 5: HP1000: Adding calculated value for dailyrain=2.0 from dailyrainin=0.08
2019.11.09 23:17:00 5: HP1000: Adding calculated value for weeklyrain=40.1 from weeklyrainin=1.58
2019.11.09 23:17:00 5: HP1000: Adding calculated value for monthlyrain=40.1 from monthlyrainin=1.58
2019.11.09 23:17:00 5: HP1000: Adding calculated value for yearlyrain=276.4 from yearlyrainin=10.88
2019.11.09 23:17:00 5: HP1000: Adding calculated value for windgustmps=1.1 from windgustmph=2.46
2019.11.09 23:17:00 5: HP1000: Adding calculated value for windspeedmps=0.7 from windspeedmph=1.57
2019.11.09 23:17:00 5: HP1000: Adding calculated value for windgust=4.0 from windgustmps=1.1
2019.11.09 23:17:00 5: HP1000: Adding calculated value for windspeed from windspeedmps
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation temperature: including HASH from module X_Initialize() function
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation temperature: including HASH from module X_Initialize() function
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation humidity: including HASH from module X_Initialize() function
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation humidity: including HASH from module X_Initialize() function
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation wind_speed_mps: including HASH from module X_Initialize() function
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation wind_speed_mps: including HASH from module X_Initialize() function
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation wind_direction: including HASH from module X_Initialize() function
2019.11.09 23:17:00 4: RType: formatValue Wetterstation wind_direction: scope: WARNING - 212 is not lt 22.5. 22.5 is not equal to 360.
2019.11.09 23:17:00 4: RType: formatValue Wetterstation wind_direction: scope: WARNING - 212 is not lt 45.
2019.11.09 23:17:00 4: RType: formatValue Wetterstation wind_direction: scope: WARNING - 212 is not lt 67.5.
2019.11.09 23:17:00 4: RType: formatValue Wetterstation wind_direction: scope: WARNING - 212 is not lt 90.
2019.11.09 23:17:00 4: RType: formatValue Wetterstation wind_direction: scope: WARNING - 212 is not lt 112.5.
2019.11.09 23:17:00 4: RType: formatValue Wetterstation wind_direction: scope: WARNING - 212 is not lt 135.
2019.11.09 23:17:00 4: RType: formatValue Wetterstation wind_direction: scope: WARNING - 212 is not lt 157.5.
2019.11.09 23:17:00 4: RType: formatValue Wetterstation wind_direction: scope: WARNING - 212 is not lt 180.
2019.11.09 23:17:00 4: RType: formatValue Wetterstation wind_direction: scope: WARNING - 212 is not lt 202.5.
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation wind_direction: including HASH from module X_Initialize() function
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation wind_speed: including HASH from module X_Initialize() function
2019.11.09 23:17:00 5: getCombinedKeyValAttr Wetterstation wind_speed: including HASH from module X_Initialize() function


Herzlichen Dank schon mal für deine Bemühungen.

DS_Starter

Hallo miteinander,

amenomade hat mich hergelockt  ;), sonst wäre ich nicht auf den Thread aufmerksam geworden ... danke dir !

Ich vermute, die Ursache liegt etwas tiefer.
Loredo ? hat im Modul löblicherweise DbLog_splitFn definiert. Diese Funktion nimmt das Splitting der Events für die Datenbankspeicherung vor.


    $hash->{DefFn}         = "HP1000_Define";
    $hash->{UndefFn}       = "HP1000_Undefine";
    $hash->{DbLog_splitFn} = "Unit_DbLog_split";


Es soll also die Funktion Unit_DbLog_split aufgerufen werden. Im Modul HP1000 habe ich die Funktion nicht gefunden, sie befindet sich aber im Modul Unit.pm.
Ich habe mir diese Funktion nicht genau angeschaut, aber hier wäre anzusetzen.

Wenn man im DbLog verbose 5 einschaltet, erkennt man den verarbeiteten Event und was der Splitparser (in diesem Fall Unit_DbLog_split) daraus macht. Die Zeile "added event" ist zu vergleichen:

2019.11.09 23:59:00.427 4: DbLog LogDB -> check Device: SMA_Energymeter , Event: state: -626.4
2019.11.09 23:59:00.430 5: DbLog LogDB -> parsed Event: SMA_Energymeter , Event: state: -626.4
2019.11.09 23:59:00.432 4: DbLog LogDB -> added event - Timestamp: 2019-11-09 23:59:00, Device: SMA_Energymeter, Type: SMAEM, Event: state: -626.4, Reading: state, Value: -626.4, Unit:

Ich würde raten, bei Loredo mal nachzufragen.

LG,
Heiko
ESXi@NUC+Debian+MariaDB, PV: SMA, Victron MPII+Pylontech+CerboGX
Maintainer: SSCam, SSChatBot, SSCal, SSFile, DbLog/DbRep, Log2Syslog, SolarForecast,Watches, Dashboard, PylonLowVoltage
Kaffeekasse: https://www.paypal.me/HMaaz
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/DS_Starter

amenomade

Danke für die Analyse! Das overloading von splitFn hatte ich nicht gesehen. OK, ich hole Loredo dazu ;)
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus