Integration between MQTT and custom notification services.
Project description
MQTT Sentinel
Integration between MQTT and services using custom rules. Based on the awesome project mqttwarn.
Installation
....
Getting started
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 structure
; your-conf.ini
[settings:mqtt]
host = localhost
port = 1883
keepalive = 60
; Optional
; [settings:rules]
; db_url = sqlite://sentinel.db
[output:mqtt] ; Output Service
host = localhost
port = 1883
keepalive = 60
topic = device123/broadcast/alarms
1.1 Output Services
2. Create applications using the library
# app.py
from sentinel import Sentinel
from sentinel.rules import Rule
from sentinel.output import OutMQTT
sentinel = 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
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mqtt-sentinel-0.8.2.tar.gz
(10.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mqtt-sentinel-0.8.2.tar.gz.
File metadata
- Download URL: mqtt-sentinel-0.8.2.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dbd5943f58973b0d00b399039792dea08933a6ea3547a27fa255e2cd56766f6
|
|
| MD5 |
24a3bf167b35f51fc690d1719e8e7e98
|
|
| BLAKE2b-256 |
81ef4d15a167a5835aa1aa0b51439e8f0173f004fd3a732179effb1deb2b3155
|
File details
Details for the file mqtt_sentinel-0.8.2-py3-none-any.whl.
File metadata
- Download URL: mqtt_sentinel-0.8.2-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd928457b4f99d5d6e5ed8c43d4ab3f2456a0ef70565316c599fd05eed8b3cc7
|
|
| MD5 |
aec231aa0fae95b2403b4c42e4ea339e
|
|
| BLAKE2b-256 |
5090d3f1658ebb303cbeef8573ecf79650289123f74f4ee142772e9ec01d7be7
|