python - Python使用websocket API将dht22传感器数据发送到网页
问题描述
我正在使用与读取温度和湿度的 dht22 传感器连接的 raspberry Pi3 设备,python 代码将传感器数据发送到 thingSpeak 存储服务器上的 myChannel 并在 twitter 上发布信息,直到我的项目正常工作。
但我还想使用 websocket 在 webPage 上发送传感信息。我已经为此搜索了很多,但我没有找到好的答案,是否可以将 Websocket 与 thingSpaek 连接并直接或从 Pi 设备获取数据?
谢谢,
解决方案
ThingSpeak 允许 MQTT 客户端订阅其遥测数据。我相信也应该支持基于 Web Sockets 的 MQTT(无法确认)。
https://www.mathworks.com/help/thingspeak/subscribetoachannelfeed.html
一种或另一种方式,您可以使用 javascript MQTT 客户端(例如 paho)在您的网页上订阅 ThingSpeak 主题
推荐阅读
- postgresql - 无法让 Postgres 表分区工作
- java - 获得没有 draw() 计时错误的临时操作
- c++ - 将库文件夹添加到 Visual Studio
- android - 通过重启活动继续动画(Android)
- simpy - 如何在 SimPy 中创建资源列表
- android - 一段时间后 doAsync 不再被调用
- docker - Docker 编写针对容器的运行测试
- visual-studio-code - 在 Visual Studio Code 扩展开发中使用 HTML 文件
- material-ui - Material UI v1+ 如何使用带有 component={Link} 的 MenuItem
- java - Java USB 56k 调制解调器获取来电显示