daybetter-services-python 1.0.1__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {daybetter_services_python-1.0.1/daybetter_services_python.egg-info → daybetter_services_python-1.0.3}/PKG-INFO +1 -1
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/daybetter_python/__init__.py +1 -1
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/daybetter_python/client.py +33 -0
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3/daybetter_services_python.egg-info}/PKG-INFO +1 -1
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/pyproject.toml +1 -1
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/setup.py +1 -1
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/LICENSE +0 -0
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/README.md +0 -0
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/daybetter_python/exceptions.py +0 -0
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/daybetter_services_python.egg-info/SOURCES.txt +0 -0
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/daybetter_services_python.egg-info/dependency_links.txt +0 -0
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/daybetter_services_python.egg-info/requires.txt +0 -0
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/daybetter_services_python.egg-info/top_level.txt +0 -0
- {daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/setup.cfg +0 -0
{daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/daybetter_python/client.py
RENAMED
|
@@ -292,6 +292,39 @@ class DayBetterClient:
|
|
|
292
292
|
_LOGGER.exception("Exception while fetching device statuses: %s", e)
|
|
293
293
|
raise DayBetterError(f"Unexpected error: {e}")
|
|
294
294
|
|
|
295
|
+
async def integrate(self, hass_code: str) -> Dict[str, Any]:
|
|
296
|
+
"""Integrate with Home Assistant using hassCode.
|
|
297
|
+
|
|
298
|
+
Args:
|
|
299
|
+
hass_code: Home Assistant integration code from APP
|
|
300
|
+
|
|
301
|
+
Returns:
|
|
302
|
+
Integration result dictionary
|
|
303
|
+
|
|
304
|
+
Raises:
|
|
305
|
+
APIError: If API request fails
|
|
306
|
+
"""
|
|
307
|
+
try:
|
|
308
|
+
session = self._get_session()
|
|
309
|
+
url = f"{self.base_url}hass/integrate"
|
|
310
|
+
payload = {"hassCode": hass_code}
|
|
311
|
+
|
|
312
|
+
async with session.post(url, json=payload) as resp:
|
|
313
|
+
if resp.status == 200:
|
|
314
|
+
data = await resp.json()
|
|
315
|
+
_LOGGER.debug("Integration successful: %s", data)
|
|
316
|
+
return data
|
|
317
|
+
else:
|
|
318
|
+
error_text = await resp.text()
|
|
319
|
+
_LOGGER.error("Failed to integrate: %s", error_text)
|
|
320
|
+
raise APIError(f"API error {resp.status}: {error_text}")
|
|
321
|
+
except aiohttp.ClientError as e:
|
|
322
|
+
_LOGGER.exception("Client error while integrating: %s", e)
|
|
323
|
+
raise APIError(f"Client error: {e}")
|
|
324
|
+
except Exception as e:
|
|
325
|
+
_LOGGER.exception("Exception while integrating: %s", e)
|
|
326
|
+
raise DayBetterError(f"Unexpected error: {e}")
|
|
327
|
+
|
|
295
328
|
@property
|
|
296
329
|
def is_authenticated(self) -> bool:
|
|
297
330
|
"""Check if the API client is authenticated."""
|
|
File without changes
|
|
File without changes
|
{daybetter_services_python-1.0.1 → daybetter_services_python-1.0.3}/daybetter_python/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|