[gelöst] userReadings tut nicht wie es soll

Begonnen von EinEinfach, 20 Januar 2021, 15:47:41

Vorheriges Thema - Nächstes Thema

EinEinfach

Hallo zusammen,

ich bin gerade am verzweifeln und verstehe das Verhalten von meinem userReadings nicht, folgende definition:
ExportedRAW:X_Meter_1_M_Exported.*
{
max(ReadingsNum("DR.PV1","X_Meter_1_M_Exported","0"),ReadingsNum("DR.PV1","ExportedRAW","0"))
}


X_Meter_1_M_Exported = 11478
ExportedRAW = 9466

Warum liefert die obere Defintion immer 9466 zurück? Ändere ich auf
{
min(ReadingsNum("DR.PV1","X_Meter_1_M_Exported","0"),ReadingsNum("DR.PV1","ExportedRAW","0"))
}


kommt 11478

:-[
fhem auf Intel NUC6CAYH mit Proxmox im LXC (Debian 10), KNX mit knxd über MDT SCN-IP000.02, Buderus GB192-15i über KM100, Solaredge WR SE9K über Modbus-TCP

betateilchen

zeig doch mal das komplette listing von DR.PV1

-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

KölnSolar

...und ändert das ExportedRAW:X_Meter_1_M_Exported.*
{
return max(ReadingsNum("DR.PV1","X_Meter_1_M_Exported","0"),ReadingsNum("DR.PV1","ExportedRAW","0"))
}

etwas ?
RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-GT-TMBBQ-01e-CUL868-FS20-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty_Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)-zigbee2mqtt

Beta-User

min() und max() vs. minNum() und maxNum()...?
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

EinEinfach

Internals:
   DEF        2 60 192.168.2.10:1502 TCP
   DeviceName 192.168.2.10:1502
   EXPECT     idle
   FD         16
   FUUID      5ff572c1-f33f-c57e-d890-7a5cbb063825d0f7
   IODev      DR.PV1
   Interval   60
   LASTOPEN   1611154222.38332
   MODBUSID   2
   MODE       master
   MODEL      SE9K-RW0TEBNN4 : SE-MTR-3Y-400V-A
   MODEL_METER SE-MTR-3Y-400V-A
   MODEL_WR   SE9K-RW0TEBNN4
   MODULEVERSION Modbus 4.3.10 - 29.12.2020
   NAME       DR.PV1
   NOTIFYDEV  global
   NR         181
   NTFY_ORDER 50-DR.PV1
   PARTIAL   
   PROTOCOL   TCP
   STATE      <table border=0 bordercolor='green' cellspacing=0 align='center'><tr><th><h1>Gesamtenergie 53.51 kWh </h1> </td></tr></table><table border=3 bordercolor='green' cellspacing=0 align='center'><tr><th>Status</th><td>Inverter is ON and producing power</td></tr><tr><th>Temperatur</th><td align='right'>42 °C</td></tr><tr><th>Leistung DC</th><td align='right'>312.7 W</td></tr><tr><th>Leistung AC</th><td align='right'>308 W</td></tr><tr><th>Spannung DC</th><td align='right'>750.2 V-</td></tr><tr><th>Strom AC</th><td align='right'>1.88 A~</td></tr></table><br>
   TCPConn    1
   TYPE       SolarEdge
   devioLoglevel 3
   nextOpenDelay 60
   Helper:
     DBLOG:
       AutarkieToday:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      58.6042311661507
       AutarkieWeek:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      23.9717871210039
       CurrentExport:
         SYS.DBLog:
           TIME       1611154565.10039
           VALUE      -2015
       CurrentImport:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      0
       CurrentOwnConsumption:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      5
       CurrentProduction:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      5
       ExportMonth:
         SYS.DBLog:
           TIME       1611154565.10039
           VALUE      6257
       ExportToday:
         SYS.DBLog:
           TIME       1611154565.10039
           VALUE      527
       ExportWeek:
         SYS.DBLog:
           TIME       1611154565.10039
           VALUE      339
       I_AC_Current:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      1.88
       I_AC_Current_A:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      0.62
       I_AC_Current_B:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      0.64
       I_AC_Current_C:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      0.61
       I_AC_Energy_WH:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      53505
       I_AC_Power:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      308
       I_AC_VA:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      422.8
       I_AC_Voltage_AN:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      223.8
       I_AC_Voltage_BN:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      223.8
       I_AC_Voltage_CN:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      225.5
       I_DC_Current:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      0.4168
       I_DC_Power:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      312.7
       I_DC_Voltage:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      750.2
       I_Status:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      Inverter is ON and producing power
       I_Temp_HeatSink:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      41 °C
       ImportMonth:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      22137
       ImportToday:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      3209
       ImportWeek:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      8300
       OwnConsumption:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      42024
       OwnConsumptionMonth:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      14573
       OwnConsumptionToday:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      4543
       OwnConsumptionWeek:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      2617
       ProductionMonth:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      22845
       ProductionWeek:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      4971
       X_Meter_1_M_AC_Current:
         SYS.DBLog:
           TIME       1611154523.85305
           VALUE      1.3
       X_Meter_1_M_AC_Current_A:
         SYS.DBLog:
           TIME       1611154523.85305
           VALUE      0.4
       X_Meter_1_M_AC_Power:
         SYS.DBLog:
           TIME       1611154523.85305
           VALUE      -1
       X_Meter_1_M_AC_Power_A:
         SYS.DBLog:
           TIME       1611154523.85305
           VALUE      17
       X_Meter_1_M_AC_Power_B:
         SYS.DBLog:
           TIME       1611154523.85305
           VALUE      -40
       X_Meter_1_M_AC_Power_C:
         SYS.DBLog:
           TIME       1611154523.85305
           VALUE      21
       X_Meter_1_M_Exported_A:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      4390
       X_Meter_1_M_Exported_B:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      4001
       X_Meter_1_M_Exported_C:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      4613
       X_Meter_1_M_Imported:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      174432
       X_Meter_1_M_Imported_A:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      54718
       X_Meter_1_M_Imported_B:
         SYS.DBLog:
           TIME       1611154523.9696
           VALUE      56680
       X_PV_Energy:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      53505
       X_PV_EnergyToday:
         SYS.DBLog:
           TIME       1611154523.65899
           VALUE      379
   QUEUE:
   READ:
     BUFFER     
   READINGS:
     2021-01-20 15:55:23   AutarkieToday   58.6042311661507
     2021-01-20 15:55:23   AutarkieWeek    23.9717871210039
     2021-01-20 15:55:24   Battery_1_DeviceID 255
     2021-01-20 15:50:25   Battery_1_Firmware
     2021-01-20 15:55:24   Battery_1_Instantaneous_Current_A -3.40282346638529e+38
     2021-01-20 15:55:24   Battery_1_Instantaneous_Power_W 0
     2021-01-20 15:55:24   Battery_1_Instantaneous_Voltage_V -3.40282346638529e+38
     2021-01-20 15:50:25   Battery_1_Manufacturer_Name
     2021-01-20 15:55:24   Battery_1_Max_Charge_Continues_Power_W -3.40282346638529e+38
     2021-01-20 15:55:24   Battery_1_Max_Charge_Peak_Power_W -3.40282346638529e+38
     2021-01-20 15:55:24   Battery_1_Max_Discharge_Continues_Power_W -3.40282346638529e+38
     2021-01-20 15:55:24   Battery_1_Max_Discharge_Peak_Power_W -3.40282346638529e+38
     2021-01-20 15:50:25   Battery_1_Model
     2021-01-20 15:55:24   Battery_1_Rated_Energy_WH -3.40282346638529e+38
     2021-01-20 15:55:24   Battery_1_SOE   -3.40282346638529e+38
     2021-01-20 15:55:24   Battery_1_SOH   -3.40282346638529e+38
     2021-01-20 15:50:25   Battery_1_SerialNumber
     2021-01-20 15:55:24   Battery_1_Status 7
     2021-01-20 15:55:23   Block_AC_Current 5 188 62 64 61 -2
     2021-01-20 15:55:23   Block_AC_Energy_WH 5 53505 0 0 0 0
     2021-01-20 15:55:23   Block_AC_Frequency 5 5001 -2 0 0 0
     2021-01-20 15:55:23   Block_AC_PF     5 58252 -2 0 0 0
     2021-01-20 15:55:23   Block_AC_Power  5 3080 -1 0 0 0
     2021-01-20 15:55:23   Block_AC_VA     5 4228 -1 0 0 0
     2021-01-20 15:55:23   Block_AC_VAR    5 28970 -2 0 0 0
     2021-01-20 15:55:23   Block_AC_Voltage 9 3883 3888 3888 2238 2238 2255 -1 0 0
     2021-01-20 15:50:23   Block_C_Model   5 SE9K-RW0TEBNN4 0 0 0 0
     2021-01-20 15:55:23   Block_DC_Current 5 4168 -4 0 0 0
     2021-01-20 15:55:23   Block_DC_Power  5 3127 -1 0 0 0
     2021-01-20 15:55:23   Block_DC_Voltage 5 7502 -1 0 0 0
     2021-01-20 15:50:24   C_DeviceAddress 2
     2021-01-20 15:50:23   C_Manufacturer  SolarEdge
     2021-01-20 15:50:23   C_Model         SE9K-RW0TEBNN4
     2021-01-20 15:50:24   C_SerialNumber  7E0BB3B2
     2021-01-20 15:50:24   C_SunSpec_DID   three phase
     2021-01-20 15:50:23   C_SunSpec_ID    SunS
     2021-01-20 15:50:24   C_Version       0004.0011.0030
     2021-01-20 15:56:05   CurrentExport   -2015
     2021-01-20 15:55:23   CurrentImport   0
     2021-01-20 15:55:23   CurrentOwnConsumption 5
     2021-01-20 15:55:23   CurrentProduction 5
     2021-01-20 15:56:05   ExportMonth     6257
     2021-01-14 14:33:08   ExportMonth_norm 2
     2021-01-20 15:56:05   ExportToday     527
     2021-01-19 00:00:10   ExportToday_norm 321
     2021-01-20 15:56:05   ExportWeek      339
     2021-01-17 23:59:00   ExportWeek_norm 5918
     2021-01-20 15:56:05   ExportedRAW     9466
     2021-01-20 15:55:23   I_AC_Current    1.88
     2021-01-20 15:55:23   I_AC_Current_A  0.62
     2021-01-20 15:55:23   I_AC_Current_B  0.64
     2021-01-20 15:55:23   I_AC_Current_C  0.61
     2021-01-20 15:55:23   I_AC_Current_SF -2
     2021-01-20 15:55:23   I_AC_Energy_WH  53505
     2021-01-20 15:55:23   I_AC_Energy_WH_SF 0
     2021-01-20 15:55:23   I_AC_Frequency  50.01
     2021-01-20 15:55:23   I_AC_Frequency_SF -2
     2021-01-20 15:55:23   I_AC_PF         582.52
     2021-01-20 15:55:23   I_AC_PF_SF      -2
     2021-01-20 15:55:23   I_AC_Power      308
     2021-01-20 15:55:23   I_AC_Power_SF   -1
     2021-01-20 15:55:23   I_AC_VA         422.8
     2021-01-20 15:55:23   I_AC_VAR        289.7
     2021-01-20 15:55:23   I_AC_VAR_SF     -2
     2021-01-20 15:55:23   I_AC_VA_SF      -1
     2021-01-20 15:55:23   I_AC_Voltage_AB 388.3
     2021-01-20 15:55:23   I_AC_Voltage_AN 223.8
     2021-01-20 15:55:23   I_AC_Voltage_BC 388.8
     2021-01-20 15:55:23   I_AC_Voltage_BN 223.8
     2021-01-20 15:55:23   I_AC_Voltage_CA 388.8
     2021-01-20 15:55:23   I_AC_Voltage_CN 225.5
     2021-01-20 15:55:23   I_AC_Voltage_SF -1
     2021-01-20 15:55:23   I_DC_Current    0.4168
     2021-01-20 15:55:23   I_DC_Current_SF -4
     2021-01-20 15:55:23   I_DC_Power      312.7
     2021-01-20 15:55:23   I_DC_Power_SF   -1
     2021-01-20 15:55:23   I_DC_Voltage    750.2
     2021-01-20 15:55:23   I_DC_Voltage_SF -1
     2021-01-20 15:55:23   I_Status        Inverter is ON and producing power
     2021-01-20 15:55:23   I_Temp_HeatSink 41 °C
     2021-01-20 15:55:23   ImportMonth     22137
     2021-01-14 14:33:08   ImportMonth_norm 77
     2021-01-20 15:55:23   ImportToday     3209
     2021-01-19 00:00:10   ImportToday_norm 5089
     2021-01-20 15:55:23   ImportWeek      8300
     2021-01-17 23:59:00   ImportWeek_norm 13837
     2021-01-20 15:55:23   ImportedRAW     174432
     2021-01-20 15:55:23   OwnConsumption  42024
     2021-01-20 15:55:23   OwnConsumptionMonth 14573
     2021-01-14 14:33:08   OwnConsumptionMonth_norm 290
     2021-01-20 15:55:23   OwnConsumptionToday 4543
     2021-01-19 00:00:10   OwnConsumptionToday_norm 2793
     2021-01-20 15:55:23   OwnConsumptionWeek 2617
     2021-01-17 23:59:00   OwnConsumptionWeek_norm 11956
     2021-01-20 15:16:43   PV_2021_0       0
     2021-01-20 15:55:23   ProductionMonth 22845
     2021-01-14 14:33:08   ProductionMonth_norm 292
     2021-01-20 15:55:23   ProductionToday 7085
     2021-01-19 00:00:10   ProductionToday_norm 3114
     2021-01-20 15:55:23   ProductionWeek  4971
     2021-01-17 23:59:00   ProductionWeek_norm 17874
     2021-01-20 15:55:23   X_M_ConsumptionToday 299
     2021-01-20 15:16:44   X_M_ExportedCurrentMonth 0
     2021-01-20 15:16:44   X_M_ExportedCurrentWeek 6735
     2021-01-20 15:55:23   X_M_ExportedToday 80
     2021-01-20 15:16:44   X_M_Exported_2021_0 0
     2021-01-20 15:16:44   X_M_ImportedCurrentMonth 0
     2021-01-20 15:16:44   X_M_ImportedCurrentWeek 58081
     2021-01-20 15:55:23   X_M_ImportedToday 0
     2021-01-20 15:16:44   X_M_Imported_2021_0 0
     2021-01-20 15:55:23   X_Meter_1_Block_AC_Current 9 13 4 3 5 -1 0 0 0 0
     2021-01-20 15:55:23   X_Meter_1_Block_AC_Frequency 9 5000 -2 0 0 0 0 0 0 0
     2021-01-20 15:55:23   X_Meter_1_Block_AC_PF 9 403 -1840 4889 -1840 -2 0 0 0 0
     2021-01-20 15:55:23   X_Meter_1_Block_AC_Power 9 -1 17 -40 21 0 0 0 0 0
     2021-01-20 15:55:23   X_Meter_1_Block_AC_VA 9 252 77 75 115 0 0 0 0 0
     2021-01-20 15:55:23   X_Meter_1_Block_AC_VAR 9 -252 -75 -63 -113 0 0 0 0 0
     2021-01-20 15:55:23   X_Meter_1_Block_AC_Voltage 9 22291 22291 22287 22433 0 0 0 0 -2
     2021-01-20 15:50:25   X_Meter_1_Block_C_Model 9 SE-MTR-3Y-400V-A 0 0 0 0 0 0 0 0
     2021-01-20 15:55:23   X_Meter_1_Block_Energy_VA 9 0 0 0 0 0 0 0 0 -32768
     2021-01-20 15:55:23   X_Meter_1_Block_Energy_W 9 11481 4390 4001 4613 174432 54718 56680 64556 0
     2021-01-20 15:50:25   X_Meter_1_C_DeviceAddress 2
     2021-01-20 15:52:23   X_Meter_1_C_Manufacturer SolarEdge
     2021-01-20 15:50:25   X_Meter_1_C_Model SE-MTR-3Y-400V-A
     2021-01-20 15:50:25   X_Meter_1_C_Option Export+Import
     2021-01-20 15:50:25   X_Meter_1_C_SerialNumber 606503845
     2021-01-20 15:50:25   X_Meter_1_C_SunSpec_DID wye-connect three phase
     2021-01-20 15:50:25   X_Meter_1_C_SunSpec_DID_0 ASolarEdge
     2021-01-20 15:51:23   X_Meter_1_C_SunSpec_Length ASolarEdge
     2021-01-20 15:50:25   X_Meter_1_C_Version 74
     2021-01-20 15:55:23   X_Meter_1_M_AC_Current 1.3
     2021-01-20 15:55:23   X_Meter_1_M_AC_Current_A 0.4
     2021-01-20 15:55:23   X_Meter_1_M_AC_Current_B 0.3
     2021-01-20 15:55:23   X_Meter_1_M_AC_Current_C 0.5
     2021-01-20 15:55:23   X_Meter_1_M_AC_Current_SF -1
     2021-01-20 15:55:23   X_Meter_1_M_AC_Frequency 50
     2021-01-20 15:55:23   X_Meter_1_M_AC_Frequency_SF -2
     2021-01-20 15:55:23   X_Meter_1_M_AC_PF 4.03
     2021-01-20 15:55:23   X_Meter_1_M_AC_PF_A -18.4
     2021-01-20 15:55:23   X_Meter_1_M_AC_PF_B 48.89
     2021-01-20 15:55:23   X_Meter_1_M_AC_PF_C -18.4
     2021-01-20 15:55:23   X_Meter_1_M_AC_PF_SF -2
     2021-01-20 15:55:23   X_Meter_1_M_AC_Power -1
     2021-01-20 15:55:23   X_Meter_1_M_AC_Power_A 17
     2021-01-20 15:55:23   X_Meter_1_M_AC_Power_B -40
     2021-01-20 15:55:23   X_Meter_1_M_AC_Power_C 21
     2021-01-20 15:55:23   X_Meter_1_M_AC_Power_SF 0
     2021-01-20 15:55:23   X_Meter_1_M_AC_VA 252
     2021-01-20 15:55:23   X_Meter_1_M_AC_VAR -252
     2021-01-20 15:55:23   X_Meter_1_M_AC_VAR_A -75
     2021-01-20 15:55:23   X_Meter_1_M_AC_VAR_B -63
     2021-01-20 15:55:23   X_Meter_1_M_AC_VAR_C -113
     2021-01-20 15:55:23   X_Meter_1_M_AC_VAR_SF 0
     2021-01-20 15:55:23   X_Meter_1_M_AC_VA_A 77
     2021-01-20 15:55:23   X_Meter_1_M_AC_VA_B 75
     2021-01-20 15:55:23   X_Meter_1_M_AC_VA_C 115
     2021-01-20 15:55:23   X_Meter_1_M_AC_VA_SF 0
     2021-01-20 15:55:23   X_Meter_1_M_AC_Voltage_AB 0
     2021-01-20 15:55:23   X_Meter_1_M_AC_Voltage_AN 222.91
     2021-01-20 15:55:23   X_Meter_1_M_AC_Voltage_BC 0
     2021-01-20 15:55:23   X_Meter_1_M_AC_Voltage_BN 222.87
     2021-01-20 15:55:23   X_Meter_1_M_AC_Voltage_CA 0
     2021-01-20 15:55:23   X_Meter_1_M_AC_Voltage_CN 224.33
     2021-01-20 15:55:23   X_Meter_1_M_AC_Voltage_LL 0
     2021-01-20 15:55:23   X_Meter_1_M_AC_Voltage_LN 222.91
     2021-01-20 15:55:23   X_Meter_1_M_AC_Voltage_SF -2
     2021-01-20 15:55:23   X_Meter_1_M_Energy_VA_SF -32768
     2021-01-20 15:55:23   X_Meter_1_M_Energy_W_SF 0
     2021-01-20 15:55:23   X_Meter_1_M_Exported 11481
     2021-01-20 15:55:23   X_Meter_1_M_Exported_A 4390
     2021-01-20 15:55:23   X_Meter_1_M_Exported_B 4001
     2021-01-20 15:55:23   X_Meter_1_M_Exported_C 4613
     2021-01-20 15:55:23   X_Meter_1_M_Exported_VA 0
     2021-01-20 15:55:23   X_Meter_1_M_Exported_VA_A 0
     2021-01-20 15:55:23   X_Meter_1_M_Exported_VA_B 0
     2021-01-20 15:55:23   X_Meter_1_M_Exported_VA_C 0
     2021-01-20 15:55:23   X_Meter_1_M_Imported 174432
     2021-01-20 15:55:23   X_Meter_1_M_Imported_A 54718
     2021-01-20 15:55:23   X_Meter_1_M_Imported_B 56680
     2021-01-20 15:55:23   X_Meter_1_M_Imported_C 64556
     2021-01-20 15:55:23   X_Meter_1_M_Imported_VA 0
     2021-01-20 15:55:23   X_Meter_1_M_Imported_VA_A 0
     2021-01-20 15:55:23   X_Meter_1_M_Imported_VA_B 0
     2021-01-20 15:55:23   X_Meter_1_M_Imported_VA_C 0
     2021-01-20 15:55:23   X_PV_Energy     53505
     2021-01-20 15:16:43   X_PV_EnergyCurrentMonth 0
     2021-01-20 15:16:43   X_PV_EnergyCurrentWeek 43731
     2021-01-20 15:55:23   X_PV_EnergyToday 379
     2021-01-20 15:55:23   state           <table border=0 bordercolor='green' cellspacing=0 align='center'><tr><th><h1>Gesamtenergie 53.51 kWh </h1> </td></tr></table><table border=3 bordercolor='green' cellspacing=0 align='center'><tr><th>Status</th><td>Inverter is ON and producing power</td></tr><tr><th>Temperatur</th><td align='right'>42 °C</td></tr><tr><th>Leistung DC</th><td align='right'>312.7 W</td></tr><tr><th>Leistung AC</th><td align='right'>308 W</td></tr><tr><th>Spannung DC</th><td align='right'>750.2 V-</td></tr><tr><th>Strom AC</th><td align='right'>1.88 A~</td></tr></table><br>
   REMEMBER:
     lid        2
     lname      DR.PV1
     lrecv      1611154524.35458
     lsend      1611154524.33669
   defptr:
     DR.PV1     2
   gotReadings:
     Battery_1_Instantaneous_Current_A -3.40282346638529e+38
     Battery_1_Instantaneous_Power_W 0
     Battery_1_Instantaneous_Voltage_V -3.40282346638529e+38
     Battery_1_SOE -3.40282346638529e+38
     Battery_1_SOH -3.40282346638529e+38
     Battery_1_Status 7
   lastRead:
     h40000     1611154223.86882
     h40004     1611154223.87218
     h40020     1611154223.87317
     h40044     1611154224.42471
     h40052     1611154224.42531
     h40068     1611154224.42575
     h40069     1611154224.42611
     h40071     1611154523.64672
     h40076     1611154523.64753
     h40083     1611154523.64819
     h40085     1611154523.64883
     h40087     1611154523.64945
     h40089     1611154523.65007
     h40091     1611154523.65072
     h40093     1611154523.65146
     h40096     1611154523.65211
     h40098     1611154523.65273
     h40100     1611154523.65336
     h40103     1611154523.65389
     h40107     1611154523.65439
     h40121     1611154225.03347
     h40122     1611154283.86564
     h40123     1611154343.91665
     h40139     1611154225.03438
     h40155     1611154225.17114
     h40163     1611154225.17178
     h40171     1611154225.1724
     h40187     1611154225.17286
     h40188     1611154225.17323
     h40190     1611154523.84612
     h40195     1611154523.84699
     h40204     1611154523.84762
     h40206     1611154523.84825
     h40211     1611154523.84887
     h40216     1611154523.84948
     h40221     1611154523.85013
     h40226     1611154523.96496
     h40243     1611154523.96571
     h57600     1611154225.65049
     h57616     1611154225.65137
     h57632     1611154225.65208
     h57648     1611154225.81649
     h57664     1611154524.11446
     h57666     1611154524.11512
     h57668     1611154524.11554
     h57670     1611154524.23504
     h57672     1611154524.23546
     h57674     1611154524.23585
     h57712     1611154524.35543
     h57714     1611154524.35585
     h57716     1611154524.35624
     h57730     1611154524.35681
     h57732     1611154524.35721
     h57734     1611154524.35764
Attributes:
   DbLogExclude .*
   DbLogInclude ProductionWeek,ProductionMonth,ExportToday,ImportToday,ExportWeek,ImportWeek,ExportMonth,ImportMonth,AutarkieWeek,AutarkieToday,OwnConsumptionMonth,OwnConsumptionWeek,X_PV_EnergyCurrentMonth,OwnConsumptionToday,I_Status,CurrentImport,CurrentExport,CurrentOwnConsumption,CurrentProduction,OwnConsumption,X_PV_EnergyToday,X_PV_Energy,X_Meter_1_M_Imported_B,X_Meter_1_M_Imported_A,X_Meter_1_M_Imported,X_Meter_1_M_Exported_C,X_Meter_1_M_Exported_B,X_Meter_1_M_Exported_A,X_Meter_1_M_AC_Power_C,X_Meter_1_M_AC_Power_B,X_Meter_1_M_AC_Power_A,X_Meter_1_M_AC_Power,X_Meter_1_M_AC_Current_A,X_Meter_1_M_AC_Current,I_Temp_HeatSink,I_DC_Voltage,I_DC_Power,I_DC_Current,I_AC_Voltage_CN,I_AC_Voltage_BN,I_AC_Voltage_AN,I_AC_VA,I_AC_Power,I_AC_Energy_WH,I_AC_Current,I_AC_Current_A,I_AC_Current_B,I_AC_Current_C
   userReadings ExportedRAW:X_Meter_1_M_Exported.*
{
max(ReadingsNum("DR.PV1","X_Meter_1_M_Exported","0"),ReadingsNum("DR.PV1","ExportedRAW","0"))
},

CurrentExport:ExportedRAW.* difference
{
ReadingsNum("DR.PV1","ExportedRAW","0")
},

ImportedRAW:X_Meter_1_M_Imported.*
{
max(ReadingsNum("DR.PV1","X_Meter_1_M_Imported","0"),ReadingsNum("DR.PV1","ImportedRAW","0"))
},

CurrentImport:ImportedRAW.* difference
{
ReadingsNum("DR.PV1","ImportedRAW","0")
},

OwnConsumption:X_PV_Energy.*
{
ReadingsNum("DR.PV1","X_PV_Energy","0")-ReadingsNum("DR.PV1","ExportedRAW","0")
},

CurrentProduction:X_PV_Energy.* difference
{
    ReadingsNum("DR.PV1","X_PV_Energy","0")
},

CurrentOwnConsumption:OwnConsumption.* difference
{
    ReadingsNum("DR.PV1","OwnConsumption","0")
},

ExportToday:CurrentExport.*
{
ReadingsNum("DR.PV1","CurrentExport","0")+ReadingsNum("DR.PV1","ExportToday","0")
},

ImportToday:CurrentImport.*
{
ReadingsNum("DR.PV1","CurrentImport","0")+ReadingsNum("DR.PV1","ImportToday","0")
},

OwnConsumptionToday:CurrentOwnConsumption.*
{
ReadingsNum("DR.PV1","CurrentOwnConsumption","0")+ReadingsNum("DR.PV1","OwnConsumptionToday","0")
},

ProductionToday:CurrentProduction.*
{
ReadingsNum("DR.PV1","CurrentProduction","0")+ReadingsNum("DR.PV1","ProductionToday","0")
},

ExportWeek:CurrentExport.*
{
ReadingsNum("DR.PV1","CurrentExport","0")+ReadingsNum("DR.PV1","ExportWeek","0")
},

ImportWeek:CurrentImport.*
{
ReadingsNum("DR.PV1","CurrentImport","0")+ReadingsNum("DR.PV1","ImportWeek","0")
},

OwnConsumptionWeek:CurrentOwnConsumption.*
{
ReadingsNum("DR.PV1","CurrentOwnConsumption","0")+ReadingsNum("DR.PV1","OwnConsumptionWeek","0")
},

ProductionWeek:CurrentProduction.*
{
ReadingsNum("DR.PV1","CurrentProduction","0")+ReadingsNum("DR.PV1","ProductionWeek","0")
},

ExportMonth:CurrentExport.*
{
ReadingsNum("DR.PV1","CurrentExport","0")+ReadingsNum("DR.PV1","ExportMonth","0")
},

ImportMonth:CurrentImport.*
{
ReadingsNum("DR.PV1","CurrentImport","0")+ReadingsNum("DR.PV1","ImportMonth","0")
},

OwnConsumptionMonth:CurrentOwnConsumption.*
{
ReadingsNum("DR.PV1","CurrentOwnConsumption","0")+ReadingsNum("DR.PV1","OwnConsumptionMonth","0")
},

ProductionMonth:CurrentProduction.*
{
ReadingsNum("DR.PV1","CurrentProduction","0")+ReadingsNum("DR.PV1","ProductionMonth","0")
},

AutarkieToday:CurrentImport.*
{
(ReadingsNum("DR.PV1","OwnConsumptionToday","0")/(ReadingsNum("DR.PV1","OwnConsumptionToday","0")+ReadingsNum("DR.PV1","ImportToday","0")))*100
},

AutarkieWeek:CurrentImport.*
{
(ReadingsNum("DR.PV1","OwnConsumptionWeek","0")/(ReadingsNum("DR.PV1","OwnConsumptionWeek","0")+ReadingsNum("DR.PV1","ImportWeek","0")))*100
}
   verbose    0


So sieht das Teil aus
fhem auf Intel NUC6CAYH mit Proxmox im LXC (Debian 10), KNX mit knxd über MDT SCN-IP000.02, Buderus GB192-15i über KM100, Solaredge WR SE9K über Modbus-TCP

EinEinfach

Beim nächsten userReading bekomme ich den richtigen max-Wert zurück
ImportedRAW:X_Meter_1_M_Imported.*
{
max(ReadingsNum("DR.PV1","X_Meter_1_M_Imported","0"),ReadingsNum("DR.PV1","ImportedRAW","0"))
},
fhem auf Intel NUC6CAYH mit Proxmox im LXC (Debian 10), KNX mit knxd über MDT SCN-IP000.02, Buderus GB192-15i über KM100, Solaredge WR SE9K über Modbus-TCP

EinEinfach

#6
maxNum() gibt den Max-Wert zurück  :o
11482

return max(ReadingsNum("DR.PV1","X_Meter_1_M_Exported","0"),ReadingsNum("DR.PV1","ExportedRAW","0"))
9466
fhem auf Intel NUC6CAYH mit Proxmox im LXC (Debian 10), KNX mit knxd über MDT SCN-IP000.02, Buderus GB192-15i über KM100, Solaredge WR SE9K über Modbus-TCP

Prof. Dr. Peter Henning

#7
Beta-User war schneller...

Ganz einfach: max und min machen einen LEXIKALISCHEN Vergleich - und nachdem ist nun einmal 9000 größer als 11000

Für einen nummerischen Vergleich muss man maxNum und minNum verwenden. Stehen alle vier in der Datei 99_Utils.pm

LG

pah

EinEinfach

Danke an alle, habe ich entsprechend angepasst. Kann geschlossen werden.

Wäre ich nie alleine draufgekommen! Wusste nicht, dass PERL an der Stelle so spezifisch ist.
fhem auf Intel NUC6CAYH mit Proxmox im LXC (Debian 10), KNX mit knxd über MDT SCN-IP000.02, Buderus GB192-15i über KM100, Solaredge WR SE9K über Modbus-TCP

Prof. Dr. Peter Henning

Das ist auch nicht Perl, sondern FHEM...

LG

pah

Beta-User

Doppelt genäht...

a) "kann geschlossen werden" ist (mehrfach) falsch: _Du_ kannst den Thread bitte als [gelöst] kennzeichnen!
b) das ist NICHT Perl, sondern (leider!) FHEM, dass da so ungewohnt mit allgemeinen Funktions-Begrifflichkeiten "rumhampelt". Leider läßt sich das nicht ohne Schmerzen aus FHEM rausbauen, weil keiner weiß, wer es wo wie eingebaut hat...
Wer es zukunftssicher haben will, sollte wohl ausdrücklich List::Util::min() etc. verwenden. Na ja...
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors