mirror of
https://github.com/python-kasa/python-kasa.git
synced 2026-11-07 04:17:21 +00:00
Add TemperatureRecords module (#1814)
Adds the temp_record module, exposing thermostat temperature history oldest first, converting missing readings to None, and refreshing every 15 minutes. Includes registration, exports, its missing-fixture fallback, and module tests.
This commit is contained in:
24
tests/smart/modules/test_temperaturerecords.py
Normal file
24
tests/smart/modules/test_temperaturerecords.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from kasa import Module
|
||||
from kasa.smart import SmartDevice
|
||||
|
||||
from ...device_fixtures import parametrize
|
||||
|
||||
temperature_records = parametrize(
|
||||
"has temperature records",
|
||||
component_filter="temp_record",
|
||||
protocol_filter={"SMART.CHILD"},
|
||||
)
|
||||
|
||||
|
||||
@temperature_records
|
||||
async def test_temperature_records(dev: SmartDevice) -> None:
|
||||
"""Test the thermostat temperature history."""
|
||||
records = dev.modules[Module.TemperatureRecords]
|
||||
|
||||
temps = records.temperatures
|
||||
assert len(temps) == 96
|
||||
assert all(t is None or isinstance(t, float) for t in temps)
|
||||
assert temps[-1] is not None
|
||||
assert timedelta(minutes=15) == records.INTERVAL
|
||||
Reference in New Issue
Block a user