Add 'zero_on_standby' this will 0 registers like temp when they 'stick' during standby mode

This commit is contained in:
bohdan-s
2022-01-13 22:23:57 +11:00
parent 70fc102632
commit 9ac3926c2c
5 changed files with 17 additions and 10 deletions
-2
View File
@@ -214,11 +214,9 @@ sensor:
The additional sensors then setup in HA are the following with Wh unit of measurement for the Energy platform. The additional sensors then setup in HA are the following with Wh unit of measurement for the Energy platform.
```
Solar Production (Sungather) Solar Production (Sungather)
Return to Grid (Sungather) Return to Grid (Sungather)
Grid Consumption (Sungather) Grid Consumption (Sungather)
```
Restart Home Assistant for the sensors.yaml to be loaded. Restart Home Assistant for the sensors.yaml to be loaded.
Make sure SunGather is running, wait 5 minutes for initial data to populate. Make sure SunGather is running, wait 5 minutes for initial data to populate.
+3 -2
View File
@@ -9,6 +9,7 @@ inverter:
# See model list here: https://github.com/bohdan-s/SunGather#supported # See model list here: https://github.com/bohdan-s/SunGather#supported
# smart_meter: True # [Optional] Default is False, Set to true if inverter supports reading grind / house consumption # smart_meter: True # [Optional] Default is False, Set to true if inverter supports reading grind / house consumption
# use_local_time: False # [Optional] Default False, Uses Inventer time, if try uses PC time when updating timestamps (e.g. PVOutput) # use_local_time: False # [Optional] Default False, Uses Inventer time, if try uses PC time when updating timestamps (e.g. PVOutput)
# zero_on_standby: False # [Optional] Default False, Some registers will 'stick' to the last value when inverter goes into standby mode, enabling this will have them force return 0, helps with graphing
# manual_load: False # [Optional] Manually calculate load total_active_power + meter_power if the inverter does not supply it # manual_load: False # [Optional] Manually calculate load total_active_power + meter_power if the inverter does not supply it
# logging: 30 # [Optional] 10 = Debug, 20 = Info, 30 = Warning (default), 40 = Error # logging: 30 # [Optional] 10 = Debug, 20 = Info, 30 = Warning (default), 40 = Error
# level: 1 # [Optional] Set the amount of information to gather # level: 1 # [Optional] Set the amount of information to gather
@@ -133,8 +134,8 @@ exports:
register: load_power # Current Home usage (Power) register: load_power # Current Home usage (Power)
- name: v5 # Temperature - name: v5 # Temperature
register: internal_temperature # Inverter internal temperature register: internal_temperature # Inverter internal temperature
# - name: v6 # Voltage - name: v6 # Voltage
# register: total_active_power register: mppt_1_voltage # Read voltage from first MPPT
- name: c1 # Cumulative Flag, - name: c1 # Cumulative Flag,
value: 1 # If using v2/v4 set to 1 value: 1 # If using v2/v4 set to 1
# - name: "n" # Net Flag # - name: "n" # Net Flag
+3 -1
View File
@@ -209,16 +209,18 @@ registers:
address: 5008 address: 5008
datatype: "S16" datatype: "S16"
multiple: 0.1 multiple: 0.1
zero_on_standby: True
- name: "total_apparent_power" - name: "total_apparent_power"
level: 1 level: 1
address: 5009 address: 5009
datatype: "U32" datatype: "U32"
models: ["SG6KTL-MT", "SG8KTL-M", "SG10KTL-M", "SG10KTL-MT", "SG12KTL-M", "SG15KTL-M", "SG17KTL-M", "SG20KTL-M", "SG3.0RT", "SG4.0RT", "SG5.0RT", "SG6.0RT", "SG7.0RT", "SG8.0RT", "SG10RT", "SG12RT", "SG15RT", "SG17RT", "SG20RT", "SG33K3J", "SG36KTL-M", "SG40KTL-M", "SG50KTL", "SG50KTL-M", "SG60KTL", "SG60KTL-M", "SG60KU-M", "SG80KTL", "SG80KTL-M", "SG111HV", "SG125HV", "SG125HV-20", "SG33CX", "SG40CX", "SG50CX", "SG110CX", "SG250HX", "SG30CX", "SG36CX-US", "SG60CX-US", "SG250HX-US", "SG250HX-IN", "SG25CX-SA", "SG100CX", "SG75CX", "SG225HX"] models: ["SG6KTL-MT", "SG8KTL-M", "SG10KTL-M", "SG10KTL-MT", "SG12KTL-M", "SG15KTL-M", "SG17KTL-M", "SG20KTL-M", "SG3.0RT", "SG4.0RT", "SG5.0RT", "SG6.0RT", "SG7.0RT", "SG8.0RT", "SG10RT", "SG12RT", "SG15RT", "SG17RT", "SG20RT", "SG33K3J", "SG36KTL-M", "SG40KTL-M", "SG50KTL", "SG50KTL-M", "SG60KTL", "SG60KTL-M", "SG60KU-M", "SG80KTL", "SG80KTL-M", "SG111HV", "SG125HV", "SG125HV-20", "SG33CX", "SG40CX", "SG50CX", "SG110CX", "SG250HX", "SG30CX", "SG36CX-US", "SG60CX-US", "SG250HX-US", "SG250HX-IN", "SG25CX-SA", "SG100CX", "SG75CX", "SG225HX"]
- name: "mppt_1_voltage" - name: "mppt_1_voltage"
level: 2 level: 1
address: 5011 address: 5011
datatype: "U16" datatype: "U16"
multiple: 0.1 multiple: 0.1
zero_on_standby: True
- name: "mppt_1_current" - name: "mppt_1_current"
level: 2 level: 2
address: 5012 address: 5012
+7 -1
View File
@@ -204,6 +204,9 @@ def load_registers(register_type, start, count=100):
if register.get('multiple'): if register.get('multiple'):
register_value = round(register_value * register.get('multiple'),2) register_value = round(register_value * register.get('multiple'),2)
if register.get('zero_on_standby') and inverter["run_state"] == "OFF":
register_value = 0
# Set the final register value with adjustments above included # Set the final register value with adjustments above included
inverter[register_name] = register_value inverter[register_name] = register_value
break break
@@ -377,9 +380,12 @@ def main():
while True: while True:
loop_start = datetime.now() loop_start = datetime.now()
# Clear previous inverter values, keep the model # Clear previous inverter values, keep the model and run state
if inverter.get("run_state"): run_state = inverter["run_state"]
else: run_state = "ON"
inverter = {} inverter = {}
inverter['device_type_code'] = model inverter['device_type_code'] = model
inverter["run_state"] = run_state
if not client: if not client:
client = connect_inverter() client = connect_inverter()
+1 -1
View File
@@ -1 +1 @@
__version__ = '0.2.1' __version__ = '0.2.2'