XtheOne / Inverter-Data-Logger

Data logger for Omnik/Hosola and other Solarman Wi-Fi kit powered Solar Inverters
GNU General Public License v3.0
118 stars 28 forks source link

Inverter Data Logger

Inverter Data Logger is a small script for uploading data from a Omnik, Hosola, Goodwe, Solax, Ginlong, Samil, Sofar or Power-One Solar inverter, equipped with a wifi module or connected to a Wi-Fi data logger from iGEN tech, to a database, Domoticz and/or to PVoutput.org.

This script is designed to be run as a cronjob (or scheduled tasks on Windows) every minute. Every time this script is run the data from the inverter(s) will be send to the enabled plugin(s). And with a five minute interval the data will also be uploaded to PVoutput.org as a live status when enabled.

As an alternative a server script can be run which listens for incomming connections from the logger.

Origin

This is based on the original work of Wouter van der Zwan and includes some improvements made by others.

Supported inverters

With wifi kits in the range 601xxxxxx it is not possible to get the data directly from the inverter. So sniffing the data send to the Omnik portal is required, see OmnikMQTT by wouterbaake .

Owners of a Wifi kit starting with s/n 402xxxxxxx should checkout Omnikol-PV-Logger by t3kpunk.

Installation and Setup

Configuration

open config.cfg

There a few settings that you have to change to get a minimal working script:

set a fixed IP for one or more inverters like the example, or let the script do a auto-scan:

[logger]
# ip,sn,ip,sn,ip,sn or auto
# IP address of your inverter(s) data logger and S/N of the wifi kit(s)
#gateways = 192.168.1.10,602123456, 192.168.1.11,602987654
# Automatically detect logger(s) on the local network
gateways = auto
# Default for the Wifi module/logger/gateway
port = 8899
# time to wait for inverter logger response
timeout = 3

Besure that you have the S/N ready from the inverterm in case that you user the manual input. You can find it in the webpage of your inverter or on the inverter case.

Setup Domoticz support

To enable Domoticz support, enable the DomoticzOutput plugin in the config file. Then Create the following new hardware:

Now Create the following Virtual Sensors:

Identifier Sensor Type Name
Electric_meter_idx Electric (Instant + Counter) Actual Output Power (after creation, set 'Type:' to 'Return' and 'Energy read:' to 'From device')
PV1_voltage_idx Voltage DC Voltage PV1
PV2_voltage_idx Voltage DC Voltage PV2
PV1_current_idx Ampere (1 Phase) DC Current PV1
PV2_current_idx Ampere (1 Phase) DC Current PV2
AC1_voltage_idx Voltage AC Output Voltage
AC1_current_idx Ampere (1 Phase) AC Output Current
AC1_power_idx Usage (Electric) AC Output Power
AC1_frequency_idx Custom Sensor (Hertz) AC Frequency
--- Optional sensors ---
Temp_idx Temperature Temperature
H_total_idx Custom Sensor (Hours) Total run Hours
PV123_voltage_idx Ampere (3 Phase) DC Voltage PV1/2/3 (No 3 phase voltage device exists...)
PV123_current_idx Ampere (3 Phase) DC Current PV1/2/3
AC123_voltage_idx Ampere (3 Phase) AC 1/2/3 Output Voltage (No 3 phase voltage device exists...)
AC123_current_idx Ampere (3 Phase) AC 1/2/3 Output Current
AC123_power_idx Usage (Electric) AC Output Power (total for 3 phase inverter)
E_today_idx Custom Sensor (kWh) Energy today
E_total_idx Custom Sensor (kWh) Total Energy
E_total_c_idx Counter Energy production (after creation, set Type to 'Energy Generated')

Now go to Devices and fill the Idx of these virtual sensors into the config file. This is for a single phase inverter with 2 PV strings and basic values, more virtual sensors can be added for other identifiers.

Server config

To use the Server script configure the listen IP and port and use these in the Wi-Fi-logger. Configure Remote Server B or C in the Wi-Fi- logger to point to the InverterServer IP and Port using TCP protocol.

Setting cronjob

For Linux/Unix

This crontab line with these options this will execute the script every minute.

For Windows

This scheduled task with these options this will execute the script every minute.

NOTE: If you need to kill the process manually: open Task Manager > Processes > Tick 'Show Processes from all users' > right click 'python.exe' > select 'End Process'.

Why copy config-org.cfg, can't I edit it directly?

Yes you can edit config-org.cfg directly. However, if you want to update the script your settings will be overwritten with the default values. By creating config.cfg, you can preserve your settings when upgrading.

Development

To help with development when no sun is present a small simulator script can be found in the folder Development. This script works by reading values from to database used by the MysqlOutput, but with the time shifted 6 hours back. To use the simulator, you should use the MysqlOutput to fill the database and configure database settings in de sim-config.cfg file.