mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-04-26 16:46:23 +00:00
Fix issues after rebasing
This commit is contained in:
parent
6dcc2758d7
commit
fc122eac6b
@ -26,6 +26,7 @@ from ..deviceconfig import DeviceConfig
|
||||
from ..emeterstatus import EmeterStatus
|
||||
from ..exceptions import KasaException
|
||||
from ..feature import Feature
|
||||
from ..firmware import Firmware
|
||||
from ..module import ModuleT
|
||||
from ..protocol import BaseProtocol
|
||||
from .iotmodule import IotModule
|
||||
@ -718,6 +719,6 @@ class IotDevice(Device):
|
||||
|
||||
@property
|
||||
@requires_update
|
||||
def firmware(self) -> Cloud:
|
||||
def firmware(self) -> Firmware:
|
||||
"""Returns object implementing the firmware handling."""
|
||||
return self.modules["cloud"]
|
||||
return cast(Firmware, self.modules["cloud"])
|
||||
|
@ -3,12 +3,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from pydantic.v1 import BaseModel
|
||||
|
||||
from datetime import date
|
||||
from typing import Optional
|
||||
|
||||
from pydantic.v1 import BaseModel, Field, validator
|
||||
|
||||
from ...feature import Feature
|
||||
from ...firmware import (
|
||||
Firmware,
|
||||
|
@ -9,14 +9,13 @@ from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
# When support for cpython older than 3.11 is dropped
|
||||
# async_timeout can be replaced with asyncio.timeout
|
||||
from async_timeout import timeout as asyncio_timeout
|
||||
from pydantic.v1 import BaseModel, Field, validator
|
||||
# When support for cpython older than 3.11 is dropped
|
||||
# async_timeout can be replaced with asyncio.timeout
|
||||
from async_timeout import timeout as asyncio_timeout
|
||||
from pydantic.v1 import BaseModel, Field, validator
|
||||
|
||||
from ...exceptions import SmartErrorCode
|
||||
from ...feature import Feature, FeatureType
|
||||
from ...feature import Feature
|
||||
from ...firmware import Firmware as FirmwareInterface
|
||||
from ...firmware import FirmwareUpdate as FirmwareUpdateInterface
|
||||
from ...firmware import UpdateResult
|
||||
@ -105,22 +104,6 @@ class Firmware(SmartModule, FirmwareInterface):
|
||||
category=Feature.Category.Info,
|
||||
)
|
||||
)
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device,
|
||||
"Current firmware version",
|
||||
container=self,
|
||||
attribute_getter="current_firmware",
|
||||
)
|
||||
)
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device,
|
||||
"Available firmware version",
|
||||
container=self,
|
||||
attribute_getter="latest_firmware",
|
||||
)
|
||||
)
|
||||
|
||||
def query(self) -> dict:
|
||||
"""Query to execute during the update cycle."""
|
||||
|
@ -16,6 +16,7 @@ from ..emeterstatus import EmeterStatus
|
||||
from ..exceptions import AuthenticationError, DeviceError, KasaException, SmartErrorCode
|
||||
from ..fan import Fan
|
||||
from ..feature import Feature
|
||||
from ..firmware import Firmware
|
||||
from ..module import ModuleT
|
||||
from ..smartprotocol import SmartProtocol
|
||||
from .modules import (
|
||||
@ -26,9 +27,11 @@ from .modules import (
|
||||
DeviceModule,
|
||||
EnergyModule,
|
||||
FanModule,
|
||||
Firmware,
|
||||
TimeModule,
|
||||
)
|
||||
from .modules import (
|
||||
Firmware as FirmwareModule,
|
||||
)
|
||||
from .smartmodule import SmartModule
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -626,11 +629,10 @@ class SmartDevice(Bulb, Fan, Device):
|
||||
return self._device_type
|
||||
|
||||
@property
|
||||
def firmware(self) -> FirmwareInterface:
|
||||
def firmware(self) -> Firmware:
|
||||
"""Return firmware module."""
|
||||
# TODO: open question: does it make sense to expose common modules?
|
||||
fw = cast(FirmwareInterface, self.modules["Firmware"])
|
||||
return fw
|
||||
return cast(Firmware, self.get_module(FirmwareModule))
|
||||
|
||||
@staticmethod
|
||||
def _get_device_type_from_components(
|
||||
|
Loading…
x
Reference in New Issue
Block a user