-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Good dday,
With below code:
import asyncio
from homeassistant_api import Client
from aiohttp_client_cache import CachedSession, FileBackend
from datetime import timedelta
import logging
logging.basicConfig(filename='log.log', encoding='utf-8', level=logging.DEBUG)
hassurl = 'MY URL'
token = 'MY TOKEN'
client = Client(
hassurl,
token,
async_cache_session=CachedSession(cache=FileBackend(),
expire_after=timedelta(seconds=5)),
use_async=True
)
async def main():
async with client:
while True:
door = await client.async_get_state(entity_id='sensor.testing')
if door.state == 'on':
return True
else:
print(door)
asyncio.get_event_loop().run_until_complete(main())whenever I run this code it works properly except for the update of the cache
looking at the debug log i find this string:
DEBUG:aiohttp_client_cache.cache_control:Determining expiration time based on: -1
whatever I set as expire_after in CachedSession it will always be set to -1
does this event occur to me only?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working