diff --git a/README.md b/README.md index 6886ae7..046f9f6 100755 --- a/README.md +++ b/README.md @@ -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 diff --git a/growattServer/__init__.py b/growattServer/__init__.py index 5983644..c682921 100755 --- a/growattServer/__init__.py +++ b/growattServer/__init__.py @@ -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): + + """ + 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} + response = self.session.get(self.get_url('newMixApi.do'), params=default_params) + data = json.loads(response.content.decode('utf-8')) + return data