MQTT和自定义通知服务之间的集成。

mqtt-sentinel的Python项目详细描述


mqtt哨兵

Build Status

使用自定义规则在mqtt和服务之间进行集成。基于令人敬畏的项目mqttwarn

安装

开始

1.cli

# Create a rule -t topic | -o operator | -e equated
$ msentinel add -c your-conf.ini -t "room/temperature" -o ">=" -e "30"

# Run the sentinel
$ msentinel run -c your-conf.ini

# More info
$ msentinel --help

.ini结构

; your-conf.ini[settings:mqtt]host=localhostport=1883keepalive=60;  Optional;  [settings:rules]; db_url = sqlite://sentinel.db[output:mqtt] ; Output Servicehost=localhostport=1883keepalive=60topic=device123/broadcast/alarms

1.1输出服务

2.使用库创建应用程序

# app.pyfromsentinelimportSentinelfromsentinel.rulesimportRulefromsentinel.outputimportOutMQTTsentinel=Sentinel()output=OutMQTT(host='localhost',port=1883,topic='app/broadcast/alert')sentinel.set_db()# Use the default SQLite3 database (sentinel.db)sentinel.set_output(output)rule=Rule(topic='device123/room/temperature',operator=">=",equated="31")# If you want create a simple data relay, use:# rule = Rule(topic='device123/room/temperature')sentinel.add_rule(rule)sentinel.start()
$ python app.py
 Starting my watch with 1 workers
 ...

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么我们不能将ArrayList<Integer>传递给具有(Integer…)的方法参数   java Spring RestTemplate映射JSON对映射的响应引发不匹配的PutException   在系统中找到java Selenium元素,但在Jenkins中未找到   java在Android中使用JavaMail API发送电子邮件,而不使用默认/内置应用程序   数组如何在Java数据结构中同时存储数字和相应的单词?   为什么“+”运算符未定义?JAVA   java如何在游戏中添加高分系统?   java在球门碰撞中区分球和球员   java如何使用SpringSecurity4.0.1使用Auth令牌实现Rest完整Web服务。释放   java如何解决这个错误:Android资源链接失败?   java多线程文件处理和数据库批插入   导致Tomcat失败的java无用块线程   java主线程做了太多的工作,尽管我使用了异步线程(laggy UI)   在Java FX 2.0中滚动锚定节点时,锚定始终可见?   java使用EJB3中的客户机jar和设计模式