Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal4K committed Aug 20, 2024
1 parent f6fa796 commit 9370325
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions homeassistant/components/switchbot/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
from .const import (
CONF_ENCRYPTION_KEY,
CONF_KEY_ID,
CONF_RETRY_COUNT,
CONF_LOCK_NIGHTLATCH,
CONF_RETRY_COUNT,
CONNECTABLE_SUPPORTED_MODEL_TYPES,
DEFAULT_RETRY_COUNT,
DEFAULT_LOCK_NIGHTLATCH,
DEFAULT_RETRY_COUNT,
DOMAIN,
NON_CONNECTABLE_SUPPORTED_MODEL_TYPES,
SUPPORTED_LOCK_MODELS,
Expand Down Expand Up @@ -369,7 +369,7 @@ async def async_step_init(
default=self.config_entry.options.get(
CONF_LOCK_NIGHTLATCH, DEFAULT_LOCK_NIGHTLATCH
),
): bool
): bool,
}

return self.async_show_form(step_id="init", data_schema=vol.Schema(options))
12 changes: 5 additions & 7 deletions homeassistant/components/switchbot/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import CONF_LOCK_NIGHTLATCH, DEFAULT_LOCK_NIGHTLATCH

Check warning on line 12 in homeassistant/components/switchbot/lock.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/switchbot/lock.py#L12

Added line #L12 was not covered by tests
from .coordinator import SwitchbotConfigEntry, SwitchbotDataUpdateCoordinator
from .entity import SwitchbotEntity

from .const import (
CONF_LOCK_NIGHTLATCH,
DEFAULT_LOCK_NIGHTLATCH,
)


async def async_setup_entry(
hass: HomeAssistant,
Expand All @@ -36,7 +32,9 @@ class SwitchBotLock(SwitchbotEntity, LockEntity):
_attr_name = None
_device: switchbot.SwitchbotLock

def __init__(self, coordinator: SwitchbotDataUpdateCoordinator, force_nightlatch) -> None:
def __init__(

Check warning on line 35 in homeassistant/components/switchbot/lock.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/switchbot/lock.py#L35

Added line #L35 was not covered by tests
self, coordinator: SwitchbotDataUpdateCoordinator, force_nightlatch
) -> None:
"""Initialize the entity."""
super().__init__(coordinator)
self._async_update_attrs()
Expand All @@ -61,7 +59,7 @@ async def async_lock(self, **kwargs: Any) -> None:

async def async_unlock(self, **kwargs: Any) -> None:
"""Unlock the lock."""
if self._attr_supported_features & (LockEntityFeature.OPEN):
if self._attr_supported_features & (LockEntityFeature.OPEN):

Check warning on line 62 in homeassistant/components/switchbot/lock.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/switchbot/lock.py#L62

Added line #L62 was not covered by tests
self._last_run_success = await self._device.unlock_without_unlatch()
else:
self._last_run_success = await self._device.unlock()
Expand Down

0 comments on commit 9370325

Please sign in to comment.