Skip to main content

Integration between MQTT and custom notification services.

Project description

MQTT Sentinel

Build Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mqtt-sentinel, version 0.8.2
Filename, size File type Python version Upload date Hashes
Filename, size mqtt_sentinel-0.8.2-py3-none-any.whl (16.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size mqtt-sentinel-0.8.2.tar.gz (10.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page