介绍
该模块作为云服务接口与业务接口的中间件, 不单独进行使用, 需和云服务模块功能结合使用
1. 模块导入
from remote import RemotePublish
remote_pub = RemotePublish()
2. 添加云服务模块
from aliyunIot import AliYunIot
ali = AliYunIot(pk, ps, dk, ds, server, client_id)
res = remote_pub.add_cloud(ali)
3. 云服务OTA升级计划查询
res = remote_pub.cloud_ota_check()
4. 云服务OTA升级确认
action = 1
module = "QuecPython-quecthing"
res = remote_pub.cloud_ota_action(action, module)
5. 设备模块版本信息上报
res = remote_pub.cloud_device_report()
6. MQTT同步通信消息应答
message_id = 10
data = {"local_time": 1655272997000}
res = remote_pub.cloud_rrpc_response(message_id, data)
7. 物模型消息发布
data = {
"switch": True,
"energy": 100,
}
res = remote_pub.post_data(data)