Bump python-kasa to 0.4.1 for tplink integration (#64123)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
ca7d4234e1
commit
c985ebb3a7
6 changed files with 14 additions and 12 deletions
|
@ -96,7 +96,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
device: SmartDevice = hass_data[entry.entry_id].device
|
||||
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
||||
hass_data.pop(entry.entry_id)
|
||||
await device.protocol.close()
|
||||
await device.protocol.close() # type: ignore
|
||||
return unload_ok
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
from kasa import SmartDevice
|
||||
from kasa import SmartBulb
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
|
@ -41,7 +41,7 @@ async def async_setup_entry(
|
|||
) -> None:
|
||||
"""Set up switches."""
|
||||
coordinator: TPLinkDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||
device = coordinator.device
|
||||
device = cast(SmartBulb, coordinator.device)
|
||||
if device.is_bulb or device.is_light_strip or device.is_dimmer:
|
||||
async_add_entities([TPLinkSmartBulb(device, coordinator)])
|
||||
|
||||
|
@ -50,10 +50,11 @@ class TPLinkSmartBulb(CoordinatedTPLinkEntity, LightEntity):
|
|||
"""Representation of a TPLink Smart Bulb."""
|
||||
|
||||
coordinator: TPLinkDataUpdateCoordinator
|
||||
device: SmartBulb
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
device: SmartDevice,
|
||||
device: SmartBulb,
|
||||
coordinator: TPLinkDataUpdateCoordinator,
|
||||
) -> None:
|
||||
"""Initialize the switch."""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "TP-Link Kasa Smart",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/tplink",
|
||||
"requirements": ["python-kasa==0.4.0"],
|
||||
"requirements": ["python-kasa==0.4.1"],
|
||||
"codeowners": ["@rytilahti", "@thegardenmonkey"],
|
||||
"dependencies": ["network"],
|
||||
"quality_scale": "platinum",
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
from kasa import SmartDevice
|
||||
from kasa import SmartDevice, SmartPlug
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -27,7 +27,7 @@ async def async_setup_entry(
|
|||
) -> None:
|
||||
"""Set up switches."""
|
||||
coordinator: TPLinkDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||
device = coordinator.device
|
||||
device = cast(SmartPlug, coordinator.device)
|
||||
if not device.is_plug and not device.is_strip:
|
||||
return
|
||||
entities: list = []
|
||||
|
@ -48,11 +48,12 @@ class SmartPlugLedSwitch(CoordinatedTPLinkEntity, SwitchEntity):
|
|||
"""Representation of switch for the LED of a TPLink Smart Plug."""
|
||||
|
||||
coordinator: TPLinkDataUpdateCoordinator
|
||||
device: SmartPlug
|
||||
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
|
||||
def __init__(
|
||||
self, device: SmartDevice, coordinator: TPLinkDataUpdateCoordinator
|
||||
self, device: SmartPlug, coordinator: TPLinkDataUpdateCoordinator
|
||||
) -> None:
|
||||
"""Initialize the LED switch."""
|
||||
super().__init__(device, coordinator)
|
||||
|
|
|
@ -1939,7 +1939,7 @@ python-join-api==0.0.6
|
|||
python-juicenet==1.0.2
|
||||
|
||||
# homeassistant.components.tplink
|
||||
python-kasa==0.4.0
|
||||
python-kasa==0.4.1
|
||||
|
||||
# homeassistant.components.lirc
|
||||
# python-lirc==1.2.3
|
||||
|
|
|
@ -1203,7 +1203,7 @@ python-izone==1.2.3
|
|||
python-juicenet==1.0.2
|
||||
|
||||
# homeassistant.components.tplink
|
||||
python-kasa==0.4.0
|
||||
python-kasa==0.4.1
|
||||
|
||||
# homeassistant.components.xiaomi_miio
|
||||
python-miio==0.5.9.2
|
||||
|
|
Loading…
Add table
Reference in a new issue