Skip to content

Commit 7b39fc6

Browse files
committed
chore: update types
1 parent c1daa17 commit 7b39fc6

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

custom_components/mcp2221/binary_sensor.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""MCP2221 binary sensor"""
22

3+
from asyncio import Lock
34
from datetime import datetime, timedelta
45
from homeassistant.components.binary_sensor import (
56
BinarySensorDeviceClass,
@@ -56,7 +57,7 @@ async def async_setup_platform(
5657
}
5758

5859
# get MCP2221 instance
59-
device_instance: MCP2221.MCP2221() | None = hass.data[DOMAIN].get(
60+
device_instance = hass.data[DOMAIN].get(
6061
binary_sensor.get(CONF_DEVICE_ID))
6162

6263
if not isinstance(device_instance["device"], MCP2221.MCP2221):
@@ -84,15 +85,15 @@ class MCP2221BinarySensor(ManualTriggerEntity, BinarySensorEntity):
8485
def __init__(
8586
self,
8687
config: ConfigType,
87-
device: MCP2221,
88+
device,
8889
pin: int,
8990
inverted: bool,
9091
interval: timedelta,
9192
) -> None:
9293
"""Initialize the binary sensor."""
9394
super().__init__(self.hass, config)
94-
self._device = device["device"]
95-
self._lock = device["lock"]
95+
self._device: MCP2221.MCP2221 = device["device"]
96+
self._lock: Lock = device["lock"]
9697
self._pin = pin
9798
self._inverted = inverted
9899
self._scan_interval = interval

custom_components/mcp2221/sensor.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""MCP2221 sensor"""
22

3+
from asyncio import Lock
34
from datetime import datetime, timedelta
45
from typing import Any
56

@@ -68,7 +69,7 @@ async def async_setup_platform(
6869
trigger_entity_config[key] = sensor.get(key)
6970

7071
# get MCP2221 instance
71-
device_instance: MCP2221.MCP2221() | None = hass.data[DOMAIN].get(
72+
device_instance = hass.data[DOMAIN].get(
7273
sensor.get(CONF_DEVICE_ID))
7374

7475
if not isinstance(device_instance["device"], MCP2221.MCP2221):
@@ -113,14 +114,14 @@ def __init__(
113114
hass: HomeAssistant,
114115
config: ConfigType,
115116
value_template: Template | None,
116-
device: MCP2221,
117+
device,
117118
pin: int,
118119
scan_interval: timedelta,
119120
) -> None:
120121
"""Initialize the sensor."""
121122
ManualTriggerSensorEntity.__init__(self, hass, config)
122-
self._device = device["device"]
123-
self._lock = device["lock"]
123+
self._device: MCP2221.MCP2221 = device["device"]
124+
self._lock: Lock = device["lock"]
124125
self._pin = pin
125126
self._scan_interval = scan_interval
126127
self._value_template = value_template

custom_components/mcp2221/switch.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""MCP2221 switch"""
22

3+
from asyncio import Lock
34
from homeassistant.components.switch import SwitchEntity
45
from homeassistant.const import (
56
CONF_PIN,
@@ -43,7 +44,7 @@ async def async_setup_platform(
4344

4445
# get MCP2221 instance
4546

46-
device_instance: MCP2221.MCP2221() | None = hass.data[DOMAIN].get(
47+
device_instance = hass.data[DOMAIN].get(
4748
switch.get(CONF_DEVICE_ID))
4849

4950
if not isinstance(device_instance["device"], MCP2221.MCP2221):
@@ -67,13 +68,13 @@ class MCP2221Switch(ManualTriggerEntity, SwitchEntity):
6768
def __init__(
6869
self,
6970
config: ConfigType,
70-
device: MCP2221,
71+
device,
7172
pin: int
7273
) -> None:
7374
"""Initialize the switch."""
7475
super().__init__(self.hass, config)
75-
self._device = device["device"]
76-
self._lock = device["lock"]
76+
self._device: MCP2221.MCP2221 = device["device"]
77+
self._lock: Lock = device["lock"]
7778
self._pin = pin
7879

7980
# init GP

0 commit comments

Comments
 (0)