From bcf6a5f0df5154429870015745e22ad12c1b2cbd Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Tue, 18 May 2021 20:03:06 +0300 Subject: Add MQTT support and bump to v1.3.0 (#12) * Initial MQTT branch * Cont * Added info to README. Added MQTT filter. * Added MQTT filter. * Fixed using localized string for filter * Added support to filter by area name Fixed compare case insensitive Updated README * Revert change * Fix error on missing mqtt init * Reorder params * Cleanup MQTT implementation * Update MQTT README * Bump to v1.3.0 Co-authored-by: Adi Miller --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 979ef1d..02e178d 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,33 @@ Options: --quiet Print only active alarms --desktop-notifications Create push notifications on your desktop notification center (currently only in Mac OS) + --mqtt-server TEXT Hostname / IP of MQTT server (optional) + --mqtt-client-id TEXT MQTT client identifier + --mqtt-port INTEGER Port for MQTT server + --mqtt-topic TEXT Topic on which to send MQTT messages + --mqtt-filter TEXT Payload value to filter before sending as a + message (semicolon separated) --help Show this message and exit. ``` +### MQTT Notifications + +Integration with an MQTT server provides the ability to send custom MQTT messages for all or some of the alerts that are received. MQTT requires [`paho-mqtt`](https://pypi.org/project/paho-mqtt/) to be installed separately as an optional dependency. + +To enable, specify at least the following parameters via the command line: + +- `mqtt-server` - The MQTT Server hostname or IP, e.g. `localhost` +- `mqtt-topic` - The MQTT topic to which the MQTT message will be sent, e.g. `alarmpy/zone` + +Additional optional parameters for MQTT integration are: + +- `mqtt-client-id` - The ID of the MQTT client used by alarmpy. This will be used to connect to the MQTT server. Default: `alarmPyClient`. This only needs to be change in case you plan to have more than one instance of alarmpy running +- `mqtt-port` - The port on which the MQTT server is listening to. Default: `1883` + +#### Filtering + +When MQTT is enabled, all alerts are sent as separate messages on the specified topic. In case there is a desire to include only specific alert, use the `mqtt-filter` parameter to provide a semicolon separated list of substrings enclosed in double quotes. Each alert city and area will be checked against all filters, and only when a match is found, will an MQTT message be sent. For example: `--mqtt-filter "gaza;negev"`. + ## License [GPLv3](LICENSE) -- cgit v1.3.1