mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 19:53:34 +00:00
905a14895d
Ensures that all modules try to access their data in `_post_update_hook` in a safe manner and disable themselves if there's an error. Also adds parameters to get_preset_rules and get_on_off_gradually_info to fix issues with recent firmware updates. [#1033](https://github.com/python-kasa/python-kasa/issues/1033)
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
"""Frost protection module."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from ..smartmodule import SmartModule
|
|
|
|
|
|
class FrostProtection(SmartModule):
|
|
"""Implementation for frost protection module.
|
|
|
|
This basically turns the thermostat on and off.
|
|
"""
|
|
|
|
REQUIRED_COMPONENT = "frost_protection"
|
|
QUERY_GETTER_NAME = "get_frost_protection"
|
|
|
|
def query(self) -> dict:
|
|
"""Query to execute during the update cycle."""
|
|
return {}
|
|
|
|
@property
|
|
def enabled(self) -> bool:
|
|
"""Return True if frost protection is on."""
|
|
return self._device.sys_info["frost_protection_on"]
|
|
|
|
async def set_enabled(self, enable: bool):
|
|
"""Enable/disable frost protection."""
|
|
return await self.call(
|
|
"set_device_info",
|
|
{"frost_protection_on": enable},
|
|
)
|
|
|
|
@property
|
|
def minimum_temperature(self) -> int:
|
|
"""Return frost protection minimum temperature."""
|
|
return self.data["min_temp"]
|
|
|
|
@property
|
|
def temperature_unit(self) -> str:
|
|
"""Return frost protection temperature unit."""
|
|
return self.data["temp_unit"]
|