From 3861874eabb5594763e586053c3bf2f37aa6bb2f Mon Sep 17 00:00:00 2001 From: MadMax <> Date: Sun, 10 Mar 2024 12:54:22 +0000 Subject: [PATCH] 76_SMAInverter.pm:add GridConection reading git-svn-id: https://svn.fhem.de/fhem/trunk@28631 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/76_SMAInverter.pm | 49 +++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/76_SMAInverter.pm b/fhem/FHEM/76_SMAInverter.pm index d317be2ff..0db34ddb8 100644 --- a/fhem/FHEM/76_SMAInverter.pm +++ b/fhem/FHEM/76_SMAInverter.pm @@ -32,6 +32,8 @@ eval "use FHEM::Meta;1" or my $modMetaAbsent = 1; # Versions History by DS_Starter our %SMAInverter_vNotesIntern = ( + "2.24.1" => "10.03.2024 GridConection (SI only)", + "2.24.0" => "08.03.2024 add GridConection (SI/Hybrid-Inverter)", "2.23.8" => "21.01.2024 Voltage L1-L2-L3 bug", "2.23.7" => "25.12.2023 add DC-Power PV-Inverter", "2.23.6" => "24.09.2023 add BAT_P_Charge/Discarge", @@ -714,6 +716,7 @@ sub SMAInverter_getstatusDoParse($) { $sup_InverterTemperature, $sup_GridRelayStatus, $sup_BackupRelayStatus, + $sup_GridConection, $sup_OperatingStatus, $sup_GeneralOperatingStatus, $sup_WaitingTimeUntilFeedIn, @@ -753,7 +756,7 @@ sub SMAInverter_getstatusDoParse($) { $inv_BAT_LOADTODAY, $inv_BAT_LOADTOTAL, $inv_BAT_CAPACITY,$inv_BAT_UNLOADTODAY,$inv_BAT_UNLOADTOTAL, $inv_BAT_Manufacturer, $inv_SPOT_FREQ, $inv_SPOT_OPERTM, $inv_SPOT_FEEDTM, $inv_TEMP, $inv_GRIDRELAY, $inv_STATUS, - $inv_BACKUPRELAY, $inv_OperatingStatus, $inv_GeneralOperatingStatus, $inv_WaitingTimeUntilFeedIn, + $inv_BACKUPRELAY, $inv_OperatingStatus, $inv_GeneralOperatingStatus, $inv_WaitingTimeUntilFeedIn, $inv_GridConection, $Meter_Grid_FeedIn, $Meter_Grid_Consumation,$Meter_Total_Yield,$Meter_Total_Consumation, $Meter_Power_Grid_FeedIn,$Meter_Power_Grid_Consumation, $Meter_Grid_FeedIn_PAC1, $Meter_Grid_FeedIn_PAC2, $Meter_Grid_FeedIn_PAC3, $Meter_Grid_Consumation_PAC1, $Meter_Grid_Consumation_PAC2, $Meter_Grid_Consumation_PAC3, @@ -970,8 +973,9 @@ sub SMAInverter_getstatusDoParse($) { #push(@commands, "sup_Insulation_2"); # Isolationsüberwachung push(@commands, "sup_GeneralOperatingStatus"); - push(@commands, "sup_OperatingStatus") if($INVCLASS eq "8009"); + push(@commands, "sup_OperatingStatus") if($INVCLASS eq "8009" || $INVTYPE_NAME =~ /SI/xs); push(@commands, "sup_BackupRelayStatus") if($INVCLASS eq "8009"); + push(@commands, "sup_GridConection") if($INVTYPE_NAME =~ /SI/xs); #nur SI Wechselrichter (Hybrids haben diesen Wert auch aber diese ändert sich weder im WR noch im Reading also unnötig) #push(@commands, "sup_WaitingTimeUntilFeedIn") if($INVCLASS eq "8009"); } @@ -1108,6 +1112,10 @@ sub SMAInverter_getstatusDoParse($) { elsif ($i eq "sup_BackupRelayStatus") { Log3 $name, 5, "$name -> sup_BackupRelayStatus"; ($sup_BackupRelayStatus,$inv_BACKUPRELAY,$inv_susyid,$inv_serial) = SMAInverter_SMAcommand($hash, $hash->{HOST}, 0x51800200, 0x08412500, 0x084125FF); + } + elsif ($i eq "sup_GridConection") { + Log3 $name, 5, "$name -> sup_GridConection"; + ($sup_GridConection,$inv_GridConection,$inv_susyid,$inv_serial) = SMAInverter_SMAcommand($hash, $hash->{HOST}, 0x51800200, 0x0846A600, 0x0846A6FF); } elsif ($i eq "sup_OperatingStatus") { Log3 $name, 5, "$name -> sup_OperatingStatus"; @@ -1434,6 +1442,10 @@ sub SMAInverter_getstatusDoParse($) { if($sup_BackupRelayStatus) { push(@row_array, "backuprelay_status ".SMAInverter_StatusText($inv_BACKUPRELAY)."\n"); } + if($sup_GridConection) { + push(@row_array, "GridConection ".SMAInverter_StatusText($inv_GridConection)."\n"); + } + if($sup_OperatingStatus) { push(@row_array, "operating_status ".SMAInverter_StatusText($inv_OperatingStatus)."\n"); } @@ -1648,6 +1660,10 @@ sub SMAInverter_getstatusDoParse($) { if($sup_BackupRelayStatus) { push(@row_array, "INV_BACKRELAYRELAY ".SMAInverter_StatusText($inv_BACKUPRELAY)."\n"); } + if($sup_GridConection) { + push(@row_array, "INV_GridConection ".SMAInverter_StatusText($inv_GridConection)."\n"); + } + if($sup_OperatingStatus) { push(@row_array, "INV_OperatingStatus ".SMAInverter_StatusText($inv_OperatingStatus)."\n"); } @@ -1815,7 +1831,7 @@ sub SMAInverter_SMAcommand($$$$$) { $inv_BAT_LOADTODAY, $inv_BAT_LOADTOTAL, $inv_BAT_CAPACITY,$inv_BAT_UNLOADTODAY,$inv_BAT_UNLOADTOTAL, $inv_BAT_rated_capacity, $inv_SPOT_FREQ, $inv_SPOT_OPERTM, $inv_SPOT_FEEDTM, $inv_TEMP, $inv_GRIDRELAY, $inv_STATUS, - $inv_BACKUPRELAY, $inv_OperatingStatus, $inv_GeneralOperatingStatus, $inv_WaitingTimeUntilFeedIn, + $inv_BACKUPRELAY, $inv_OperatingStatus, $inv_GeneralOperatingStatus, $inv_WaitingTimeUntilFeedIn, $inv_GridConection, $Meter_Grid_FeedIn, $Meter_Grid_Consumation, $Meter_Total_FeedIn, $Meter_Total_Consumation, $Meter_Power_Grid_FeedIn, $Meter_Power_Grid_Consumation, $Meter_Grid_FeedIn_PAC1, $Meter_Grid_FeedIn_PAC2, $Meter_Grid_FeedIn_PAC3, $Meter_Grid_Consumation_PAC1, $Meter_Grid_Consumation_PAC2, $Meter_Grid_Consumation_PAC3); @@ -2576,7 +2592,20 @@ sub SMAInverter_SMAcommand($$$$$) { } while ((unpack("V*", substr $data, 62 + $i*4, 4) ne 0x00FFFFFE) && ($i < 5)); # 0x00FFFFFE is the end marker for attributes Log3 $name, 5, "$name - Found Data inv_BACKUPRELAY=$inv_BACKUPRELAY"; return (1,$inv_BACKUPRELAY,$inv_susyid,$inv_serial); - } + } + + if($data_ID eq 0x46A6) { + $i = 0; + $temp = 0; + $inv_GridConection = 0x00FFFFFD; # Code for No Information; + do { + $temp = unpack("V*", substr $data, 62 + $i*4, 4); + if(($temp & 0xFF000000) ne 0) { $inv_GridConection = $temp & 0x00FFFFFF; } + $i = $i + 1; + } while ((unpack("V*", substr $data, 62 + $i*4, 4) ne 0x00FFFFFE) && ($i < 5)); # 0x00FFFFFE is the end marker for attributes + Log3 $name, 5, "$name - Found Data inv_GridConection=$inv_GridConection"; + return (1,$inv_GridConection,$inv_susyid,$inv_serial); + } if($data_ID eq 0x412b) { $i = 0; @@ -2915,6 +2944,8 @@ sub SMAInverter_StatusText($) { if($code eq 1795) { return (AttrVal("global", "language", "EN") eq "DE") ? "Verriegelt" : "locked"; } if($code eq 1779) { return (AttrVal("global", "language", "EN") eq "DE") ? "Getrennt" : "disconnected"; } + if($code eq 1780) { return (AttrVal("global", "language", "EN") eq "DE") ? "Öffentliches Stromnetz" : "public grid"; } + if($code eq 35) { return (AttrVal("global", "language", "EN") eq "DE") ? "Fehler" : "Fault"; } if($code eq 303) { return "Off"; } if($code eq 307) { return "Ok"; } @@ -3174,6 +3205,7 @@ The retrieval of the inverter will be executed non-blocking. You can adjust the
  • SPOT_IAC3 / phase_3_iac : Grid current phase L3
  • SPOT_IDC1 / string_1_idc : DC current input
  • SPOT_IDC2 / string_2_idc : DC current input
  • +
  • SPOT_IDC3 / string_3_idc : DC current input
  • SPOT_OPERTM / operation_time : Operation Time
  • SPOT_PAC1 / phase_1_pac : Power L1
  • SPOT_PAC2 / phase_2_pac : Power L2
  • @@ -3181,6 +3213,7 @@ The retrieval of the inverter will be executed non-blocking. You can adjust the
  • SPOT_PACTOT / total_pac : Total Power
  • SPOT_PDC1 / string_1_pdc : DC power input 1
  • SPOT_PDC2 / string_2_pdc : DC power input 2
  • +
  • SPOT_PDC3 / string_3_pdc : DC power input 3
  • SPOT_PDC / strings_pds : DC power summary (only Hybrid-Inverter)
  • SPOT_UAC1 / phase_1_uac : Grid voltage phase L1
  • SPOT_UAC2 / phase_2_uac : Grid voltage phase L2
  • @@ -3190,6 +3223,7 @@ The retrieval of the inverter will be executed non-blocking. You can adjust the
  • SPOT_UAC3_1 / phase_3_1_uac : Grid voltage phase L3-L1
  • SPOT_UDC1 / string_1_udc : DC voltage input
  • SPOT_UDC2 / string_2_udc : DC voltage input
  • +
  • SPOT_UDC3 / string_3_udc : DC voltage input
  • SUSyID / susyid : Inverter SUSyID
  • INV_TEMP / device_temperature : Inverter temperature
  • INV_TYPE / device_type : Inverter Type
  • @@ -3197,6 +3231,7 @@ The retrieval of the inverter will be executed non-blocking. You can adjust the
  • POWER_OUT / power_out : Battery Discharging power
  • INV_GRIDRELAY / gridrelay_status : Grid Relay/Contactor Status
  • INV_BACKUPRELAY / backuprelay_status : Backup Relay/Contactor Status (only Hybrid-Inverter)
  • +
  • INV_GridConection / grid_conection : state of Gridconection (public grid/disconnected) (only SI-Inverter)
  • INV_GeneralOperatingStatus / general_operating_status
  • : General Status from the Inverter (MPP/Activated/Derating)
  • INV_OperatingStatus / operating_status : operating status from the Inverter (Parallel grid operation/Backup) (only Hybrid-Inverter)
  • @@ -3448,6 +3483,7 @@ Die Abfrage des Wechselrichters wird non-blocking ausgeführt. Der Timeoutwert f
  • SPOT_IAC3 / phase_3_iac : Netz Strom phase L3
  • SPOT_IDC1 / string_1_idc : DC Strom Eingang 1
  • SPOT_IDC2 / string_2_idc : DC Strom Eingang 2
  • +
  • SPOT_IDC3 / string_3_idc : DC Strom Eingang 3
  • SPOT_OPERTM / operation_time : Betriebsstunden
  • SPOT_PAC1 / phase_1_pac : Leistung L1
  • SPOT_PAC2 / phase_2_pac : Leistung L2
  • @@ -3455,6 +3491,7 @@ Die Abfrage des Wechselrichters wird non-blocking ausgeführt. Der Timeoutwert f
  • SPOT_PACTOT / total_pac : Gesamtleistung
  • SPOT_PDC1 / string_1_pdc : DC Leistung Eingang 1
  • SPOT_PDC2 / string_2_pdc : DC Leistung Eingang 2
  • +
  • SPOT_PDC3 / string_3_pdc : DC Leistung Eingang 3
  • SPOT_PDC / strings_pds : DC Leistung gesamt (bei Hybridwechselrichtern)
  • SPOT_UAC1 / phase_1_uac : Netz Spannung phase L1
  • SPOT_UAC2 / phase_2_uac : Netz Spannung phase L2
  • @@ -3464,6 +3501,7 @@ Die Abfrage des Wechselrichters wird non-blocking ausgeführt. Der Timeoutwert f
  • SPOT_UAC3_1 / phase_3_1_uac : Netz Spannung phase L3-L1
  • SPOT_UDC1 / string_1_udc : DC Spannung Eingang 1
  • SPOT_UDC2 / string_2_udc : DC Spannung Eingang 2
  • +
  • SPOT_UDC3 / string_3_udc : DC Spannung Eingang 3
  • SUSyID / susyid : Wechselrichter SUSyID
  • INV_TEMP / device_temperature : Wechselrichter Temperatur
  • INV_TYPE / device_type : Wechselrichter Typ
  • @@ -3471,6 +3509,7 @@ Die Abfrage des Wechselrichters wird non-blocking ausgeführt. Der Timeoutwert f
  • POWER_OUT / power_out : Akku Entladeleistung
  • INV_GRIDRELAY / gridrelay_status : Netz Relais Status
  • INV_BACKUPRELAY / backuprelay_status : Backup Relais Status (bei Hybridwechselrichtern)
  • +
  • INV_GridConection / grid_conection : Status des Netzanschlusses (Öffentliches Stromnetz/Getrennt) (nur SI-Inverter)
  • INV_GeneralOperatingStatus / general_operating_status
  • : Allgemeiner Betriebszustand des Wechselrichters (MPP/Eingeschaltet/Abregelung)
  • INV_OperatingStatus / operating_status : Betriebsstatus des Wechselrichters (Netzparallelbetrieb/Backup) (bei Hybridwechselrichtern)
  • @@ -3520,7 +3559,7 @@ Die Abfrage des Wechselrichters wird non-blocking ausgeführt. Der Timeoutwert f "PV", "inverter" ], - "version": "v2.23.8", + "version": "v2.24.1", "release_status": "stable", "author": [ "Maximilian Paries",