介绍

该模块作为云服务接口与业务接口的中间件, 不单独进行使用, 需和云服务模块功能结合使用

1. 模块导入

  1. from remote import RemotePublish
  2. remote_pub = RemotePublish()

2. 添加云服务模块

  1. from aliyunIot import AliYunIot
  2. ali = AliYunIot(pk, ps, dk, ds, server, client_id)
  3. res = remote_pub.add_cloud(ali)

3. 云服务OTA升级计划查询

  1. res = remote_pub.cloud_ota_check()

4. 云服务OTA升级确认

  1. action = 1
  2. module = "QuecPython-quecthing"
  3. res = remote_pub.cloud_ota_action(action, module)

5. 设备模块版本信息上报

  1. res = remote_pub.cloud_device_report()

6. MQTT同步通信消息应答

  1. message_id = 10
  2. data = {"local_time": 1655272997000}
  3. res = remote_pub.cloud_rrpc_response(message_id, data)

7. 物模型消息发布

  1. data = {
  2. "switch": True,
  3. "energy": 100,
  4. }
  5. res = remote_pub.post_data(data)