File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
custom_components/zha_toolkit Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ async def misc_settime(
290290 u .dict_to_jsonable (read_resp [0 ]),
291291 read_resp [1 ],
292292 )
293- u .record_read_data (read_resp , cluster , params , listener )
293+ await u .record_read_data (read_resp , cluster , params , listener )
294294
295295 EPOCH2000_TIMESTAMP = 946684800
296296 utctime_towrite = utcnow ().timestamp () - EPOCH2000_TIMESTAMP
@@ -312,7 +312,7 @@ async def misc_settime(
312312 u .dict_to_jsonable (read_resp [0 ]),
313313 read_resp [1 ],
314314 )
315- u .record_read_data (read_resp , cluster , params , listener )
315+ await u .record_read_data (read_resp , cluster , params , listener )
316316
317317 event_data ["success" ] = True
318318 except DeliveryError as e :
Original file line number Diff line number Diff line change 3939
4040# pylint: disable=too-many-lines
4141
42+
4243async def get_ha_version () -> str :
4344 """Get HA Version"""
4445 return await asyncio .to_thread (version , "homeassistant" )
4546
47+
4648HA_VERSION = asyncio .run (get_ha_version ())
4749
50+
4851async def get_zigpy_version () -> str :
4952 """Get zigpy Version"""
5053 return await asyncio .to_thread (version , "zigpy" )
5154
55+
5256ZIGPY_VERSION = asyncio .run (get_zigpy_version ())
5357
5458if parse_version (HA_VERSION ) < parse_version ("2023.4" ):
@@ -634,7 +638,9 @@ async def append_to_csvfile(
634638
635639 import csv
636640
637- async with aiofiles .open (file_name , "w" if overwrite else "a" , encoding = "utf_8" ) as out :
641+ async with aiofiles .open (
642+ file_name , "w" if overwrite else "a" , encoding = "utf_8"
643+ ) as out :
638644 writer = csv .writer (out )
639645 await writer .writerow (fields )
640646
@@ -644,7 +650,7 @@ async def append_to_csvfile(
644650 LOGGER .debug (f"Appended { desc } to '{ file_name } '" )
645651
646652
647- def record_read_data (
653+ async def record_read_data (
648654 read_resp , cluster : zigpy .zcl .Cluster , params , listener = None
649655):
650656 """Record result from attr_write to CSV file if configured"""
You can’t perform that action at this time.
0 commit comments