0

我目前在连接到 IoT Central 的自动化植物监控和浇水 IoT 系统中使用 PyPortal。该设备已连接到 IoT Central,但是当我将命令从 IoT Central 发送到我的 PyPortal 时,它不起作用并显示此错误 [网关超时等待应用程序 48e39735-0f9a-44dc-a50c-e5debf12baee 中的设备 1bic1gfu8zk 返回request.] 或设备响应为空的问题。以下代码是来自 IoT Central 的原始数据:

{
    "waterPlant": {
        "Value": ""
    },
    "_eventtype": "Command response",
    "_timestamp": "2022-02-14T08:09:43.473Z"
}

我的 PyPortal 代码基于此链接:https ://circuitpython.readthedocs.io/projects/azureiot/en/latest/examples.html#id6

接收命令的 PyPortal 代码:

def command_executed(waterPlant: str, payload) -> IoTResponse:
                print("Command ", waterPlant, " executed with payload", str(payload))
                # return a status code and message to indicate if the command was handled correctly
                return IoTResponse(200, "OK"),
device.on_command_executed = command_executed

任何意见,将不胜感激。

4

0 回答 0