python - 使用 Raspberry Pi 和 Bluemix 的 IoT Python 应用程序 : Pushing the button doesn't work

标签 python raspberry-pi ibm-cloud iot

我完成了以下教程,使用 IoT Foundation 将我的 Raspberry Pi 连接到 Bluemix 上的应用程序:

https://developer.ibm.com/bluemix/2015/04/02/tutorial-using-a-raspberry-pi-python-iot-twilio-bluemix/

我有以下问题:

如果我按下 Pi 上的按钮,它只会在 Pi 终端中打印出“按下按钮”。

我的手机上没有收到任何短信,日志中现在有来自 Twilio 的条目。

最佳答案

事实证明,IBM IoT Foundation 库的解析 JSON 的方式发生了变化...此外,我还对代码进行了硬编码,以获取美国电话号码。我还添加了对美国电话号码的检查。

更改line 25

buttonPushed = cmd.payload["d"]["buttonPushed"]

payload = json.loads(cmd.payload)
buttonPushed = payload["buttonPushed"]

关于python - 使用 Raspberry Pi 和 Bluemix 的 IoT Python 应用程序 : Pushing the button doesn't work,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35135226/

相关文章:

python - 自动重新寻址引用对象的所有变量

python - Raspberry-pi mqttc.publish() 到 20 个条目后 Node 红色溢出

java - OrientDB安装Raspberry Pi问题

linux - sqlcipher ./配置linux

logging - 路由器 (RTR) 日志的消息格式?

python - 在 Keras 中加载保存的模型(双向 LSTM)

python - 组合字典时未指定长度的 Dask 延迟对象不可迭代错误

python - Python 示例中的 ">>>"是什么意思?

java - 使用 BlueMix 尝试将 JSON 数据插入 Cloudant 数据库,而无需在 Java 中对文件格式进行硬编码

javascript - 404 未找到 : Requested route ('theo-larissa.mybluemix.net' ) does not exist