We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f196864 commit ad6f3a0Copy full SHA for ad6f3a0
custom_components/python_script/sensor.py
@@ -24,8 +24,12 @@ async def async_setup_platform(
24
try:
25
if "file" in config:
26
finename = hass.config.path(config["file"])
27
- with open(finename, "rt", encoding="utf-8") as f:
28
- source = f.read()
+
+ def sync_file_read() -> str:
29
+ with open(finename, "rt", encoding="utf-8") as f:
30
+ return f.read()
31
32
+ source = await hass.async_add_executor_job(sync_file_read)
33
elif "source" in config:
34
source = config["source"]
35
else:
0 commit comments