mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2025-11-12 07:51:54 +00:00
fix: lua base library location error.
This commit is contained in:
@@ -145,8 +145,11 @@ async def async_setup(hass: HomeAssistant, config: ConfigType):
|
|||||||
config_dir = hass.config.path(DOMAIN)
|
config_dir = hass.config.path(DOMAIN)
|
||||||
os.makedirs(config_dir, exist_ok=True)
|
os.makedirs(config_dir, exist_ok=True)
|
||||||
|
|
||||||
cjson = os.path.join(config_dir, "cjson.lua")
|
os.makedirs(hass.config.path(STORAGE_PATH), exist_ok=True)
|
||||||
bit = os.path.join(config_dir, "bit.lua")
|
lua_path = hass.config.path(STORAGE_PATH)
|
||||||
|
|
||||||
|
cjson = os.path.join(lua_path, "cjson.lua")
|
||||||
|
bit = os.path.join(lua_path, "bit.lua")
|
||||||
|
|
||||||
# 只有文件不存在时才创建
|
# 只有文件不存在时才创建
|
||||||
if not os.path.exists(cjson):
|
if not os.path.exists(cjson):
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ class LuaRuntime:
|
|||||||
self._runtimes.execute('require "cjson"')
|
self._runtimes.execute('require "cjson"')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
MideaLogger.warning(f"Failed to load cjson: {e}")
|
MideaLogger.warning(f"Failed to load cjson: {e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._runtimes.execute('require "bit"')
|
self._runtimes.execute('require "bit"')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
MideaLogger.warning(f"Failed to load bit: {e}")
|
MideaLogger.warning(f"Failed to load bit: {e}")
|
||||||
|
|
||||||
# 加载设备特定的Lua文件
|
# 加载设备特定的Lua文件
|
||||||
string = f'dofile("{file}")'
|
string = f'dofile("{file}")'
|
||||||
self._runtimes.execute(string)
|
self._runtimes.execute(string)
|
||||||
|
|||||||
Reference in New Issue
Block a user