mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 19:53:34 +00:00
cbf82c9498
Previously, only v1 of on_off_gradually is supported, and the newer versions are not backwards compatible. This PR adds support for the newer versions of the component, and implements `number` type for `Feature` to expose the transition time selection. This also adds a new `supported_version` property to the main module API.
22 lines
540 B
Python
22 lines
540 B
Python
"""Implementation of device module."""
|
|
from typing import Dict
|
|
|
|
from ..smartmodule import SmartModule
|
|
|
|
|
|
class DeviceModule(SmartModule):
|
|
"""Implementation of device module."""
|
|
|
|
REQUIRED_COMPONENT = "device"
|
|
|
|
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
|