mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
9641edcbc0
Also makes on_since for iot devices use device time. Changes the return value for device.timezone to be tzinfo instead of a dict.
30 lines
786 B
Python
30 lines
786 B
Python
"""Implementation of device module."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from ..smartmodule import SmartModule
|
|
|
|
|
|
class DeviceModule(SmartModule):
|
|
"""Implementation of device module."""
|
|
|
|
REQUIRED_COMPONENT = "device"
|
|
|
|
async def _post_update_hook(self):
|
|
"""Perform actions after a device update.
|
|
|
|
Overrides the default behaviour to disable a module if the query returns
|
|
an error because this module is critical.
|
|
"""
|
|
|
|
def query(self) -> dict:
|
|
"""Query to execute during the update cycle."""
|
|
query = {
|
|
"get_device_info": None,
|
|
}
|
|
# Device usage is not available on older firmware versions
|
|
if self.supported_version >= 2:
|
|
query["get_device_usage"] = None
|
|
|
|
return query
|