Skip to content

Commit 9654460

Browse files
committed
fixed ruff issues
1 parent a92367f commit 9654460

1 file changed

Lines changed: 2 additions & 76 deletions

File tree

examples/v1_write_example.py

Lines changed: 2 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -42,80 +42,6 @@ def demonstrate_sph_mix_parameters(
4242
)
4343
print(f"AC charge time period result: {result}") # noqa: T201
4444

45-
# # 2. AC Discharge Time Period
46-
# print("Setting AC discharge time period...")
47-
# discharge_params = api.MixAcDischargeTimeParams(
48-
# discharge_power=60, # 60% discharge power
49-
# discharge_stop_soc=20, # Stop at 20% SOC
50-
# start_hour=16, # Start at 16:00
51-
# start_minute=0,
52-
# end_hour=22, # End at 22:00
53-
# end_minute=0,
54-
# enabled=True
55-
# )
56-
# result = api.write_parameter(
57-
# device_sn=device_sn,
58-
# device_type=growattServer.DeviceType.SPH_MIX,
59-
# command="mix_ac_discharge_time_period",
60-
# params=discharge_params
61-
# )
62-
# print(f"AC discharge time period result: {result}")
63-
64-
# # 3. Backflow Setting
65-
# print("Setting backflow prevention...")
66-
# backflow_params = api.BackflowSettingParams(
67-
# backflow_enabled=True,
68-
# anti_reverse_power_percentage=50 # 50% anti-reverse flow
69-
# )
70-
# result = api.write_parameter(
71-
# device_sn=device_sn,
72-
# device_type=growattServer.DeviceType.SPH_MIX,
73-
# command="backflow_setting",
74-
# params=backflow_params
75-
# )
76-
# print(f"Backflow setting result: {result}")
77-
78-
# # 4. PV On/Off Control
79-
# print("Turning PV on...")
80-
# pv_params = api.PvOnOffParams(pv_enabled=True)
81-
# result = api.write_parameter(
82-
# device_sn=device_sn,
83-
# device_type=growattServer.DeviceType.SPH_MIX,
84-
# command="pv_on_off",
85-
# params=pv_params
86-
# )
87-
# print(f"PV on/off result: {result}")
88-
89-
# # 5. Grid Voltage Limits
90-
# print("Setting grid voltage limits...")
91-
# voltage_params = api.GridVoltageParams(
92-
# voltage_high=270, # Upper limit
93-
# voltage_low=180 # Lower limit
94-
# )
95-
# # Note: These would be separate commands for high and low voltage
96-
# result_high = api.write_parameter(
97-
# device_sn=device_sn,
98-
# device_type=growattServer.DeviceType.SPH_MIX,
99-
# command="pv_grid_voltage_high",
100-
# params=voltage_params
101-
# )
102-
# print(f"Grid voltage high result: {result_high}")
103-
104-
# # 6. Off-grid Settings
105-
# print("Setting off-grid parameters...")
106-
# offgrid_params = api.OffGridParams(
107-
# off_grid_enabled=True,
108-
# frequency=0, # 50Hz
109-
# voltage=0 # 230V
110-
# )
111-
# result = api.write_parameter(
112-
# device_sn=device_sn,
113-
# device_type=growattServer.DeviceType.SPH_MIX,
114-
# command="mix_off_grid_enable",
115-
# params=offgrid_params
116-
# )
117-
# print(f"Off-grid enable result: {result}")
118-
11945
except Exception as e: # noqa: BLE001
12046
print(f"Error with SPH_MIX parameters: {e}") # noqa: T201
12147

@@ -216,15 +142,15 @@ def demonstrate_min_tlx_parameters(
216142
print(f"Error with MIN_TLX parameters: {e}") # noqa: T201
217143

218144

219-
def main() -> None:
145+
def main() -> None: # noqa: PLR0912
220146
"""Run the main demonstration for V1 API parameter writing."""
221147
# Get the API token from user input or environment variable
222148
api_token = os.environ.get("GROWATT_API_TOKEN") or input(
223149
"Enter your Growatt API token: "
224150
)
225151

226152
# Test token from official API docs (for testing only)
227-
# api_token = "6eb6f069523055a339d71e5b1f6c88cc" # gitleaks:allow
153+
# api_token = "6eb6f069523055a339d71e5b1f6c88cc" # gitleaks:allow # noqa: ERA001
228154

229155
try:
230156
# Initialize the API with token

0 commit comments

Comments
 (0)