mirror of
https://github.com/alexhopeoconnor/SunGather.git
synced 2026-10-23 02:52:10 +10:00
v0.3.7: fix issues with cumulative flag in PVOutput
This commit is contained in:
@@ -9,12 +9,14 @@
|
|||||||
<br />
|
<br />
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
<h2 align="center">SunGather</h3>
|
<h2 align="center">SunGather</h2>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
Collect data from Sungrow Inverters using ModbusTcpClient, <a href="https://github.com/rpvelloso/Sungrow-Modbus">SungrowModbusTcpClient</a> or <a href="https://github.com/bohdan-s/SungrowModbusWebClient">SungrowModbusWebClient</a> and export to various locations.
|
Collect data from Sungrow Inverters using ModbusTcpClient, <a href="https://github.com/rpvelloso/Sungrow-Modbus">SungrowModbusTcpClient</a> or <a href="https://github.com/bohdan-s/SungrowModbusWebClient">SungrowModbusWebClient</a> and export to various locations.
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
<a href="https://sungather.app">Website Sungather.app</a>
|
||||||
|
·
|
||||||
<a href="https://github.com/bohdan-s/SunGather/issues">Report Bug</a>
|
<a href="https://github.com/bohdan-s/SunGather/issues">Report Bug</a>
|
||||||
·
|
·
|
||||||
<a href="https://github.com/bohdan-s/SunGather/issues">Request Feature</a>
|
<a href="https://github.com/bohdan-s/SunGather/issues">Request Feature</a>
|
||||||
@@ -51,64 +53,19 @@ I have learned a lot from the following projects, THANK YOU
|
|||||||
## Raodmap / TO DO
|
## Raodmap / TO DO
|
||||||
* Full Home Assistant integration, as HACS addon
|
* Full Home Assistant integration, as HACS addon
|
||||||
|
|
||||||
## Updates
|
|
||||||
**0.3.2**
|
|
||||||
* Added logging to file
|
|
||||||
* Hopefully better connection recovery
|
|
||||||
* Bug fixes
|
|
||||||
|
|
||||||
**0.3.0**
|
|
||||||
**IMPORTANT: If updating from v0.1.x or v0.2.x please check config against config-example. some options for MQTT and PVOutput have changed**
|
|
||||||
* Heaps bug fixes
|
|
||||||
* Fixed PVOutput not working after midnight
|
|
||||||
* MQTT now auto-reconnects
|
|
||||||
* MQTT/PVOutput now verify values exist before trying to publish
|
|
||||||
* Rasberry Pi Docker support
|
|
||||||
* lots more...
|
|
||||||
|
|
||||||
|
|
||||||
**0.2.2**
|
|
||||||
* Minor bug fixes
|
|
||||||
* Add support for some inverter scrapes to fail
|
|
||||||
* Add support for zero_on_standby, this will 0 registers like temp that 'stick' to the last value when the inverter goes into standy. Handy if you want to graph 0 instead of the last read overnight
|
|
||||||
|
|
||||||
**0.2.1**
|
|
||||||
* Minor bug fixes
|
|
||||||
* Updated config-example.yaml to clearly explain each option and if it is required or optional
|
|
||||||
* Replace is_running with run_state, was using bool which was causing errors in MQTT, run_state uses "ON" and "OFF"
|
|
||||||
|
|
||||||
**0.2.0**
|
|
||||||
**IMPORTANT: If updating from v0.1.x please check config against config-example. some options for MQTT and PVOutput have changed**
|
|
||||||
* Re-write to Inverter scanning code, improved performance and more resilient to failures
|
|
||||||
* Re-write to PVOutput code, now uploads every 5 minutes as per API documentation, averages all data points over the 5 min window to reduce random high/low values
|
|
||||||
* Re-Write to MQTT code, now supports multiple sensor types
|
|
||||||
|
|
||||||
**0.1.3**
|
|
||||||
* Improved error recovery, e.g. Inverter powers down overnight
|
|
||||||
|
|
||||||
**0.1.2**
|
|
||||||
* Added InfluxDB export
|
|
||||||
|
|
||||||
**0.1.1**
|
|
||||||
* Added docker image
|
|
||||||
* Added simple http web server
|
|
||||||
* Improved recovery when errors (See: SungrowModbusWebClient 0.2.6)
|
|
||||||
|
|
||||||
**0.1.0**
|
|
||||||
Initial build
|
|
||||||
|
|
||||||
### Built With
|
### Built With
|
||||||
|
|
||||||
* [Python3](https://www.python.org/)
|
* [Python3](https://www.python.org/)
|
||||||
|
|
||||||
### Requires
|
### Requires
|
||||||
* [paho-mqtt>=1.5.1](https://pypi.org/project/paho-mqtt/)
|
* [paho-mqtt](https://pypi.org/project/paho-mqtt/)
|
||||||
* [pymodbus>=2.4.0](https://pypi.org/project/pymodbus/)
|
* [pymodbus](https://pypi.org/project/pymodbus/)
|
||||||
* [SungrowModbusTcpClient>=0.1.6](https://pypi.org/project/SungrowModbusTcpClient/)
|
* [SungrowModbusTcpClient](https://pypi.org/project/SungrowModbusTcpClient/)
|
||||||
* [SungrowModbusWebClient>=0.2.6](https://pypi.org/project/SungrowModbusWebClient/)
|
* [SungrowModbusWebClient](https://pypi.org/project/SungrowModbusWebClient/)
|
||||||
* [PyYAML>=6.0](https://pypi.org/project/PyYAML/)
|
* [PyYAML](https://pypi.org/project/PyYAML/)
|
||||||
* [requests>=2.26.0](https://pypi.org/project/requests/)
|
* [requests](https://pypi.org/project/requests/)
|
||||||
* [influxdb-client>=1.24.0](https://pypi.org/project/influxdb-client/)
|
* [influxdb-client](https://pypi.org/project/influxdb-client/)
|
||||||
|
|
||||||
<p align="right">(<a href="#top">back to top</a>)</p>
|
<p align="right">(<a href="#top">back to top</a>)</p>
|
||||||
|
|
||||||
|
|||||||
@@ -125,10 +125,17 @@ class export_pvoutput(object):
|
|||||||
# Add new data to old data and increase count of data points
|
# Add new data to old data and increase count of data points
|
||||||
for parameter in self.pvoutput_parameters:
|
for parameter in self.pvoutput_parameters:
|
||||||
value = inverter.getRegisterValue(parameter.get('register'))
|
value = inverter.getRegisterValue(parameter.get('register'))
|
||||||
|
|
||||||
if parameter.get('multiple'):
|
if parameter.get('multiple'):
|
||||||
value = value * parameter.get('multiple')
|
value = value * parameter.get('multiple')
|
||||||
|
|
||||||
if self.collected_data.get(parameter.get('name'),False):
|
# If using Cumulative Energy we just need the last data point, not the average
|
||||||
|
if parameter.get('name') == 'v1' and (self.pvoutput_config['cumulative_flag'] == 1 or self.pvoutput_config['cumulative_flag'] == 2):
|
||||||
|
self.collected_data[parameter.get('name')] = value
|
||||||
|
elif parameter.get('name') == 'v3' and (self.pvoutput_config['cumulative_flag'] == 1 or self.pvoutput_config['cumulative_flag'] == 3):
|
||||||
|
self.collected_data[parameter.get('name')] = value
|
||||||
|
# Add the last data point to the previous data point if exists, otherwise set as the last data point
|
||||||
|
elif self.collected_data.get(parameter.get('name'),False):
|
||||||
self.collected_data[parameter.get('name')] = round(self.collected_data[parameter.get('name')] + value,3)
|
self.collected_data[parameter.get('name')] = round(self.collected_data[parameter.get('name')] + value,3)
|
||||||
else:
|
else:
|
||||||
self.collected_data[parameter.get('name')] = value
|
self.collected_data[parameter.get('name')] = value
|
||||||
@@ -153,7 +160,11 @@ class export_pvoutput(object):
|
|||||||
for x in range(1, 13):
|
for x in range(1, 13):
|
||||||
field = 'v' + str(x)
|
field = 'v' + str(x)
|
||||||
if self.collected_data.get(field):
|
if self.collected_data.get(field):
|
||||||
if x == 6 or x == 7: # Round to 1 decimal place
|
if x == 1 and (self.pvoutput_config['cumulative_flag'] == 1 or self.pvoutput_config['cumulative_flag'] == 2):
|
||||||
|
continue # Do nothing
|
||||||
|
elif x == 3 and (self.pvoutput_config['cumulative_flag'] == 1 or self.pvoutput_config['cumulative_flag'] == 3):
|
||||||
|
continue # do nothing
|
||||||
|
elif x == 6 or x == 7: # Round to 1 decimal place
|
||||||
value = round(self.collected_data[field] / self.collected_data['count'], 1)
|
value = round(self.collected_data[field] / self.collected_data['count'], 1)
|
||||||
else: # Getting errors when uploading decimals for power/energy so return INT
|
else: # Getting errors when uploading decimals for power/energy so return INT
|
||||||
value = int((self.collected_data[field] / self.collected_data['count']))
|
value = int((self.collected_data[field] / self.collected_data['count']))
|
||||||
|
|||||||
@@ -405,6 +405,7 @@ def main():
|
|||||||
for opt, arg in opts:
|
for opt, arg in opts:
|
||||||
if opt == '-h':
|
if opt == '-h':
|
||||||
print(f'\nSunGather {__version__}')
|
print(f'\nSunGather {__version__}')
|
||||||
|
print(f'\nhttps://sungather.app')
|
||||||
print(f'usage: python3 sungather.py [options]')
|
print(f'usage: python3 sungather.py [options]')
|
||||||
print(f'\nCommandling arguments override any config file settings')
|
print(f'\nCommandling arguments override any config file settings')
|
||||||
print(f'Options and arguments:')
|
print(f'Options and arguments:')
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = '0.3.6'
|
__version__ = '0.3.7'
|
||||||
Reference in New Issue
Block a user