From 89793fe94b5ba9a36bea86dbb123392840df36f8 Mon Sep 17 00:00:00 2001 From: bohdan-s Date: Fri, 24 Dec 2021 14:31:06 +1100 Subject: [PATCH] add manual_load option --- SunGather/config-example.yaml | 7 ++++--- SunGather/registers.yaml | 2 +- SunGather/sungather.py | 6 ++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/SunGather/config-example.yaml b/SunGather/config-example.yaml index cfc74ac..f9b15a8 100644 --- a/SunGather/config-example.yaml +++ b/SunGather/config-example.yaml @@ -5,12 +5,13 @@ inverter: # timeout: 10 # Default is 10 # scan_interval: 30 # Default is 30 connection: sungrow # options: modbus, sungrow, http - # model: "SG7.0RT" # This is autodected on startup, only needed if detection issues or for testing + # model: "SG7.0RT" # This is autodetected on startup, only needed if detection issues or for testing # See model list here: https://github.com/bohdan-s/SunGather#supported # smart_meter: True # Default is False, Set to true if inverter supports reading grind / house consumption - # use_local_time: False # Default False, Uses Inveter time, if try uses PC time when updating timestamps (e.g. PVOutput) + # use_local_time: False # Default False, Uses Inventer time, if try uses PC time when updating timestamps (e.g. PVOutput) # hybrid: False # Default false, if you have a Hybrid (battery) set to True - # logging: 30 # 10 = Debug, 20 = Info, 30 = Warnning (default), 40 = Error + # manual_load: False # Manually calculate load total_active_power + meter_power if the inverter does not supply it + # logging: 30 # 10 = Debug, 20 = Info, 30 = Warning (default), 40 = Error # level: 1 # 0 = Model and Solar Generation, # 1 (default) = Useful data, all required for exports, # 2 everything your Inverter supports, diff --git a/SunGather/registers.yaml b/SunGather/registers.yaml index fbe2877..5a0bfc0 100644 --- a/SunGather/registers.yaml +++ b/SunGather/registers.yaml @@ -685,7 +685,7 @@ registers: # - name: "Reserved" # address: 5152 # datatype: "U16" - # Folling 2 registers are not in the documentation, but other projects are using them + # Following 2 registers are not in the documentation, but other projects are using them - name: "export_power" level: 3 address: 5216 diff --git a/SunGather/sungather.py b/SunGather/sungather.py index 93403ab..2e1ebe5 100644 --- a/SunGather/sungather.py +++ b/SunGather/sungather.py @@ -282,6 +282,12 @@ def scrape_inverter(): inverter["import_from_grid"] = power except Exception: pass + + try: + if inverter.get('manual_load', False): # Inverter is returning no data, we need to calculate it manually + inverter["load_power"] = int(inverter.get('total_active_power')) + int(inverter.get('meter_power')) + except Exception: + pass # See if the inverter is running, This is added to inverters so can be read via MQTT etc... # It is also used below, as some registers hold the last value on 'stop' so we need to set to 0