Skip to content

Commit

Permalink
webserver: add update_data function
Browse files Browse the repository at this point in the history
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
  • Loading branch information
Noltari committed Nov 13, 2024
1 parent 6e516c5 commit c5459d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aioairzone/localapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 289,10 @@ def update_systems(self, data: dict[str, Any] | None) -> None:

def update_webserver(self, data: dict[str, Any]) -> None:
"""Gather WebServer data."""
self.webserver = WebServer(data)
if self.webserver is not None:
self.webserver.update_data(data)
else:
self.webserver = WebServer(data)

def check_dhw(self, dhw: dict[str, Any]) -> bool:
"""Check Airzone Domestic Hot Water validity."""
Expand Down
3 changes: 3 additions & 0 deletions aioairzone/webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 39,10 @@ def __init__(self, data: dict[str, Any]):
self.wifi_channel: int | None = None
self.wifi_quality: int | None = None
self.wifi_rssi: int | None = None
self.update_data(data)

def update_data(self, data: dict[str, Any]) -> None:
"""Update WebServer data."""
if API_INTERFACE in data:
if data[API_INTERFACE] == API_WIFI:
self.interface = WebServerInterface.WIFI
Expand Down

0 comments on commit c5459d9

Please sign in to comment.