A Python library for interacting with the Sector Alarm API.
Project description
SectorAlarm Library
A Python client library for interacting with Sector Alarm systems.
Overview
The sectoralarm library allows developers to interact with Sector Alarm systems programmatically. It provides methods to authenticate, retrieve system status, control locks, arm/disarm the alarm system, and access sensor data.
Features
- Authentication: Securely log in to the Sector Alarm API.
- System Status: Retrieve panel status and sensor data.
- Control Actions: Arm/disarm the alarm system and lock/unlock doors.
- Logs Access: Access system logs and events.
- Cache Management: Efficiently cache data to minimize API calls.
Installation
You can install the library via pip:
pip install sectoralarm
Usage
Importing the Library
from sectoralarm import SectorAlarmAPI, AuthenticationError
Initializing the API Client
# Replace with your actual credentials
email = "your_email@example.com"
password = "your_password"
panel_id = "your_panel_id"
panel_code = "your_panel_code"
api = SectorAlarmAPI(email, password, panel_id, panel_code)
Logging In
try:
api.login()
print("Logged in successfully.")
except AuthenticationError as e:
print(f"Authentication failed: {e}")
Retrieving Panel Status
status = api.retrieve_category_data("Panel Status")
print("Panel Status:")
print(status)
Arming the System
success = api.actions_manager.arm_system()
if success:
print("System armed successfully.")
else:
print("Failed to arm the system.")
Disarming the System
success = api.actions_manager.disarm_system()
if success:
print("System disarmed successfully.")
else:
print("Failed to disarm the system.")
Locking a Door
lock_serial = "your_lock_serial_number"
success = api.actions_manager.lock_door(lock_serial)
if success:
print("Door locked successfully.")
else:
print("Failed to lock the door.")
Unlocking a Door
lock_serial = "your_lock_serial_number"
success = api.actions_manager.unlock_door(lock_serial)
if success:
print("Door unlocked successfully.")
else:
print("Failed to unlock the door.")
API Reference
Please refer to the code documentation and docstrings within the library for more detailed information on available methods and their usage.
Dependencies
requests: Used for making HTTP requests to the Sector Alarm API.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This library is not affiliated with or endorsed by Sector Alarm. Use it responsibly and at your own risk.
Contributing
Contributions are welcome! Please submit a pull request or open an issue on GitHub.
Contact
For questions or suggestions, please contact Jonathan Petersson jpetersson@garnser.se.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sectoralarm-1.2.0.tar.gz.
File metadata
- Download URL: sectoralarm-1.2.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c770c5c0a421dee829ced39e792633b8652feaba1272e34435597f13faeb0a05
|
|
| MD5 |
00dc17c322c98caceaaa78ca530887a9
|
|
| BLAKE2b-256 |
cfe29c1aa8e169feccf1b7c779d543eb7769f53dbc8356dedcb8c621bf8e22fc
|
File details
Details for the file sectoralarm-1.2.0-py3-none-any.whl.
File metadata
- Download URL: sectoralarm-1.2.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb4e72ee72e5534f66a1876565381cbdbeed4fcb188b5b57b84f85b1d8ad6fc3
|
|
| MD5 |
a5bdc1c30fe2e459896ff5ecb6998943
|
|
| BLAKE2b-256 |
ddd4ee51d469118c563cfcf9c99f9f2d4917edf051751aeedefe72b445a4e166
|