Code Monkey home page Code Monkey logo

paradoxmulti-mqtt's Introduction

Paradox Multi-MQTT

Python-based 'middleware' that aims to use any method to connect to a Paradox Alarm, exposing the interface for monitoring and control via an MQTT Broker. Currently access through the Serial port is implemented. As this a fork of the ParadoxIP150v2 project, access through the IP150 can be easily (re-)added (volunteers wanted). As I do not have access to the module, it is impossible for me to test it.

While I would welcome a merge with the origin project, the changes are substantial and I do not guarantee future compatibility.

Tested in the following environment:

  • Python 2.7.13
  • Mosquitto MQTT Broker v1.4.10 and v1.4.14
  • OrangePi 2G-IOT through its internal Serial Port, Raspberry PI 3 and Beaglebone black through USB370 paradox module
  • Ubuntu Server 16.04.3 LTS and Devuan Ceres as for december 2017 for RPI and for Beaglebone black
  • Paradox MG5050 panel

Steps to use it:

  1. Download the files in this repository and place it in some directory
  2. Copy config.ini.example to config.ini and edit it to match your setup
  3. Run the script: Python Multi-MQTTv2.py

What to expect:

The behaviour is similar to the one obtained with ParadoxIP150v2, but there are some RELEVANT changes. Please check this project documentation.

Changes from the original project

  • Using a python logging module, instead of print
  • Polling the serial port is now always done. This may help to discover connectivity losses and will allow to obtain some stats (battery, and eventually zones)
  • Changed the logic so that it handles Paradox messages without the headers required by the connectivity module (IP150).
  • Abstracted the channel to a separate class.
  • A new config file option was added (SERIAL). See the example.
  • Changes on how to deal with Arming and events.
  • Because my scenario is not bandwidth limited, MQTT topics are now more verbose.
  • Voltage values are processed
  • New KeepAlive mechanism now maintains a constant connection with the module.
  • Processing of zone status bits
  • Many small fixes
  • PLANED: Passthrough or IP150 mode, so that an IP150 is emulated and babyware/winload can connect remotelly. Passthrough already tested successfully and will be integrated soon.

What happens in the background:

The main script will connect to a panel (currently only through Serial) and login with your password (usually 0000). It will then use two seperate classes (containing dictionaries) referenced in from the ParadoxMap.py file to extract different info from the alarm and translate events into meaningfull text. The dictionaries currently supports the MG5050 V4 and V5 firmware but could evolve over time if the community adds more alarm types to the dictionaries.

Once the info (mostly labels) has been extracted from the alarm, the MQTT broker is used as middleware between your application and the alarm panel.

Seeing as not all alarm variants are initially supported, you can use the config.ini file to switch off different portions of the script. Not all event types may be implemented, but most shoud be!

Labels

If successfully connected to your panel and MQTT broker, the app will optionally start off by publishing (once-off) all the detected labels (zone, partition, output, etc. names) to your broker. Both the reading of label names and publishing thereof can be independantly controlled through the config.ini file. If you do read the labels, events such as "Zone open - Zone number 3" will translate to "Zone open - Garage door" or "Low battery on zone - Zone 1" to "Low battery on zone - Alley Beam" (assuming this is named/configured as such in your alarm).

Note: on a Spectre SP5500 these labels do not seem to read. To this end, I've updated to pull the zone name from the event message and will publish an MQTT topic for the zone name.

  • Zone Labels:
    • Topic: Paradox/Labels/Zones
    • Payload (example): 1:Front PIR;2:Back PIR;3:Garage Door;...
  • Output Labels:
    • Topic: Paradox/Labels/Outputs
    • Payload (example): 1:Status LED;2:ToggleGarage;3:UnlockFront;4:MakeCoffee;5:Output 05;6:Output 06;...
  • Partition Labels:
    • Topic: Paradox/Labels/Partitions
    • Payload (example): 1:Main Alarm;2:Front Beams
  • User Labels:
    • Topic: Paradox/Labels/Users
    • Payload (example): 1:System Master;2:Master 1;3:Master 2;4:Bob;5:Alice;6:User 06;...
  • Bus Module Labels:
    • Topic: Paradox/Labels/BusModules
    • Payload (example): 1:ZX8-1;2:Bus Module 02;3:Bus Module 03;4:Bus Module 04;5:Bus Module 05;...
  • Wireless Repeater Labels:
    • Topic: Paradox/Labels/WirelessRepeaters
    • Payload (example): 1:Front Rpt;2:Repeater 2
  • Wireless Keypad Labels:
    • Topic: Paradox/Labels/WirelessKeypads
    • Payload (example): 1:Main Keyp;2:Garage Keyp;3:Wireless Keyp 3;...
  • Wireless Siren Labels:
    • Topic: Paradox/Labels/WirelessSirens
    • Payload (example): 1:Wireless Siren 1;2:Wireless Siren 2;3:Wireless Siren 3;4:Wireless Siren 4
  • Site Name Labels:
    • Topic: Paradox/Labels/SiteNames
    • Payload (example): 1:Your Alarm Site

Events

Once the script has settled to listen for events, the following topics are available (and their names are also configurable in the config.ini file):

  • Events:
    • Topic: Paradox/Events

      • JSON Payload example: {"event": "Zone OK", "subevent": "Braaikamer PIR"}
      • JSON Payload example: {"event": "Zone open", "subevent": "Braaikamer PIR"}
      • JSON Payload example: {"event": "Partition status", "subevent": "Disarm partition"}
      • JSON Payload example: {"event": "Zone forced", "subevent": "Back Door"}
      • JSON Payload example: {"event": "Disarming with user", "subevent": "User 06"}
      • JSON Payload example: {"event": "Non-reportable event", "subevent": "Arm in sleep mode"}
      • etc.....

      It should be noticed the use of JSON for these events!

    • Topic Paradox/Status/Zones/zone label Sets a status for each zone (Open, Closed). Allows Openhab and Homeassistant to easily configure an item for each zone

    • Topic Paradox/Status/Partitions Shows the current partition status and events. Can't be determines on startup though, only while running.

    • Topic Paradox/Status/Bell Shows the current Bell status

    • Topic Paradox/Status/System Shows the current System status

    • Topic Paradox/Status/Voltage Shows the current voltage status

    • Payload example: {"battery": 13.6, "vdc": 16.8, "dc": 13.9}

Controls

  • Controlling the alarm or outputs
    • Publish the following topic to control the alarm:
      • Paradox/Control/Partitions/number or "ALL"
      • Payload contains the action = Disarm / Arm / Sleep / Stay
      • Is ALL is sent (e.g, Paradox/Control/Partitions/ALL), all partitions are set
    • Publish the following topic to control (Force/Pulse) an output (PGM):
      • Paradox/Control/Output/number
      • Payload contains On or Off
      • Pulse outputs are configured for approx. 0.5sec.

Note: If you modified the subscription topic for controls in the config.ini file ensure it ends with a '/'.

Script State

  • The current state of the script is linked to a topic found in the config file. Examples:
  • Topic Paradox/State
  • Payload (example): State Machine 1, Connected to MQTT Broker
  • Payload (example): State Machine 2, Connecting to IP Module...
  • Payload (example): State Machine 2, Connected to IP Module, unlocking...
  • Payload (example): State Machine 2, Logged into IP Module successfully
  • Payload (example): State Machine 3, Reading labels from alarm
  • Payload (example): State Machine 4, Listening for events...
  • Payload (example): Output: Forcing PGM 1 to state: On

Running as a service / daemon

If you want to run this as a daemon on Linux,

  1. Copy the paradoxip.service file to /usr/lib/systemd/system (where mine is)
  2. Run sudo systemctl daemon-reload
  3. Then you should be able to start the service with sudi service paradoxip start

paradoxmulti-mqtt's People

Contributors

jpbarraca avatar nextime avatar tertiush avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.