mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 17:43:55 +08:00
Merge pull request #1962 from zebbingo/main
fix: bug state.type -> state['type']
This commit is contained in:
@@ -50,7 +50,9 @@ hass_set_state_function_desc = {
|
|||||||
|
|
||||||
|
|
||||||
@register_function("hass_set_state", hass_set_state_function_desc, ToolType.SYSTEM_CTL)
|
@register_function("hass_set_state", hass_set_state_function_desc, ToolType.SYSTEM_CTL)
|
||||||
def hass_set_state(conn, entity_id="", state={}):
|
def hass_set_state(conn, entity_id="", state=None):
|
||||||
|
if state is None:
|
||||||
|
state = {}
|
||||||
try:
|
try:
|
||||||
future = asyncio.run_coroutine_threadsafe(
|
future = asyncio.run_coroutine_threadsafe(
|
||||||
handle_hass_set_state(conn, entity_id, state), conn.loop
|
handle_hass_set_state(conn, entity_id, state), conn.loop
|
||||||
@@ -157,7 +159,7 @@ async def handle_hass_set_state(conn, entity_id, state):
|
|||||||
if domain == "vacuum":
|
if domain == "vacuum":
|
||||||
action = "start"
|
action = "start"
|
||||||
else:
|
else:
|
||||||
return f"{domain} {state.type}功能尚未支持"
|
return f"{domain} {state['type']}功能尚未支持"
|
||||||
|
|
||||||
if arg == "":
|
if arg == "":
|
||||||
data = {
|
data = {
|
||||||
|
|||||||
Reference in New Issue
Block a user