|
2 | 2 |
|
3 | 3 | import datetime |
4 | 4 | import hashlib |
| 5 | +import json |
5 | 6 | import warnings |
6 | 7 | from enum import IntEnum |
7 | 8 | from random import randint |
@@ -774,22 +775,24 @@ def mix_detail( # noqa: D417 |
774 | 775 |
|
775 | 776 | return response.json().get("obj", {}) |
776 | 777 |
|
777 | | - def get_mix_inverter_settings(self, serial_number): |
| 778 | + def get_mix_inverter_settings(self, serial_number: str) -> dict: |
778 | 779 | """ |
779 | | - Gets the inverter settings related to battery modes |
780 | | - Keyword arguments: |
781 | | - serial_number -- The serial number (device_sn) of the inverter |
| 780 | + Get the inverter settings related to battery modes. |
| 781 | +
|
| 782 | + Args: |
| 783 | + serial_number: The serial number (device_sn) of the inverter |
| 784 | +
|
782 | 785 | Returns: |
783 | | - A dictionary of settings |
| 786 | + A dictionary of settings |
| 787 | +
|
784 | 788 | """ |
785 | 789 | default_params = { |
786 | 790 | "op": "getMixSetParams", |
787 | 791 | "serialNum": serial_number, |
788 | 792 | "kind": 0, |
789 | 793 | } |
790 | 794 | response = self.session.get(self.get_url("newMixApi.do"), params=default_params) |
791 | | - data = json.loads(response.content.decode("utf-8")) |
792 | | - return data |
| 795 | + return json.loads(response.content.decode("utf-8")) |
793 | 796 |
|
794 | 797 | def dashboard_data( # noqa: D417 |
795 | 798 | self, |
@@ -1387,18 +1390,21 @@ def update_noah_settings( # noqa: D417 |
1387 | 1390 |
|
1388 | 1391 | return response.json() |
1389 | 1392 |
|
1390 | | - def update_classic_inverter_setting(self, default_parameters, parameters): |
| 1393 | + def update_classic_inverter_setting( # noqa: D417 |
| 1394 | + self, default_parameters: dict, parameters: dict | list |
| 1395 | + ) -> dict: |
1391 | 1396 | """ |
1392 | | - Applies settings for specified system based on serial number |
1393 | | - See README for known working settings |
| 1397 | + Apply settings for specified system based on serial number. |
| 1398 | +
|
| 1399 | + See README for known working settings. |
1394 | 1400 |
|
1395 | 1401 | Arguments: |
1396 | | - default_params -- Default set of parameters for the setting call (dict) |
1397 | | - parameters -- Parameters to be sent to the system (dict or list of str) |
1398 | | - (array which will be converted to a dictionary) |
| 1402 | + default_params -- Default set of parameters for the setting call (dict) |
| 1403 | + parameters -- Parameters to be sent to the system (dict or list of str) |
| 1404 | + (array which will be converted to a dictionary) |
1399 | 1405 |
|
1400 | 1406 | Returns: |
1401 | | - JSON response from the server whether the configuration was successful |
| 1407 | + JSON response from the server whether the configuration was successful |
1402 | 1408 |
|
1403 | 1409 | """ |
1404 | 1410 | settings_parameters = parameters |
|
0 commit comments