1
Tink 193 天前 via iPhone
import requests
url = "http://your-home-assistant-url:8123/api/services/climate/set_hvac_mode" headers = { "Authorization": "Bearer YOUR_LONG_LIVED_ACCESS_TOKEN", "Content-Type": "application/json", } data = { "entity_id": "climate.living_room_ac", "hvac_mode": "heat" # 要切换的模式,如 cool 、heat 、off 等 } response = requests.post(url, headers=headers, json=data) print(response.json()) |