我试图制定一个基于网络的家用电器自动化项目,借鉴这里。
我正在使用:
我想在这里实现以下更多的内容:
- Since the webpage and the RPi is communicating by writing to and reading from text file, it is possible that pi turns off (due to power failure) causing the appliance to turn off but the file still contains status 'ON'. I want to check every 2-3 seconds if pi is online and working so that i can display on the website that the appliance is currently working and if pi get turned off i can display "There is some problem with Pi, check out."
我在网络上搜索了同样的内容,但是我没有得到任何使用PHP的解决方案,这样我就可以不断地检查我的pi的状态。我有一个使用cron作业的解决方案,但是没有任何免费的托管网站提供每2-3秒重复一次的cron作业,最小的时间是10分钟。
注:我只能上传文件在网站上,我没有任何手段提供命令的服务器。
发布于 2017-01-24 19:23:48
我不确定我完全遵循这个体系结构,但是您可以查看修改过的文件数据。想到的另一件事是让Pi将时间戳写到文件中,而不是"ON“。使用此时间戳,您将知道文件是在何时编写的,如果它的历史超过X时间,则假设Pi为off。但你得确保时钟都接近了。
https://stackoverflow.com/questions/41837087
复制相似问题