Skip to content

Commit

Permalink
Minor config / type updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
eseglem committed Nov 11, 2023
1 parent 679058a commit 4587d68
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions custom_components/wattbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.typing import ConfigType
from pywattbox.base import BaseWattBox

from .const import (
BINARY_SENSOR_TYPES,
Expand Down Expand Up @@ -88,6 +89,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
username = wattbox_host.get(CONF_USERNAME)
name = wattbox_host.get(CONF_NAME)

wattbox: BaseWattBox
if port in (22, 23):
_LOGGER.debug("Importing IP Wattbox")
from pywattbox.ip_wattbox import async_create_ip_wattbox
Expand Down
3 changes: 2 additions & 1 deletion custom_components/wattbox/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def validate_regex(config: ConfigType, key: str) -> re.Pattern[str] | None:
return re.compile(regexp_str)
except re.error:
_LOGGER.error("Invalid %s: %s", key, regexp_str)
return None


async def async_setup_platform(
Expand Down Expand Up @@ -136,7 +137,7 @@ def icon(self) -> str | None:
class WattBoxMasterSwitch(WattBoxBinarySwitch):
"""WattBox master switch class."""

_outlet: Outlet | None
_outlet: Outlet | None # type: ignore[assignment]

def __init__(self, hass: HomeAssistant, name: str) -> None:
super().__init__(hass, name, 0)
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tool.black]
target-version = ["py310"]
target-version = ["py311"]

[tool.ruff]
target-version = "py310"
target-version = "py311"
select = [
"F", # pyflakes
"E", # pycodestyle errors
Expand All @@ -27,7 +27,7 @@ combine-as-imports = true
keep-runtime-typing = true

[tool.mypy]
python_version = "3.10"
python_version = "3.11"
show_error_codes = true
check_untyped_defs = true
no_implicit_reexport = false
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ homeassistant==2023.8.0
homeassistant-stubs==2023.8.0
pip>=21.0,<23.2
pywattbox [http, ip] @ git+https://github.com/eseglem/pywattbox@develop#pywattbox==0.6.0
ruff

0 comments on commit 4587d68

Please sign in to comment.