SolarEdge Wechselrichter: Unterschied zwischen den Versionen

Aus FHEMWiki
(→‎Am Wechselrichter: Zeitweise Aktivität)
(→‎List von Device Solaredge in FHEM: Userreadings eingeführt)
Zeile 48: Zeile 48:
   DEST      192.168.178.36:502
   DEST      192.168.178.36:502
   DeviceName 192.168.178.36:502
   DeviceName 192.168.178.36:502
   FD        86
   FD        91
   INTERVAL  30
   INTERVAL  600
   IODev      KeSolarEdge
   IODev      KeSolarEdge
   LASTOPEN  1514309396.43558
   LASTOPEN  1523044866.65275
   MODBUSID  1
   MODBUSID  1
   ModuleVersion 3.7.0 - 20.8.2017
   ModuleVersion 3.7.3 - 22.12.2017
   NAME      KeSolarEdge
   NAME      KeSolarEdge
   NOTIFYDEV  global
   NOTIFYDEV  global
   NR        363
   NR        354
   NTFY_ORDER 50-KeSolarEdge
   NTFY_ORDER 50-KeSolarEdge
   PARTIAL     
   PARTIAL     
   PROTOCOL  TCP
   PROTOCOL  TCP
   REQUESTHEX 00c60000000601039c8f0001
   REQUESTHEX 00270000000601039c940001
   STATE      opened
   STATE      0 W; 1718 kWh
   TRIGGERTIME 1514313544.27135
   TRIGGERTIME 1523048587.13296
   TRIGGERTIME_FMT 2017-12-26 19:39:04
   TRIGGERTIME_FMT 2018-04-06 23:03:07
   TYPE      ModbusAttr
   TYPE      ModbusAttr
   devioLoglevel 3
   devioLoglevel 4
   nextOpenDelay 60
   nextOpenDelay 60
  QUEUE:
  READINGS:
    2018-04-06 22:53:07  AC-Energy      1717.665
    2018-04-06 22:53:07  AC-Energy-Scale 0
    2018-04-06 22:53:07  AC-Energy-Val  1717665
    2018-04-06 22:58:10  AC-Power        0
    2018-04-06 22:58:10  AC-Power-Scale  0
    2018-04-06 22:58:10  AC-Power-Val    0
    2018-04-06 22:53:07  DC-Current      0
    2018-04-06 22:53:07  DC-Current-Scale -32768
    2018-04-06 22:53:07  DC-Current-Val  65535
    2018-04-06 22:53:07  DC-Power        0
    2018-04-06 22:53:07  DC-Power-Scale  0
    2018-04-06 22:53:07  DC-Power-Val    0
    2018-04-06 22:53:07  DC-Voltage      0
    2018-04-06 22:53:07  DC-Voltage-Scale -1
    2018-04-06 22:53:07  DC-Voltage-Val  0
    2018-04-06 22:53:07  HeatSinkTemp    0
    2018-04-06 22:53:07  Status          2
    2018-04-06 22:53:07  Zustand        Nachtmodus
    2018-04-06 22:01:06  state          opened
  defptr:
    1:
  gotReadings:
    AC-Power-Scale 0
  helper:
    buffer   
    lid        1
    lrecv      1523048290.49688
    lsend      1523048290.48976
  lastRead:
    h40083    1523048290.48193
    h40084    1523048290.50143
    h40093    1523047987.08669
    h40095    1523047987.09043
    h40096    1523047987.09428
    h40097    1523047987.09784
    h40098    1523047987.10153
    h40099    1523047987.10505
    h40100    1523047987.10867
    h40101    1523047987.11226
    h40103    1523047987.1158
    h40107    1523047987.11994
Attributes:
Attributes:
  dev-h-combine 200
   dev-h-defPoll 1
   dev-h-defPoll 1
   dev-h-defShowGet 1
   dev-h-defShowGet 1
   enableControlSet 1
   enableControlSet 1
  event-on-change-reading .*
  event-on-update-reading AC-Energy,AC-Energy-Scale,AC-Power-Scale,DC-Voltage-Scale,DC-Current-Scale,DC-Power-Scale,Status
   maxTimeoutsToReconnect 3
   maxTimeoutsToReconnect 3
  obj-h40079-expr $val / 10
   obj-h40083-reading AC-Power-Val
  obj-h40079-reading AC-Volt-A
  obj-h40082-reading AC-Volt-Scale
  obj-h40082-unpack s>
   obj-h40083-reading AC-Power
   obj-h40084-reading AC-Power-Scale
   obj-h40084-reading AC-Power-Scale
   obj-h40084-unpack s>
   obj-h40084-unpack s>
   obj-h40093-len 2
   obj-h40093-len 2
   obj-h40093-reading AC-Energy
   obj-h40093-reading AC-Energy-Val
   obj-h40093-unpack l>
   obj-h40093-unpack l>
   obj-h40095-reading AC-Energy-Scale
   obj-h40095-reading AC-Energy-Scale
   obj-h40096-reading DC-Current
   obj-h40096-reading DC-Current-Val
   obj-h40097-reading DC-Current-Scale
   obj-h40097-reading DC-Current-Scale
   obj-h40097-unpack s>
   obj-h40097-unpack s>
   obj-h40098-reading DC-Voltage
   obj-h40098-reading DC-Voltage-Val
   obj-h40099-reading DC-Voltage-Scale
   obj-h40099-reading DC-Voltage-Scale
   obj-h40099-unpack s>
   obj-h40099-unpack s>
   obj-h40100-reading DC-Power
   obj-h40100-reading DC-Power-Val
   obj-h40101-reading DC-Power-Scale
   obj-h40101-reading DC-Power-Scale
   obj-h40101-unpack s>
   obj-h40101-unpack s>
Zeile 95: Zeile 137:
   obj-h40103-unpack s>
   obj-h40103-unpack s>
   obj-h40107-reading Status
   obj-h40107-reading Status
  room      Solar,SolarPV,SolarReport
  silentReconnect 1
  sortUpdate 1
  stateFormat {sprintf("%.0f W; %.0f kWh",ReadingsVal("KeSolarEdge","AC-Power",0),ReadingsVal("KeSolarEdge","AC-Energy",0))}
  userReadings AC-Energy:(AC-Energy-Scale.*) {
  my $scale = ReadingsVal ("KeSolarEdge","AC-Energy-Scale",0);
  return (ReadingsVal ("KeSolarEdge","AC-Energy-Val",0) * ( 10 ** $scale) / 1000);;},
 
AC-Power:(AC-Power-Scale.*) {
my $scale = ReadingsVal ("KeSolarEdge","AC-Power-Scale",0);
return (ReadingsVal ("KeSolarEdge","AC-Power-Val",0) * ( 10 ** $scale));;},
DC-Power:(DC-Power-Scale.*) {
my $scale = ReadingsVal ("KeSolarEdge","DC-Power-Scale",0);
return (ReadingsVal ("KeSolarEdge","DC-Power-Val",0) * ( 10 ** $scale));;},
 
DC-Current:(DC-Current-Scale.*) {
my $scale = ReadingsVal ("KeSolarEdge","DC-Current-Scale",0);
return (ReadingsVal ("KeSolarEdge","DC-Current-Val",0) * ( 10 ** $scale));;},
 
DC-Voltage:(DC-Voltage-Scale.*) {
my $scale = ReadingsVal ("KeSolarEdge","DC-Voltage-Scale",0);
return (ReadingsVal ("KeSolarEdge","DC-Voltage-Val",0) * ( 10 ** $scale));;},
Zustand:(Status.*) {
  my $Zus = ReadingsVal("KeSolarEdge","Status",0);
  my $rueck = ReadingsVal("KeSolarEdge","Zustand",0);
  if (($Zus == 2) and (InternalVal("KeSolarEdge","INTERVAL","") != 600)) {
    fhem("set KeSolarEdge interval 600");
$rueck = "Nachtmodus";
  }
  elsif  (InternalVal("KeSolarEdge","INTERVAL","") != 60) {
    fhem("set KeSolarEdge interval 60");
$rueck = "Tagmodus";
  }
  return ($rueck);;
}
  webCmdLabel {sprintf("AC-Energy %.3f",ReadingsVal("Solaredge","AC-Energy",0));;}
</pre>
</pre>



Version vom 6. April 2018, 22:05 Uhr


SolarEdge Wechselrichter
SolarEdge SE10k
Allgemein
Protokoll Modubus TCP
Typ Wechselrichter
Kategorie Energieverbrauchsmessung
Technische Details
Kommunikation Ethernet TCP
Kanäle 1 (bidiektional)
Betriebsspannung 750V DC; 230V 3xAC
Leistungsaufnahme Eigenverbrauch 2% (geschätzt)
Versorgung 230V~ 3xAC
Abmessungen 317x512x214 (mm)
Sonstiges
Modulname ModbusAttr
Hersteller Solaredge


SE10k von Solaredge in FHEM einbinden

Dieser Artikel beschreibt die Einbindung eines Solaredgewechselrichters SE10k in ein FHEM System über eine Ethernetverbindung mit Hilfe des Moduls ModbusAttr.


Vorbedingungen

FHEM läuft und hat genügend Platz für Modifikationen und Logfiles (ca. 100 MByte / Jahr).

Am Wechselrichter

Im zugehörigen Menu ist bereits der Port 503 eingestellt. Trotzdem muss dieser noch einmal aktiviert werden, da sonst Modbus TCP nicht aktiv wird. Hilfe da zu bietet die Installationsanleitung [1]. Es ist möglich, dass es auch nur 10 Minuten aktiv bleibt wenn er nicht angesprochen wird.

ModbusAttr Device in FHEM

in FHEM wird ein ModbusAttr angelegt

define SolarEdge ModbusAttr 1 30 192.168.178.36 TCP

danach alle Attribute aus dem unten stehenden list nach dem Verfahren: attr SolarEdge dev-h-defPoll 1

Mehr Daten sind im Sunspec Protokoll [2] zu finden

List von Device Solaredge in FHEM

Internals:
   BUSY       0
   DEF        1 30 192.168.178.36 TCP
   DEST       192.168.178.36:502
   DeviceName 192.168.178.36:502
   FD         91
   INTERVAL   600
   IODev      KeSolarEdge
   LASTOPEN   1523044866.65275
   MODBUSID   1
   ModuleVersion 3.7.3 - 22.12.2017
   NAME       KeSolarEdge
   NOTIFYDEV  global
   NR         354
   NTFY_ORDER 50-KeSolarEdge
   PARTIAL    
   PROTOCOL   TCP
   REQUESTHEX 00270000000601039c940001
   STATE      0 W; 1718 kWh
   TRIGGERTIME 1523048587.13296
   TRIGGERTIME_FMT 2018-04-06 23:03:07
   TYPE       ModbusAttr
   devioLoglevel 4
   nextOpenDelay 60
   QUEUE:
   READINGS:
     2018-04-06 22:53:07   AC-Energy       1717.665
     2018-04-06 22:53:07   AC-Energy-Scale 0
     2018-04-06 22:53:07   AC-Energy-Val   1717665
     2018-04-06 22:58:10   AC-Power        0
     2018-04-06 22:58:10   AC-Power-Scale  0
     2018-04-06 22:58:10   AC-Power-Val    0
     2018-04-06 22:53:07   DC-Current      0
     2018-04-06 22:53:07   DC-Current-Scale -32768
     2018-04-06 22:53:07   DC-Current-Val  65535
     2018-04-06 22:53:07   DC-Power        0
     2018-04-06 22:53:07   DC-Power-Scale  0
     2018-04-06 22:53:07   DC-Power-Val    0
     2018-04-06 22:53:07   DC-Voltage      0
     2018-04-06 22:53:07   DC-Voltage-Scale -1
     2018-04-06 22:53:07   DC-Voltage-Val  0
     2018-04-06 22:53:07   HeatSinkTemp    0
     2018-04-06 22:53:07   Status          2
     2018-04-06 22:53:07   Zustand         Nachtmodus
     2018-04-06 22:01:06   state           opened
   defptr:
     1:
   gotReadings:
     AC-Power-Scale 0
   helper:
     buffer     
     lid        1
     lrecv      1523048290.49688
     lsend      1523048290.48976
   lastRead:
     h40083     1523048290.48193
     h40084     1523048290.50143
     h40093     1523047987.08669
     h40095     1523047987.09043
     h40096     1523047987.09428
     h40097     1523047987.09784
     h40098     1523047987.10153
     h40099     1523047987.10505
     h40100     1523047987.10867
     h40101     1523047987.11226
     h40103     1523047987.1158
     h40107     1523047987.11994
Attributes:
   dev-h-combine 200
   dev-h-defPoll 1
   dev-h-defShowGet 1
   enableControlSet 1
   event-on-change-reading .*
   event-on-update-reading AC-Energy,AC-Energy-Scale,AC-Power-Scale,DC-Voltage-Scale,DC-Current-Scale,DC-Power-Scale,Status
   maxTimeoutsToReconnect 3
   obj-h40083-reading AC-Power-Val
   obj-h40084-reading AC-Power-Scale
   obj-h40084-unpack s>
   obj-h40093-len 2
   obj-h40093-reading AC-Energy-Val
   obj-h40093-unpack l>
   obj-h40095-reading AC-Energy-Scale
   obj-h40096-reading DC-Current-Val
   obj-h40097-reading DC-Current-Scale
   obj-h40097-unpack s>
   obj-h40098-reading DC-Voltage-Val
   obj-h40099-reading DC-Voltage-Scale
   obj-h40099-unpack s>
   obj-h40100-reading DC-Power-Val
   obj-h40101-reading DC-Power-Scale
   obj-h40101-unpack s>
   obj-h40103-reading HeatSinkTemp
   obj-h40103-unpack s>
   obj-h40107-reading Status
   room       Solar,SolarPV,SolarReport
   silentReconnect 1
   sortUpdate 1
   stateFormat {sprintf("%.0f W; %.0f kWh",ReadingsVal("KeSolarEdge","AC-Power",0),ReadingsVal("KeSolarEdge","AC-Energy",0))}
   userReadings AC-Energy:(AC-Energy-Scale.*) { 
  my $scale = ReadingsVal ("KeSolarEdge","AC-Energy-Scale",0);
  return (ReadingsVal ("KeSolarEdge","AC-Energy-Val",0) * ( 10 ** $scale) / 1000);;},
  
AC-Power:(AC-Power-Scale.*) { 
 my $scale = ReadingsVal ("KeSolarEdge","AC-Power-Scale",0);
 return (ReadingsVal ("KeSolarEdge","AC-Power-Val",0) * ( 10 ** $scale));;},

DC-Power:(DC-Power-Scale.*) { 
 my $scale = ReadingsVal ("KeSolarEdge","DC-Power-Scale",0);
 return (ReadingsVal ("KeSolarEdge","DC-Power-Val",0) * ( 10 ** $scale));;},
  
DC-Current:(DC-Current-Scale.*) {
 my $scale = ReadingsVal ("KeSolarEdge","DC-Current-Scale",0);
 return (ReadingsVal ("KeSolarEdge","DC-Current-Val",0) * ( 10 ** $scale));;},
  
DC-Voltage:(DC-Voltage-Scale.*) { 
 my $scale = ReadingsVal ("KeSolarEdge","DC-Voltage-Scale",0);
 return (ReadingsVal ("KeSolarEdge","DC-Voltage-Val",0) * ( 10 ** $scale));;},
 
Zustand:(Status.*) {
   my $Zus = ReadingsVal("KeSolarEdge","Status",0);
   my $rueck = ReadingsVal("KeSolarEdge","Zustand",0);
   if (($Zus == 2) and (InternalVal("KeSolarEdge","INTERVAL","") != 600)) {
     fhem("set KeSolarEdge interval 600");
	 $rueck = "Nachtmodus";
   }
   elsif  (InternalVal("KeSolarEdge","INTERVAL","") != 60) {
     fhem("set KeSolarEdge interval 60");
	 $rueck = "Tagmodus";
   }
   return ($rueck);;
 }
   webCmdLabel {sprintf("AC-Energy %.3f",ReadingsVal("Solaredge","AC-Energy",0));;}

Dummys anlegen

Zur Verwendung der "at"s werden Dummys benötigt

define pv_energyday_log dummy
define dum_pv_energyday_log dummy 
define dum_pv_energyday_read dummy 
define dum_pv_energymonth_log dummy 
define dum_pv_energymonth_read dummy
define dum_pv_energytoday dummy
define dum_pv_energytomonth dummy
define dum_pv_energytoweek dummy
define dum_pv_energytoyear dummy
define dum_pv_energyweek_log dummy
define dum_pv_energyweek_read dummy
define dum_pv_energyyear_log dummy
define dum_pv_energyyear_read dummy
define dum_pvdcpower dummy
define dum_pvdcvolt dummy
define dum_pvenergy dummy
define dum_pvloss dummy
define dum_pvpower dummy 

at Devices in FHEM

Auslesen der Daten, da das ModbusAttr nicht immer geht:

at_solaredge

+*00:20:00 {
  if (Value("KeSolarEdge") eq "opened") {
    my $ACEnergy = fhem ("get KeSolarEdge AC-Energy");
    my $ACEnergyScale = fhem ("get KeSolarEdge AC-Energy-Scale");
    my $ACE = 0;
	my $day = Value("dum_pv_energyday_read");
	my $week = Value("dum_pv_energyweek_read");
	my $month = Value("dum_pv_energymonth_read");
	my $year = Value("dum_pv_energyyear_read");
    if (($ACEnergy ne "No Data") and ($ACEnergyScale ne "No FD")) {
      my $ACE = $ACEnergy * (10 ** $ACEnergyScale);
	  if ($ACE > 0) {
        fhem ("set dum_pvenergy " . $ACE);
        fhem ("set dum_pv_energytoday " . ($ACE - $day));
        fhem ("set dum_pv_energytoweek " . ($ACE - $week));
        fhem ("set dum_pv_energytomonth " . ($ACE - $month));
        fhem ("set dum_pv_energytoyear " . ($ACE - $year));
	  }
    }
    #Log 1, "at_Solaredge: PV-Energy " . $ACE . "\n";
    my $ACPower = fhem ("get KeSolarEdge AC-Power");
    my $ACPowerScale = fhem ("get KeSolarEdge AC-Power-Scale");
    my $ACP = 0;
    my $DCP = 0;
    if (($ACPower ne "No FD") and ($ACPower ne "No Data") and ($ACPowerScale ne "No FD")) { 
      $ACP = $ACPower * (10 ** $ACPowerScale);
      fhem ("set dum_pvpower " . $ACP);
      #Log 1, "at_Solaredge: PV-Power " . $ACP . "\n";
      my $DCPower = fhem ("get KeSolarEdge DC-Power");
      my $DCPowerScale = fhem ("get KeSolarEdge DC-Power-Scale");
      if (($DCPower ne "no FD") and ($DCPowerScale ne "no FD")) {
        $DCP = $DCPower * (10 ** $DCPowerScale);
        if ($DCP != 0) {
          fhem ("set dum_pvdcpower " . $DCP);
          fhem ("set dum_pvloss " . sprintf("%.1f", ($DCP - $ACP)));
        }
      }
    }
    my $DCVoltage = fhem ("get KeSolarEdge DC-Voltage");
    my $DCVoltageScale = fhem ("get KeSolarEdge DC-Voltage-Scale");
    my $DCV = 0;
    if (($DCVoltage ne "no FD") and ($DCVoltage ne "No Data") and ($DCVoltageScale ne "no FD")) {
      $DCV = $DCVoltage * (10 ** $DCVoltageScale);
      fhem ("set dum_pvdcvolt " . $DCV);
    }
    my $Status = fhem ("get KeSolarEdge Status");
    if ($Status ne "no FD") {
      if ($Status == 2) {
        fhem ("modify at_solaredge +*00:20:00");
      }
      else {
        fhem ("modify at_solaredge +*00:01:00");
      }
    } 
  }
  else {
    Log 1, Value("KeSolarEdge");
    fhem ("modify at_solaredge +*00:01:00");
  }
}

und eines um die Werte täglich zurück zu setzen

at_midnight

*24:00 {
# Abspeichern der täglichen, wöchentlichen und monatlichen Werte
  use Time::Local;
  my ($Psec,$Pmin,$Phour,$Pmday,$Pmonth,$Pyear,$Pwday,$Pyday,$Pisdst) = localtime();
  if(Value("KeSolarEdge") eq "opened") {
  	my $pvenergy = fhem("get KeSolarEdge AC-Energy");
    Log 5, "at_midnight AC-Energy" . " " . $pvenergy;
    if ($pvenergy ne "No FD") {
      my $pvet = Value("dum_pv_energyday_read");
      #Log 5, "at_midnight dum_pv_energyday_read " . $pvet;
      fhem ("set dum_pv_energyday_log " . ($pvenergy - $pvet));
      #Log 5, "at_midnight dum_pv_energyday" . " " . $pvenergy;
      fhem ("set dum_pv_energyday_read " . $pvenergy);
      #Log 5, "at_midnight dum_pv_energyday_read" . " " . $pvenergy;
      fhem ("modify at_midnight *24:00");
      if ($Pwday == 1) {
	    my $pvet = Value("dum_pv_energyweek_read");
        fhem ("set dum_pv_energyweek_log " . ($pvenergy - $pvet));
        fhem ("set dum_pv_energyweek_read " . $pvenergy);
	  }
      if ($Pmday == 1) {
	    my $pvet = Value("dum_pv_energymonth_read");
        fhem ("set dum_pv_energymonth_log " . ($pvenergy - $pvet));
        fhem ("set dum_pv_energymonth_read " . $pvenergy);
      }
      if ($Pyday == 1) {
	    my $pvet = Value("dum_pv_energyyear_read");
        fhem ("set dum_pv_energyyear_log " . ($pvenergy - $pvet));
        fhem ("set dum_pv_energyyear_read " . $pvenergy);
      }
    }
	else {
	  fhem ("modify at_midnight +00:01");
	  Log 2, "at_midnight Solaredge  AC-Energy No FD"
    }
  }
  else {
    fhem ("modify at_midnight +00:01");
	Log 2, "at_midnight Solaredge not opened"
  }
}

Log

Das ModbusDevice legt sich ein eigenes Log an. Um aber übersichtliche Grafiken zu bekommen werden die Daten des Dummy benötigt. Hier hilft ein Logfile

define FileLog_KePv Filelog %L/pv-%Y.log dum_pv*.*

Grafiken

Todo: Beschreibungen zu SVG hinterlegen


Links

  1. Solaredge: Installationsanleitung
  2. Solaredge: Sunspec Protokoll