Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small refactor to fix some lint errors #571

Merged
merged 5 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions custom_components/hilo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Support for Hilo automation systems."""

from __future__ import annotations

import asyncio
Expand Down Expand Up @@ -240,7 +241,8 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry, api: API) -> None:
CONF_APPRECIATION_PHASE, DEFAULT_APPRECIATION_PHASE
)
self.pre_cold = entry.options.get(
CONF_PRE_COLD_PHASE, DEFAULT_PRE_COLD_PHASE # this is new
CONF_PRE_COLD_PHASE,
DEFAULT_PRE_COLD_PHASE,
)
self.challenge_lock = entry.options.get(
CONF_CHALLENGE_LOCK, DEFAULT_CHALLENGE_LOCK
Expand Down Expand Up @@ -774,7 +776,7 @@ def __init__(
hilo: Hilo,
name: Union[str, None] = None,
*,
device: HiloDevice | None = None,
device: HiloDevice,
) -> None:
"""Initialize."""
assert hilo.coordinator
Expand Down
3 changes: 2 additions & 1 deletion custom_components/hilo/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util import slugify
from pyhilo.device.switch import Switch

from . import Hilo, HiloEntity
from .const import DOMAIN, LOG, SWITCH_CLASSES
Expand All @@ -23,7 +24,7 @@ async def async_setup_entry(


class HiloSwitch(HiloEntity, SwitchEntity):
def __init__(self, hilo: Hilo, device):
def __init__(self, hilo: Hilo, device: Switch):
super().__init__(hilo, device=device, name=device.name)
old_unique_id = f"{slugify(device.name)}-switch"
self._attr_unique_id = f"{slugify(device.identifier)}-switch"
Expand Down