diff --git a/README.md b/README.md index 80ec0e0..5411ad8 100644 --- a/README.md +++ b/README.md @@ -214,11 +214,9 @@ sensor: The additional sensors then setup in HA are the following with Wh unit of measurement for the Energy platform. -``` -Solar Production (Sungather) -Return to Grid (Sungather) -Grid Consumption (Sungather) -``` +Solar Production (Sungather) +Return to Grid (Sungather) +Grid Consumption (Sungather) Restart Home Assistant for the sensors.yaml to be loaded. Make sure SunGather is running, wait 5 minutes for initial data to populate. diff --git a/SunGather/config-example.yaml b/SunGather/config-example.yaml index 94140ac..d443f8d 100644 --- a/SunGather/config-example.yaml +++ b/SunGather/config-example.yaml @@ -9,6 +9,7 @@ inverter: # 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 # 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 # logging: 30 # [Optional] 10 = Debug, 20 = Info, 30 = Warning (default), 40 = Error # level: 1 # [Optional] Set the amount of information to gather @@ -133,8 +134,8 @@ exports: register: load_power # Current Home usage (Power) - name: v5 # Temperature register: internal_temperature # Inverter internal temperature -# - name: v6 # Voltage -# register: total_active_power + - name: v6 # Voltage + register: mppt_1_voltage # Read voltage from first MPPT - name: c1 # Cumulative Flag, value: 1 # If using v2/v4 set to 1 # - name: "n" # Net Flag diff --git a/SunGather/registers.yaml b/SunGather/registers.yaml index 6e0b43c..44355b0 100644 --- a/SunGather/registers.yaml +++ b/SunGather/registers.yaml @@ -209,16 +209,18 @@ registers: address: 5008 datatype: "S16" multiple: 0.1 + zero_on_standby: True - name: "total_apparent_power" level: 1 address: 5009 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"] - name: "mppt_1_voltage" - level: 2 + level: 1 address: 5011 datatype: "U16" multiple: 0.1 + zero_on_standby: True - name: "mppt_1_current" level: 2 address: 5012 diff --git a/SunGather/sungather.py b/SunGather/sungather.py index 5aa1d3f..0a64ba3 100644 --- a/SunGather/sungather.py +++ b/SunGather/sungather.py @@ -204,6 +204,9 @@ def load_registers(register_type, start, count=100): if register.get('multiple'): 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 inverter[register_name] = register_value break @@ -377,9 +380,12 @@ def main(): while True: 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['device_type_code'] = model + inverter["run_state"] = run_state if not client: client = connect_inverter() diff --git a/SunGather/version.py b/SunGather/version.py index fb13a35..9dd16a3 100644 --- a/SunGather/version.py +++ b/SunGather/version.py @@ -1 +1 @@ -__version__ = '0.2.1' \ No newline at end of file +__version__ = '0.2.2' \ No newline at end of file