Skip to content

Commit 8f991ac

Browse files
committed
fix long line issues
1 parent 8be12b0 commit 8f991ac

1 file changed

Lines changed: 83 additions & 41 deletions

File tree

growattServer/base_api.py

Lines changed: 83 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,11 @@ def mix_detail( # noqa: D417
752752
'unit2' -- Unit of measurement e.g kW
753753
754754
755-
NOTE - It is possible to calculate the PV generation that went into charging the batteries by performing the following calculation:
756-
Solar to Battery = Solar Generation - Export to Grid - Load consumption from solar
757-
epvToday (from mix_info) - eAcCharge - eChargeToday
755+
NOTE - It is possible to calculate the PV generation that went into
756+
charging the batteries by performing the following calculation:
757+
Solar to Battery = Solar Generation - Export to Grid -
758+
Load consumption from solar
759+
epvToday (from mix_info) - eAcCharge - eChargeToday
758760
759761
"""
760762
date_str = self.__get_date_string(timespan, date)
@@ -798,8 +800,10 @@ def dashboard_data( # noqa: D417
798800
(Default datetime.datetime.now())
799801
800802
Returns:
801-
A chartData object where each entry is for a specific 5 minute window e.g. 00:05 and 00:10 respectively (below)
802-
NOTE: The keys are interpreted differently, the examples below describe what they are used for in a 'Mix' system
803+
A chartData object where each entry is for a specific 5 minute
804+
window e.g. 00:05 and 00:10 respectively (below)
805+
NOTE: The keys are interpreted differently, the examples below
806+
describe what they are used for in a 'Mix' system
803807
'chartData': { '00:05': { 'pacToUser' -- Power from battery in kW
804808
'ppv' -- Solar generation in kW
805809
'sysOut' -- Load consumption in kW
@@ -812,25 +816,44 @@ def dashboard_data( # noqa: D417
812816
......
813817
}
814818
'chartDataUnit' -- Unit of measurement e.g. 'kW',
815-
'eAcCharge' -- Energy exported to the grid in kWh e.g. '20.5kWh' (not accurate for Mix systems)
816-
'eCharge' -- System production in kWh = Self-consumption + Exported to Grid e.g '23.1kWh' (not accurate for Mix systems - actually showing the total 'load consumption'
817-
'eChargeToday1' -- Self-consumption of PPV (possibly including excess diverted to batteries) in kWh e.g. '2.6kWh' (not accurate for Mix systems)
818-
'eChargeToday2' -- Total self-consumption (PPV consumption(eChargeToday2Echarge1) + Battery Consumption(echarge1)) e.g. '10.1kWh' (not accurate for Mix systems)
819-
'eChargeToday2Echarge1' -- Self-consumption of PPV only e.g. '0.8kWh' (not accurate for Mix systems)
819+
'eAcCharge' -- Energy exported to the grid in kWh e.g. '20.5kWh'
820+
(not accurate for Mix systems)
821+
'eCharge' -- System production in kWh = Self-consumption +
822+
Exported to Grid e.g '23.1kWh' (not accurate for Mix systems -
823+
actually showing the total 'load consumption'
824+
'eChargeToday1' -- Self-consumption of PPV (possibly including
825+
excess diverted to batteries) in kWh e.g. '2.6kWh'
826+
(not accurate for Mix systems)
827+
'eChargeToday2' -- Total self-consumption (PPV consumption
828+
(eChargeToday2Echarge1) + Battery Consumption(echarge1))
829+
e.g. '10.1kWh' (not accurate for Mix systems)
830+
'eChargeToday2Echarge1' -- Self-consumption of PPV only
831+
e.g. '0.8kWh' (not accurate for Mix systems)
820832
'echarge1' -- Self-consumption from Battery only e.g. '9.3kWh'
821-
'echargeToat' -- Not used on Dashboard view, likely to be total battery discharged e.g. '152.1kWh'
822-
'elocalLoad' -- Total load consumption (etouser + eChargeToday2) e.g. '20.3kWh', (not accurate for Mix systems)
823-
'etouser'-- Energy imported from grid today (includes both directly used by load and AC battery charging e.g. '10.2kWh'
824-
'keyNames' -- Keys to be used for the graph data e.g. ['Solar', 'Load Consumption', 'Export To Grid', 'From Battery']
833+
'echargeToat' -- Not used on Dashboard view, likely to be total
834+
battery discharged e.g. '152.1kWh'
835+
'elocalLoad' -- Total load consumption (etouser + eChargeToday2)
836+
e.g. '20.3kWh', (not accurate for Mix systems)
837+
'etouser'-- Energy imported from grid today (includes both
838+
directly used by load and AC battery charging e.g. '10.2kWh'
839+
'keyNames' -- Keys to be used for the graph data
840+
e.g. ['Solar', 'Load Consumption', 'Export To Grid', 'From Battery']
825841
'photovoltaic' -- Same as eChargeToday2Echarge1 e.g. '0.8kWh'
826-
'ratio1' -- % of 'Solar production' that is self-consumed e.g. '11.3%' (not accurate for Mix systems)
827-
'ratio2' -- % of 'Solar production' that is exported e.g. '88.7%' (not accurate for Mix systems)
828-
'ratio3' -- % of 'Load consumption' that is self consumption e.g. '49.8%' (not accurate for Mix systems)
829-
'ratio4' -- % of 'Load consumption' that is imported from the grid e.g '50.2%' (not accurate for Mix systems)
830-
'ratio5' -- % of Self consumption that is from batteries e.g. '92.1%' (not accurate for Mix systems)
831-
'ratio6' -- % of Self consumption that is directly from Solar e.g. '7.9%' (not accurate for Mix systems)
832-
833-
NOTE: Does not return any data for a tlx system. Use plant_energy_data() instead.
842+
'ratio1' -- % of 'Solar production' that is self-consumed
843+
e.g. '11.3%' (not accurate for Mix systems)
844+
'ratio2' -- % of 'Solar production' that is exported
845+
e.g. '88.7%' (not accurate for Mix systems)
846+
'ratio3' -- % of 'Load consumption' that is self consumption
847+
e.g. '49.8%' (not accurate for Mix systems)
848+
'ratio4' -- % of 'Load consumption' that is imported from the grid
849+
e.g '50.2%' (not accurate for Mix systems)
850+
'ratio5' -- % of Self consumption that is from batteries
851+
e.g. '92.1%' (not accurate for Mix systems)
852+
'ratio6' -- % of Self consumption that is directly from Solar
853+
e.g. '7.9%' (not accurate for Mix systems)
854+
855+
NOTE: Does not return any data for a tlx system.
856+
Use plant_energy_data() instead.
834857
835858
"""
836859
date_str = self.__get_date_string(timespan, date)
@@ -893,9 +916,10 @@ def storage_energy_overview(self, plant_id: str, storage_id: str) -> dict:
893916
return response.json().get("obj", {})
894917

895918
def inverter_list(self, plant_id: str) -> list:
896-
"""Use device_list, it's more descriptive since the list contains more than inverters."""
919+
"""Use device_list, more descriptive than inverter_list."""
897920
warnings.warn(
898-
"This function may be deprecated in the future because naming is not correct, use device_list instead",
921+
"This function may be deprecated in the future because naming "
922+
"is not correct, use device_list instead",
899923
DeprecationWarning,
900924
stacklevel=2,
901925
)
@@ -915,7 +939,8 @@ def device_list(self, plant_id: str) -> list:
915939
device_list = self.plant_info(plant_id).get("deviceList", [])
916940

917941
if not device_list:
918-
# for tlx systems, the device_list in plant is empty, so use __get_all_devices() instead
942+
# for tlx systems, the device_list in plant is empty,
943+
# so use __get_all_devices() instead
919944
device_list = self.__get_all_devices(plant_id)
920945

921946
return device_list
@@ -946,7 +971,7 @@ def plant_energy_data(self, plant_id: str) -> dict:
946971

947972
def is_plant_noah_system(self, plant_id: str) -> dict: # noqa: D417
948973
"""
949-
Return a dictionary containing if noah devices are configured for the specified plant.
974+
Return dict with noah device configuration for specified plant.
950975
951976
Keyword Arguments:
952977
plant_id -- The id of the plant you want the noah devices of (str)
@@ -955,9 +980,11 @@ def is_plant_noah_system(self, plant_id: str) -> dict: # noqa: D417
955980
'msg'
956981
'result' -- True or False
957982
'obj' -- An Object containing if noah devices are configured
958-
'isPlantNoahSystem' -- Is the specified plant a noah system (True or False)
983+
'isPlantNoahSystem' -- Is the specified plant a noah system
984+
(True or False)
959985
'plantId' -- The ID of the plant
960-
'isPlantHaveNoah' -- Are noah devices configured in the specified plant (True or False)
986+
'isPlantHaveNoah' -- Are noah devices configured in the
987+
specified plant (True or False)
961988
'deviceSn' -- Serial number of the configured noah device
962989
'plantName' -- Friendly name of the plant
963990
@@ -981,7 +1008,8 @@ def noah_system_status(self, serial_number: str) -> dict: # noqa: D417
9811008
'result' -- True or False
9821009
'obj' -- An Object containing the noah device status
9831010
'chargePower' -- Battery charging rate in watt e.g. '200Watt'
984-
'workMode' -- Workingmode of the battery (0 = Load First, 1 = Battery First)
1011+
'workMode' -- Workingmode of the battery
1012+
(0 = Load First, 1 = Battery First)
9851013
'soc' -- Statement of charge (remaining battery %)
9861014
'associatedInvSn' -- ???
9871015
'batteryNum' -- Numbers of batterys
@@ -1017,29 +1045,39 @@ def noah_info(self, serial_number: str) -> dict: # noqa: D417
10171045
'result' -- True or False
10181046
'obj' -- An Object containing the noah device informations
10191047
'neoList' -- A List containing Objects
1020-
'unitList' -- A Object containing currency units e.g. "Euro": "euro", "DOLLAR": "dollar"
1048+
'unitList' -- A Object containing currency units
1049+
e.g. "Euro": "euro", "DOLLAR": "dollar"
10211050
'noah' -- A Object containing the folowing
1022-
'time_segment' -- A List containing Objects with configured "Operation Mode"
1023-
NOTE: The keys are generated numerical, the values are generated with folowing syntax "[workingmode (0 = Load First, 1 = Battery First)]_[starttime]_[endtime]_[output power]"
1051+
'time_segment' -- A List containing Objects with
1052+
configured "Operation Mode"
1053+
NOTE: The keys are generated numerical, the values are
1054+
generated with syntax "[workingmode (0 = Load First,
1055+
1 = Battery First)]_[starttime]_[endtime]_[output power]"
10241056
'time_segment': {
1025-
'time_segment1': "0_0:0_8:0_150", ([Load First]_[00:00]_[08:00]_[150 watt])
1026-
'time_segment2': "1_8:0_18:0_0", ([Battery First]_[08:00]_[18:00]_[0 watt])
1057+
'time_segment1': "0_0:0_8:0_150",
1058+
([Load First]_[00:00]_[08:00]_[150 watt])
1059+
'time_segment2': "1_8:0_18:0_0",
1060+
([Battery First]_[08:00]_[18:00]_[0 watt])
10271061
....
10281062
}
10291063
'batSns' -- A List containing all battery Serial Numbers
10301064
'associatedInvSn' -- ???
10311065
'plantId' -- The ID of the plant
1032-
'chargingSocHighLimit' -- Configured "Battery Management" charging upper limit
1033-
'chargingSocLowLimit' -- Configured "Battery Management" charging lower limit
1066+
'chargingSocHighLimit' -- Configured "Battery Management"
1067+
charging upper limit
1068+
'chargingSocLowLimit' -- Configured "Battery Management"
1069+
charging lower limit
10341070
'defaultPower' -- Configured "System Default Output Power"
10351071
'version' -- The Firmware Version of the noah device
10361072
'deviceSn' -- The Serial number of the noah device
1037-
'formulaMoney' -- Configured "Select Currency" energy cost per kWh e.g. '0.22'
1073+
'formulaMoney' -- Configured "Select Currency" energy cost
1074+
per kWh e.g. '0.22'
10381075
'alias' -- Friendly name of the noah device
10391076
'model' -- Model Name of the noah device
10401077
'plantName' -- Friendly name of the plant
10411078
'tempType' -- ???
1042-
'moneyUnitText' -- Configured "Select Currency" (Value from the unitList) e.G. "euro"
1079+
'moneyUnitText' -- Configured "Select Currency"
1080+
(Value from the unitList) e.G. "euro"
10431081
'plantList' -- A List containing Objects containing the folowing
10441082
'plantId' -- The ID of the plant
10451083
'plantImgName' -- Friendly name of the plant Image
@@ -1072,14 +1110,18 @@ def update_plant_settings( # noqa: D417
10721110
if None - fetched for you
10731111
10741112
Returns:
1075-
A response from the server stating whether the configuration was successful or not
1113+
A response from the server stating whether the configuration was
1114+
successful or not
10761115
10771116
"""
1078-
# If no existing settings have been provided then get them from the growatt server
1117+
# If no existing settings have been provided then get them from
1118+
# the growatt server
10791119
if current_settings is None:
10801120
current_settings = self.plant_settings(plant_id)
10811121

1082-
# These are the parameters that the form requires, without these an error is thrown. Pre-populate their values with the current values
1122+
# These are the parameters that the form requires, without these
1123+
# an error is thrown. Pre-populate their values with the current
1124+
# values
10831125
form_settings = {
10841126
"plantCoal": (None, str(current_settings["formulaCoal"])),
10851127
"plantSo2": (None, str(current_settings["formulaSo2"])),

0 commit comments

Comments
 (0)