WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 56418b7

Browse files
authored
Merge pull request #135 from zweckj/public_methods
Add properties to check availability of Bluetooth and cloud clients, …
2 parents cd296c5 + c982f68 commit 56418b7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pylamarzocco/devices/_thing.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,29 @@ def websocket(self) -> WebSocketDetails:
9696
return WebSocketDetails()
9797
return self._cloud_client.websocket
9898

99+
@property
100+
def bluetooth_client_available(self) -> bool:
101+
"""Return the availability of the bluetooth connection."""
102+
return self._bluetooth_client is not None
103+
104+
@property
105+
def cloud_client_available(self) -> bool:
106+
"""Return the availability of the cloud connection."""
107+
return self._cloud_client is not None
108+
99109
@property
100110
def bluetooth_connected(self) -> bool:
101111
"""Return the status of the bluetooth connection."""
102112
return (
103113
self._bluetooth_client is not None and self._bluetooth_client.is_connected
104114
)
105115

116+
@cloud_only
117+
async def ensure_token_valid(self) -> None:
118+
"""Ensure the cloud token is valid."""
119+
assert self._cloud_client
120+
await self._cloud_client.async_get_access_token()
121+
106122
@cloud_only
107123
async def get_dashboard(self) -> None:
108124
"""Get the dashboard for a thing."""

0 commit comments

Comments
 (0)