Python Interface for Alarm.com
Project description
Alarm.com Python Library
Author: Justin Wong
Overview
A Python library to asynchronously interface with Alarm.com. Forked from Daren Lord's pyalarmdotcom. Mainly built for use with Home Assistant.
BREAKING CHANGES
v0.2 of pyalarmdotcomajax breaks just about all features available in v0.1. Be careful when updating.
Installation / Usage
To install use pip:
pip install pyalarmdotcomajax
Or clone the repo:
git clone https://github.com/uvjustin/pyalarmdotcomajax.git
python setup.py install
Usage
See examples/basic_sensor_data.py
for a basic usage example.
Device Support
- As of v0.2, multiples of all devices are supported.
- All devices include the attributes:
name
,id_
,state
,battery_low
,battery_critical
,malfunctioning
,parent_ids
, and a few others.
Device Type | Notable Attributes | Actions |
---|---|---|
System | unit_id |
(none) |
Partition | uncleared_issues , desired_state |
arm away, arm stay, arm night, disarm |
Sensors | device_subtype |
(none) |
Locks | desired_state |
lock, unlock |
Garage Door | (none) | open, close |
Known Sensor deviceTypes
This list identifies deviceTypes used in the alarm.com API and is incomplete. Please help by submitting missing values.
deviceType | Description |
---|---|
1 | Contact Sensor |
5 | Smoke Detector |
6 | CO Detector |
9 | Panic Button |
19 | Glass Break Detector |
Command Line Interface
The CLI is available by running adc
from anywhere in your terminal.
usage: adc [-h] -u USERNAME -p PASSWORD [-c COOKIE] [-v] [-d] [-ver]
Basic command line debug interface for Alarm.com via pyalarmdotcomajax. Shows device states in various formats.
optional arguments:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
alarm.com username
-p PASSWORD, --password PASSWORD
alarm.com password
-c COOKIE, --cookie COOKIE
two-factor authentication cookie
-v, --verbose show verbose output. -v returns server response for all devices except systems. -vv returns server response for all devices.
-d, --debug show pyalarmdotcomajax's debug output.
-ver, --version show program's version number and exit
Development
VS Code Support Structures
This repository includes a full development environment for VS Code:
- VS Code dev container. Automatically installs extensions and Python dependencies and registers Git pre-commit scripts.
- Configuration files for type checking (mypy), linting (flake8, isort, and black), code security (Bandit), etc.
- Pre-commit checks run all of the above when committing to Git and on demand via VS Code tasks.
References
- Some API definitions are available in the node-alarm-dot-com repository.
Open Items
Features
- Support additional components (lights, irrigation, etc.).
- Support more sensor types (see list above in this README).
- Add
debug_info
property toADCController
that returns aggregate of raw JSON from all endpoints. This will allow users to export the entity model of unsupported devices to help maintainers implement support in this library. - Similar to above, proactively populate
unsupported_devices
property forADCBaseElement
to show users device id, device name, and device type for available but unsupported devices. - More granular exception handling when logging in. Should report discrete error types for authentication failures due to wrong credentials, connection issues, or other.
Housekeeping
- Testing framework
- Auto-build and publish to pypi w/ GitHub release.
MIT License
Copyright (c) 2020 Justin Wong
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
Built Distribution
Hashes for pyalarmdotcomajax-0.2.0b7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11719c05a652c594572202028e4a26a7d56dabe33ecce0dbda0ea3064f8b77c7 |
|
MD5 | 66614faab139ee99fcd3c901cca8dfc7 |
|
BLAKE2b-256 | 47ddf0a23d46ff494bbce05f7ef2a4d70b1635e85f845a04b1ea6fa0937b5aae |
Hashes for pyalarmdotcomajax-0.2.0b7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1217e4f0131f15a2499e452fe1f920db2fba5148536824e9dfa7e6171e914db4 |
|
MD5 | 65794b22d33f13798a4a86911a37eda7 |
|
BLAKE2b-256 | 29224f09f5c82209cf5b76fb26eeb905d0ae9c842218900252d6465a36c08b4c |