Skip to content

Commit

Permalink
Merge pull request #73 from erikkastelec/dev
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
erikkastelec authored May 10, 2023
2 parents 50e040c + 923acfe commit 4d3c89b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions custom_components/wemportal/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ async def _async_update_data(self):
self.config_entry.data.get(CONF_PASSWORD),
self.config_entry.options,
)
del self.api
self.api = new_api
except Exception as exc2:
raise UpdateFailed from exc2
Expand Down
5 changes: 3 additions & 2 deletions custom_components/wemportal/wemportalapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ def api_login(self):
"AppVersion": "2.0.2",
"ClientOS": "Android",
}
if self.session is not None:
self.session.close()
self.session = reqs.Session()
self.session.cookies.clear()
self.session.headers.update(self.headers)
Expand Down Expand Up @@ -348,8 +350,7 @@ def change_value(
):
"""POST request to API to change a specific value"""
_LOGGER.debug("Changing value for %s", parameter_id)
# Encode into UTF-8
parameter_id = parameter_id.encode('utf-8')

data = {
"DeviceID": device_id,
"Modules": [
Expand Down

0 comments on commit 4d3c89b

Please sign in to comment.