Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added get_mix_inverter_settings to retrive data #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Any methods that may be useful.

`api.get_plant_settings(plant_id)` Get the current settings for the specified plant

`api.get_mix_inverter_settings(serial_number)` Get the current inverter settings for the specified serial number including charge/discharge schedule for hybrid systems.

`api.update_plant_settings(plant_id, changed_settings, current_settings)` Update the settings for a plant to the values specified in the dictionary, if the `current_settings` are not provided it will look them up automatically using the `get_plant_settings` function - See 'Plant settings' below for more information

`api.update_mix_inverter_setting(serial_number, setting_type, parameters)` Applies the provided parameters (dictionary or array) for the specified setting on the specified mix inverter; see 'Inverter settings' below for more information
Expand Down
20 changes: 20 additions & 0 deletions growattServer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,3 +669,23 @@ def update_ac_inverter_setting(self, serial_number, setting_type, parameters):
}
return self.update_inverter_setting(serial_number, setting_type,
default_parameters, parameters)

def get_mix_inverter_settings(self, serial_number):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indenting looks off, so a sanity check. Isn't this the right indenting?

Suggested change
def get_mix_inverter_settings(self, serial_number):
def get_mix_inverter_settings(self, serial_number):


"""
Gets the inverter settings related to battery modes
Keyword arguments:
serial_number -- The serial number (device_sn) of the inverter
Returns:
A dictionary of settings
"""

default_params = {
'op': 'getMixSetParams',
'serialNum': serial_number,
'kind': 0
}
settings_params = {**default_params}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is not used, probably a leftover

Suggested change
settings_params = {**default_params}

response = self.session.get(self.get_url('newMixApi.do'), params=default_params)
data = json.loads(response.content.decode('utf-8'))
return data