on_message在python中不起作用 [英] on_message is not working in python

查看:93
本文介绍了on_message在python中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究aws物联网,并且能够通过shell脚本由终端更新阴影状态.但是我能够得到root @ raspberrypi:〜#./aws_subscribe.py与结果代码0连接,并且也在aws中物联网首页我出现不同步错误和我正在关注此博客

解决方案

AWS控制台上的影子状态"字段仅显示已报告"和所需"状态是否相同,对功能没有影响./p>

这是一个显示状态为不同步的示例:

  {已报告":{已锁定":是},所需":{已锁定":false}} 

在此示例中,它们显示为同步.

  {已报告":{已锁定":是},所需":{已锁定":是}} 

这实际上就是全部.您可以通过发送以下JSON来完全删除所需"状态,如果执行此操作,它将始终显示为同步.

  {所需":空} 

I am working on aws iot and able to get the shadow state updated by the terminal via shell script .But i am able to get root@raspberrypi:~# ./aws_subscribe.py Connected with result code 0 and also in aws iot home i am getting out of sync error and i am following this blog

解决方案

The 'Shadow status' field on the AWS console merely shows if the 'reported' and 'desired' states are the same, it has no functional impact.

This is an example that would show the status as out of sync:

{
  "reported": {
    "locked": true
  },
  "desired": {
    "locked": false
  }
}

Where as this example would show them as in sync.

{
  "reported": {
    "locked": true
  },
  "desired": {
    "locked": true
  }
}

That's really all there is to it. You can completely remove the 'desired' state by sending the following JSON, if you do this it will always show as in sync.

{
  "desired": null
}

这篇关于on_message在python中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆