Skip to content

Commit

Permalink
iron out further small bugs, issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mikey0000 committed Aug 27, 2024
1 parent 6ea72da commit 8cd6936
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 0 additions & 2 deletions custom_components/mammotion/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ async def async_step_wifi(self, user_input: dict[str, Any]) -> ConfigFlowResult:
if device_name is not None:
await self.async_set_unique_id(device_name, raise_on_progress=False)
self._abort_if_unique_id_configured()
else:
return self.async_abort(reason="no_device_name")

try:
await connect_http(account, password)
Expand Down
22 changes: 12 additions & 10 deletions custom_components/mammotion/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
class MammotionDataUpdateCoordinator(DataUpdateCoordinator[MowingDevice]):
"""Class to manage fetching mammotion data."""

address: str
address: str | None = None
config_entry: MammotionConfigEntry
device_name: str
device_name: str = ""
manager: Mammotion | None = None

def __init__(
Expand Down Expand Up @@ -158,16 +158,18 @@ async def async_send_command(self, command: str, **kwargs: any) -> None:
async def _async_update_data(self) -> MowingDevice:
"""Get data from the device."""
device = self.manager.get_device_by_name(self.device_name)
ble_device = bluetooth.async_ble_device_from_address(self.hass, self.address)

if not ble_device and device.cloud() is None:
self.update_failures += 1
raise UpdateFailed("Could not find device")
if self.address:
ble_device = bluetooth.async_ble_device_from_address(self.hass, self.address)

if ble_device and device.ble() is not None:
device.ble().update_device(ble_device)
else:
device.add_ble(ble_device)
if not ble_device and device.cloud() is None:
self.update_failures += 1
raise UpdateFailed("Could not find device")

if ble_device and device.ble() is not None:
device.ble().update_device(ble_device)
else:
device.add_ble(ble_device)

try:
if (
Expand Down

0 comments on commit 8cd6936

Please sign in to comment.