Skip to content

Commit

Permalink
Merge pull request #18 from nergal/develop
Browse files Browse the repository at this point in the history
Fix issue #17 related to update of python-miio paths
  • Loading branch information
nergal authored Jan 10, 2022
2 parents 648634e + d928f63 commit 8c2d05d
Show file tree
Hide file tree
Showing 8 changed files with 1,050 additions and 692 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.mypy_cache/
.pytest_cache/
.vscode/
__pycache__/
.idea/
*.tmp
*.log
7 changes: 5 additions & 2 deletions custom_components/xiaomi_viomi/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
from homeassistant.data_entry_flow import FlowResult
from homeassistant.exceptions import ConfigEntryAuthFailed, HomeAssistantError
from homeassistant.helpers.device_registry import format_mac
from miio import DeviceException, ViomiVacuum
from miio import DeviceException
from miio.device import DeviceInfo
from miio.integrations.vacuum.viomi.viomivacuum import ViomiVacuum

from .const import CONF_MAC, CONF_MODEL, DOMAIN

Expand Down Expand Up @@ -53,6 +54,9 @@ async def async_device_is_connectable(self, host: str, token: str) -> bool:
self._device_info = await self._hass.async_add_executor_job(
self._device.info
)

if self._device_info:
_LOGGER.debug("%s detected", self._device_info.model)
except DeviceException as error:
if isinstance(error.__cause__, ChecksumError):
raise ConfigEntryAuthFailed(error) from error
Expand All @@ -63,7 +67,6 @@ async def async_device_is_connectable(self, host: str, token: str) -> bool:
)
return False

_LOGGER.debug("%s detected", self._device_info.model)
return True


Expand Down
4 changes: 2 additions & 2 deletions custom_components/xiaomi_viomi/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "Xiaomi Viomi Vaccum",
"requirements": [
"construct==2.10.67",
"python-miio==0.5.6"
"python-miio==0.5.9"
],
"version": "0.0.2"
"version": "0.0.3"
}
21 changes: 6 additions & 15 deletions custom_components/xiaomi_viomi/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
from homeassistant.components.xiaomi_miio.device import XiaomiMiioEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_TOKEN, STATE_OFF, STATE_ON
from homeassistant.util.dt import as_utc
from miio import DeviceException, ViomiVacuum
from miio.viomivacuum import ViomiVacuumSpeed, ViomiVacuumStatus
from miio import DeviceException
from miio.integrations.vacuum.viomi.viomivacuum import (
ViomiVacuum,
ViomiVacuumSpeed,
ViomiVacuumStatus,
)

from .const import DEVICE_PROPERTIES

Expand Down Expand Up @@ -153,18 +156,6 @@ def fan_speed_list(self):
"""Get the list of available fan speed steps of the vacuum cleaner."""
return list(self._fan_speeds) if self._fan_speeds else []

@property
def timers(self):
"""Get the list of added timers of the vacuum cleaner."""
return [
{
"enabled": timer.enabled,
"cron": timer.cron,
"next_schedule": as_utc(timer.next_schedule),
}
for timer in self._timers
]

@property
def extra_state_attributes(self):
"""Return the specific state attributes of this vacuum cleaner."""
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Xiaomi Viomi Vaccum",
"domains": ["vacuum"],
"homeassistant": "2021.6.6",
"homeassistant": "2021.12.8",
"render_readme": true
}
Loading

0 comments on commit 8c2d05d

Please sign in to comment.