2024-02-19 17:01:31 +00:00
|
|
|
"""Implementation of device module."""
|
2024-04-16 18:21:20 +00:00
|
|
|
|
2024-04-17 13:39:24 +00:00
|
|
|
from __future__ import annotations
|
2024-02-19 17:01:31 +00:00
|
|
|
|
|
|
|
from ..smartmodule import SmartModule
|
|
|
|
|
|
|
|
|
|
|
|
class DeviceModule(SmartModule):
|
|
|
|
"""Implementation of device module."""
|
|
|
|
|
|
|
|
REQUIRED_COMPONENT = "device"
|
|
|
|
|
2024-07-04 07:02:50 +00:00
|
|
|
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.
|
|
|
|
"""
|
|
|
|
|
2024-04-17 13:39:24 +00:00
|
|
|
def query(self) -> dict:
|
2024-02-19 17:01:31 +00:00
|
|
|
"""Query to execute during the update cycle."""
|
|
|
|
query = {
|
|
|
|
"get_device_info": None,
|
|
|
|
}
|
|
|
|
# Device usage is not available on older firmware versions
|
2024-02-24 01:16:43 +00:00
|
|
|
if self.supported_version >= 2:
|
2024-02-19 17:01:31 +00:00
|
|
|
query["get_device_usage"] = None
|
|
|
|
|
|
|
|
return query
|