Skip to content

Commit

Permalink
include raw data for all devices when downloading diagnostics for the…
Browse files Browse the repository at this point in the history
… config entry (#59)
  • Loading branch information
zlangbert authored Jan 11, 2025
1 parent 59baecd commit 80fe600
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
13 changes: 6 additions & 7 deletions custom_components/daikinone/daikinone.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,13 @@ class _AuthState:
def __init__(self, creds: DaikinUserCredentials):
self.creds = creds

async def get_raw_device_data(self, device_id: str) -> dict[str, Any] | None:
async def get_all_raw_device_data(self) -> list[dict[str, Any]]:
"""Get raw device data"""
try:
return await self.__req(f"{DAIKIN_API_URL_DEVICE_DATA}/{device_id}")
except DaikinServiceException as e:
if e.status == 400 or e.status == 404:
return None
raise
return await self.__req(DAIKIN_API_URL_DEVICE_DATA)

async def get_raw_device_data(self, device_id: str) -> dict[str, Any]:
"""Get raw device data"""
return await self.__req(f"{DAIKIN_API_URL_DEVICE_DATA}/{device_id}")

async def update(self) -> None:
await self.__refresh_thermostats()
Expand Down
10 changes: 5 additions & 5 deletions custom_components/daikinone/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@


async def async_get_config_entry_diagnostics(hass: HomeAssistant, entry: ConfigEntry) -> dict[str, Any]:
return {}
data: DaikinOneData = hass.data[DOMAIN]
raw = await data.daikin.get_all_raw_device_data()

return {"raw": raw}


async def async_get_device_diagnostics(
Expand All @@ -21,7 +24,4 @@ async def async_get_device_diagnostics(
device_id = next(i for i in device.identifiers if i[0] == DOMAIN)[1]
raw = await data.daikin.get_raw_device_data(device_id)

if raw is not None:
return {"synthetic": False, "raw": raw}
else:
return {"synthetic": True}
return {"raw": raw}

0 comments on commit 80fe600

Please sign in to comment.