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.
This is based on the original work of Wouter van der Zwan and includes some improvements made by others.
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.
git clone https://github.com/XtheOne/Inverter-Data-Logger.git
pip install six
and if you use MQTT install pip install paho-mqtt
for PVoutput add: pip install pytz
config-org.cfg
to config.cfg
config.cfg
(See 'Configuration')python LiveStats.py
, when successful you should see data from your inverter.python InverterExport.py
or better set a scheduled task or cronjob. (See 'Setting cronjob')python InverterServer.py
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.
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.
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.
This crontab line with these options this will execute the script every minute.
* * * * * /usr/bin/python /home/username/Inverter-Data-Logger/InverterExport.py
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'.
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.
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.