Skip to content

Rincewind76/SMAInverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 

Repository files navigation

#76_SMAInverter.pm FHEM Support for SMA Inverters over "Speedwire" TCP/IP network

##Description## Module for the integration of a SMA Inverter over it's Speedwire (=Ethernet) Interface.

Tested on Sunny Tripower 6000TL-20, 10000TL-20 and Sunny Island 4.4 with Speedwire/Webconnect Piggyback.

###Requirements### This module requires:

  • Perl Module: IO::Socket::INET (apt-get install libio-socket-perl)
  • Perl Module: Date::Time (apt-get install libdatetime-perl)
  • Perl Module: Time::HiRes (In Debian/Ubuntu/Raspbian part of default per installation)
  • FHEM Module: 99_SUNRISE_EL.pm
  • FHEM Module: Blocking.pm

###Define###

define <name> SMAInverter <pin> <hostname/ip>

  • pin: User-Password of the SMA Inverter. Default is 0000. Can be changed by "Sunny Explorer" Windows Software
  • hostname/ip: Hostname or IP-Adress of the inverter (or it's speedwire piggyback module).
  • Port of the inverter is 9522 by default. Firewall has to allow connections on this port!

###Operation method#### The module sends commands to the inverter and checks if they are supported by the inverter. In case of a positive answer, the data is collected and displayed in the readings according to the detail-level.

If more than one inverter is installed, set attributes "target-susyid" and "target-serial" with an appropriate value.

The normal operation time of the inverter is supposed from sunrise to sunset. In that time period the inverter will be polled. The time of sunrise and sunset will be calculated by functions of FHEM module 99_SUNRISE_EL.pm which is loaded automatically by default. Therefore the global attribute "longitude" and "latitude" should be set to determine the position of the solar system

By the attribute "suppressSleep" the sleep mode between sunset and sunrise can be suppressed. Using attribute "offset" you may prefer the sunrise and defer the sunset virtually. So the working period of the inverter will be extended.

In operating mode "automatic" the inverter will be requested periodically corresponding the preset attribute "interval". The operating mode can be switched to "manual" to realize the retrieval manually (e.g. to synchronize the requst with a SMA energy meter by notify).

During inverter operating time, the average energy production of the last 5, 10 and 15 minutes will be calculated and displayed in the readings

"avg_power_lastminutes_05"

"avg_power_lastminutes_10"

and

``"avg_power_lastminutes_15".```

Note: To permit a precise calculation, you should also set the real request interval into the attribute "interval" although you would use the "manual" operation mode !

The retrieval of the inverter will be executed non-blocking. You can adjust the timeout value for this background process by attribute "timeout".

###Get###

get <name> data

The request of the inverter will be executed. Those possibility is especifically created for the "manual" operation mode (see attribute "mode").

####Attributes###

  • interval : Queryintreval in seconds
  • detail-level : "0" - Only Power and Energy / "1" - Including Voltage and Current / "2" - All values
  • disable : 1 = the module is disabled
  • mode : automatic = the inverter will be polled by preset interval, manual = query only by command "get <name> data"
  • offset : time in seconds to prefer the sunrise respectively defer the sunset virtualy (0 ... 7200). You will be able to extend the working
                              period of the module. </li>
    
  • SBFSpotComp : 1 = the readings are created like SBFSpot-style
  • suppressSleep : the sleep mode (after sunset, before sunrise) is deactivated and the inverter will be polled continuously.
  • showproctime : shows processing time in background and wasted time to retrieve inverter data
  • target-susyid : In case of a Multigate the target SUSyID can be defined. If more than one inverter is installed you have to
                              set the inverter-SUSyID to assign the inverter to the device definition.
    
                              Default is 0xFFFF, means any SUSyID</li>
    
  • target-serial : In case of a Multigate the target Serialnumber can be defined. If more than one inverter is installed you have to
                              set the inverter-Serialnumber to assign the inverter to the device definition.
    
    						  Default is 0xFFFFFFFF, means any Serialnumber</li>
    
  • timeout : setup timeout of inverter data request (default 60s)

###Readings####

  • BAT_CYCLES / bat_cycles : Battery recharge cycles
  • BAT_IDC / bat_idc : Battery Current
  • BAT_TEMP / bat_temp : Battery temperature
  • BAT_UDC / bat_udc : Battery Voltage
  • ChargeStatus / chargestatus : Battery Charge status
  • CLASS / device_class : Inverter Class
  • PACMAX1 / pac_max_phase_1 : Nominal power in Ok Mode
  • PACMAX1_2 / pac_max_phase_1_2 : Maximum active power device (Some inverters like SB3300/SB1200)
  • PACMAX2 / pac_max_phase_2 : Nominal power in Warning Mode
  • PACMAX3 / pac_max_phase_3 : Nominal power in Fault Mode
  • Serialnumber / serial_number : Inverter Serialnumber
  • SPOT_ETODAY / etoday : Today yield
  • SPOT_ETOTAL / etotal : Total yield
  • SPOT_FEEDTM / feed-in_time : Feed-in time
  • SPOT_FREQ / grid_freq. : Grid Frequency
  • SPOT_IAC1 / phase_1_iac : Grid current phase L1
  • SPOT_IAC2 / phase_2_iac : Grid current phase L2
  • 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_OPERTM / operation_time : Operation Time
  • SPOT_PAC1 / phase_1_pac : Power L1
  • SPOT_PAC2 / phase_2_pac : Power L2
  • SPOT_PAC3 / phase_3_pac : Power L3
  • 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_UAC1 / phase_1_uac : Grid voltage phase L1
  • SPOT_UAC2 / phase_2_uac : Grid voltage phase L2
  • SPOT_UAC3 / phase_3_uac : Grid voltage phase L3
  • SPOT_UDC1 / string_1_udc : DC voltage input
  • SPOT_UDC2 / string_2_udc : DC voltage input
  • SUSyID / susyid : Inverter SUSyID
  • INV_TEMP / device_temperature : Inverter temperature
  • INV_TYPE / device_type : Inverter Type
  • POWER_IN / power_in : Battery Charging power
  • POWER_OUT / power_out : Battery Discharging power
  • INV_GRIDRELAY / gridrelay_status : Grid Relay/Contactor Status
  • INV_STATUS / device_status : Inverter Status
  • opertime_start : Begin of iverter operating time corresponding the calculated time of sunrise with consideration of the
                                               attribute "offset" (if set) </li>
    
  • opertime_stop : End of iverter operating time corresponding the calculated time of sunrise with consideration of the
                                               attribute "offset" (if set) </li>
    
  • modulstate : shows the current module state "normal" or "sleep" if the inverter won't be requested at the time.
  • avg_power_lastminutes_05 : average power of the last 5 minutes.
  • avg_power_lastminutes_10 : average power of the last 10 minutes.
  • avg_power_lastminutes_15 : average power of the last 15 minutes.
  • inverter_processing_time : wasted time to retrieve the inverter data
  • background_processing_time : total wasted time by background process (BlockingCall)