Closed NickWaterton closed 4 years ago
OK, poking around, the problem is in File "/home/nick/Scripts/HABApp/HABApp/openhab/connection_handler/func_sync.py", line 219 (as the error states):
def get_persistence_data(item_name: str, persistence: Optional[str],
start_time: Optional[datetime.datetime],
end_time: Optional[datetime.datetime]) -> OpenhabPersistenceData:
"""Query historical data from the OpenHAB persistence service
:param item_name: name of the persistet item
:param persistence: name of the persistence service (e.g. ``rrd4j``, ``mapdb``). If not set default will be used
:param start_time: return only items which are newer than this
:param end_time: return only items which are older than this
"""
assert isinstance(item_name, str) and item_name, item_name
assert isinstance(persistence, str) or persistence is None, persistence
assert isinstance(start_time, datetime.datetime) or start_time is None, start_time
assert isinstance(end_time, datetime.datetime) or end_time is None, end_time
fut = asyncio.run_coroutine_threadsafe(
get_persistence_data(
item_name=item_name, persistence=persistence, start_time=start_time, end_time=end_time
),
loop
)
ret = fut.result()
return OpenhabPersistenceData.from_dict(ret)
Which recursively calls itself.
The solution is to add async_get_persistence_data
to the imports at the top of the file:
from .func_async import async_post_update, async_send_command, async_create_item, async_get_item, async_get_thing, \
async_set_metadata, async_remove_metadata, async_get_channel_link, async_create_channel_link, \
async_remove_channel_link, async_channel_link_exists, \
async_remove_item, async_item_exists, async_get_persistence_data
and change line 217 to be:
fut = asyncio.run_coroutine_threadsafe(
async_get_persistence_data(
item_name=item_name, persistence=persistence, start_time=start_time, end_time=end_time
),
loop
)
I assume this was a simple oversight.
Thank you for catching and sorry for the convenience. I must have made a mistake while refactoring and it seems I have not test for persistence.
I just upgraded to the latest version of HABApp, and I now get the following errors when trying to access persistence data:
and a similar error
Any suggestions?