slider for thermostats

This commit is contained in:
2025-11-17 08:05:58 +01:00
parent 6152385339
commit a4ae8a2f6c
2 changed files with 125 additions and 25 deletions

View File

@@ -246,6 +246,23 @@ class RedisState:
await self._execute_with_retry(_expire, key, ttl_secs)
async def delete(self, key: str) -> None:
"""
Delete a key from Redis.
Args:
key: Redis key to delete
Example:
>>> state = RedisState("redis://localhost:6379/0")
>>> await state.set("rules:r1:temp", "22.5")
>>> await state.delete("rules:r1:temp")
"""
async def _delete(client, k):
await client.delete(k)
await self._execute_with_retry(_delete, key)
async def close(self) -> None:
"""
Close Redis connection and cleanup resources.