Skip to content

JohnOrthoefer/ad2usb-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ad2usb-bridge

This provides a bridge between a NuTech AD2USB (it should work with the PI Hat, and serial one as well). The AD2USB provides an interface between an Ademco Vista or DSC Power Series Security System.

This code interfaces the device with a Homebridge and allows control of it via MQTTThing.

ad2usb Flags

General

--help Show a list of the command flags and exit

--version Show the version number and git hash of the build

--[no-]timestamp turn the output timestamps on/off, when running it in a terminal for testing, when running under systemd, it timestamps the output.

Serial/USB

--serial="/dev/ttyUSB0" Set the serial device.

--baud=115200 Set the speed of the serial device, 115200 is the USB speed.

Configuration

--config="/usr/local/etc/ad2usb.yaml" the location of the file which has the codes to send the the security system.

Configuation Syntax

The file is YAML syntax, with a few scalars.

stay: "#3" Value to send to arm the system for stay/night.

away: "#2" Value to send to arm the system for away.

disarm: "54321" Value to send to disarm.

faults: "*" Value to dump faults.

MQTT

--publish=tcp://localhost:1883 MQTT broker to publish to.

--state="alarm/state" Topic for the current state.

--set="alarm/set" Topic to change the alarm state.

--dump="alarm/dump" Topic that is used to see what messages have been sent since start-up.

Homebridge configuration

{
    "type": "securitySystem",
    "name": "Alarm",
    "url": "mqtt://localhost",
    "topics": {
        "setTargetState": "alarm/set",
        "getTargetState": {
            "topic": "alarm/state",
            "apply": "return JSON.parse(message).State"
        },
        "getCurrentState": {
            "topic": "alarm/state",
            "apply": "return JSON.parse(message).State"
        }
    },
    "restrictTargetState": [
        0,
        1,
        3
    ],
    "accessory": "mqttthing"
}

Dump Information

Extra infomation can be retrived by subscribing to the Dump topic, by default alarm/dump. When a JSON dump command is send it will reply on the Dump topic.

  • {"dump": "log"} - returns the list of the status messages recieved since the last start/restart.
  • {"dump": "config"} - returns the current configuation of the AD2 device.

Using mosquitto, MQTT command line utiliity-

  • Listen - mosquitto_sub -L mqtt://localhost/alarm/dump | jq .
  • Log - mosquitto_pub -L mqtt://localhost/alarm/dump -m '{"dump": "log"}
  • Configuration - mosquitto_pub -L mqtt://localhost/alarm/dump -m '{"dump": "config"}

Referances

This is what I used as referance for this code.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published