Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #448 from Thomas55555/fix-missing-coordinator-impl…
Browse files Browse the repository at this point in the history
…ementation

fix missing coordinator implementation
  • Loading branch information
Thomas55555 authored May 12, 2023
2 parents 24fc160 + dfd818c commit 05fe637
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion custom_components/husqvarna_automower/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,6 @@ async def aysnc_send_command_to_mower(
}
payload = json.dumps(string)
try:
await self.session.action(self.mower_id, payload, command_type)
await self.coordinator.session.action(self.mower_id, payload, command_type)
except ClientResponseError as exception:
_LOGGER.error("Command couldn't be sent to the command que: %s", exception)
4 changes: 1 addition & 3 deletions custom_components/husqvarna_automower/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def __init__(self, session, idx, entry) -> None:
self._image_bytes = None
self._image_to_bytes()

self.session = session

if self.entry.options.get(ENABLE_CAMERA, False):
self.top_left_coord = self.entry.options.get(GPS_TOP_LEFT)
self.bottom_right_coord = self.entry.options.get(GPS_BOTTOM_RIGHT)
Expand Down Expand Up @@ -97,7 +95,7 @@ def model(self) -> str:
async def async_camera_image(
self, width: Optional[int] = None, height: Optional[int] = None
) -> Optional[bytes]:
"""Return the caerma image."""
"""Return the camera image."""
return self._image_bytes

def _image_to_bytes(self):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/husqvarna_automower/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ async def async_get_config_entry_diagnostics(
hass: HomeAssistant, entry: ConfigEntry
) -> dict:
"""Return diagnostics of the config entry and mower data."""
session = hass.data[DOMAIN][entry.entry_id].data["data"]
coordinator = hass.data[DOMAIN][entry.entry_id]
diag_data = {
"config_entry": async_redact_data(entry.as_dict(), TO_REDACT),
"data_of_all_mowers": async_redact_data(session, TO_REDACT),
"data_of_all_mowers": async_redact_data(coordinator.data["data"], TO_REDACT),
}

return diag_data
2 changes: 1 addition & 1 deletion custom_components/husqvarna_automower/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ async def async_set_native_value(self, value: float) -> None:
}
payload = json.dumps(string)
try:
await self.session.action(self.mower_id, payload, command_type)
await self.coordinator.session.action(self.mower_id, payload, command_type)
except ClientResponseError as exception:
_LOGGER.error("Command couldn't be sent to the command que: %s", exception)

0 comments on commit 05fe637

Please sign in to comment.