You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

排查Shelly Cloud API Python代码报错:'Wrong device id!'

问题:调用Shelly云API时持续返回"Wrong device id!"错误

我调用Shelly云API时一直收到如下错误:

{'isok': False, 'errors': {'wrong_device_id': 'Wrong device id!'}}

我已经尝试使用应用中指定的设备ID的十六进制(HEX)和十进制(decimal)格式,但错误仍未解决。此外,我用curl -X POST调用接口时,连授权环节都无法通过。

以下是我使用的Python代码:

# Import the requests module
import requests

# Set the URL for the request
url = "https://********.shelly.cloud/device/relay/control"

# Set the headers for the request
headers = {
    "Authorization": "Bearer ******",
    "Content-Type": "application/json"
}

# Set the data for the request
data = {
    "channel": "0", # The channel to turn off
    "turn": "off", # The desired state (off)
    "id": "*******" # The ID of the device (Tried both, HEX and DEC versions of device ID)
}

# Send the POST request and store the response
response = requests.post(url, headers=headers, json=data)

# Print the response JSON
print(response.json())

我也按照Shelly云控制API文档中的说明尝试了curl调用,但问题依旧。

内容的提问来源于stack exchange,提问作者Slooki

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 11:15:27