霍尼韦尔spm flex气体检测仪的python驱动程序。
spmflex的Python项目详细描述
spmflex
python≥3.5的Honeywell SPM Flex gas detectors驱动程序。
安装
pip install spmflex
用法
命令行
要测试连接和流式实时数据,请使用命令行 接口。您可以使用以下命令读取状态:
$ spmflex 192.168.1.100
这将输出一个可以进一步操作的json对象。见下文 对象结构。
Python
对于更复杂的行为,可以编写python脚本。这仅仅是为了 python≥3.5的异步/等待语法。
importasynciofromspmfleximportGasDetectorasyncdefget():asyncwithGasDetector('192.168.1.100')asdetector:print(awaitdetector.get())asyncio.run(get())
如果探测器在那个地址工作,它应该输出一个 形式词典:
{"concentration":0.0,"connected":true,"fault":"No fault","flow":256,"gas":"AsH3 - Arsine","high-alarm threshold":"5.0","id":"SPMFLEX08000000","ip":"http://192.168.1.100/","life":93.0,"low-alarm threshold":"2.5","temperature":0,"units":"ppb"}
这是返回数据的清理版本。如果你想看所有的
它,设置raw=True
。