Async Python library to interface with iAlarm-MK alarm panels locally
Project description
🚨 Open iAlarm-MK Local API
Asynchronous Python library for iAlarm-MK alarm panels via the local Meian protocol
Features • Installation • Quick Start • Documentation • Examples • Testing
Features
Performance
- Built with asyncio for non-blocking operations
- Efficient TCP communication over the Meian binary protocol
- TCP keep-alive to prevent idle connection drops
Reliability
- Framed two-phase read: large MK7 responses (>1024 bytes) always received in full
- Graceful error propagation with full detail preserved
- Auto-close socket on connection failure
- Auto-reconnect: each command retries once on connection drop
- Concurrent-safe: internal
asyncio.Lockserializes all commands (Home Assistant coordinator safe) - Application-level keepalive: polls status every 30 s to prevent panel idle timeouts
Developer Friendly
- Type-safe dataclasses:
AlarmStatusModel,ZoneModel,NetworkInfoModel - Async context manager support
- Comprehensive logging at every step
Full Control
- Arm Away, Arm Stay, Arm Partial, Disarm, Cancel Alarm
- Read all zones with status (open, bypassed, low battery, signal loss)
- Read network info (name, MAC, IP)
Installation
git clone https://github.com/VoidElle/open-ialarm-mk-local-api
cd open-ialarm-mk-local-api
pip install -e .
Quick Start
import asyncio
from open_ialarm_mk_local_api import IAlarmMkClient
async def main():
async with IAlarmMkClient("192.168.1.100", 8000, "admin", "secret") as client:
status = await client.get_status()
print(f"Status: {status.status.name}")
zones = await client.get_zones()
for zone in zones:
print(f" [{zone.index:3d}] {zone.name} - {'OPEN' if zone.is_open else 'ok'}")
asyncio.run(main())
Panel Port
| Model | Default TCP port |
|---|---|
| iAlarm MK7 | 8000 |
| iAlarm MK2 | 18034 |
Documentation
Configuration
Constructor Parameters: IAlarmMkClient
| Parameter | Type | Default | Description |
|---|---|---|---|
host |
str |
required | IP address of the panel |
port |
int |
required | TCP port (8000 for MK7, 18034 for MK2) |
username |
str |
required | Login username |
password |
str |
required | Login password |
timeout |
float |
10.0 |
Socket timeout in seconds |
keepalive_interval |
int | None |
30 |
Seconds between keepalive polls; None to disable |
Connection Management
Connect / Disconnect
await client.connect()
await client.disconnect()
Context Manager (recommended)
async with IAlarmMkClient("192.168.1.100", 8000, "admin", "pass") as client:
status = await client.get_status()
Alarm Control
await client.arm_away() # Arm all zones
await client.arm_stay() # Perimeter zones only
await client.arm_partial() # Partial arm
await client.disarm() # Disarm
await client.cancel_alarm() # Cancel active alarm
Data Models
AlarmStatusModel
| Field | Type | Description |
|---|---|---|
status |
AlarmStatusEnum |
Current panel status |
AlarmStatusEnum
| Value | Name | Description |
|---|---|---|
0 |
ARMED_AWAY |
Armed, all zones |
1 |
DISARMED |
Disarmed |
2 |
ARMED_STAY |
Armed, stay mode |
3 |
CANCEL |
Alarm cancelled |
4 |
TRIGGERED |
Alarm triggered |
5 |
ALARM_ARMING |
Arming in progress |
6 |
UNAVAILABLE |
Status unknown |
8 |
ARMED_PARTIAL |
Armed, partial |
ZoneModel
| Field / Property | Type | Description |
|---|---|---|
index |
int |
Zone index |
name |
str |
Zone name |
zone_type |
int |
Zone type code |
status |
ZoneStatusEnum |
Raw status bitmask |
is_open |
bool |
Zone is faulted / open |
is_bypassed |
bool |
Zone is bypassed |
low_battery |
bool |
Low battery detected |
signal_loss |
bool |
Wireless signal lost |
NetworkInfoModel
| Field | Type | Description |
|---|---|---|
name |
str |
Panel device name |
mac |
str |
MAC address |
ip |
str |
IP address |
Error Handling
| Exception | When raised |
|---|---|
IAlarmMkConnectionError |
TCP failure, timeout, or unexpected error during login |
IAlarmMkLoginError |
Panel rejected credentials |
IAlarmMkAlarmError |
Panel returned a non-zero error code for a command |
from open_ialarm_mk_local_api import IAlarmMkConnectionError, IAlarmMkLoginError
try:
async with IAlarmMkClient("192.168.1.100", 8000, "admin", "pass") as client:
await client.arm_away()
except IAlarmMkLoginError:
print("Wrong credentials")
except IAlarmMkConnectionError as e:
print(f"Connection failed: {e}")
Examples
Run any example directly from the repo root (no install needed):
python3 examples/get_status.py --host 192.168.1.100 --user admin --password password
python3 examples/arm_away.py --host 192.168.1.100 --user admin --password password arm-partial
python3 examples/subscribe_events.py --host 192.168.1.100 --user admin
Integration test against a real panel
python3 examples/integration_test.py --host 192.168.1.100 --user admin --password password
# skip arm/disarm on a live production panel:
python3 examples/integration_test.py --host 192.168.1.100 --user admin --password password --skip-arm
Testing
python -m pytest tests/
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
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 open_ialarm_mk_local_api-1.0.0.tar.gz.
File metadata
- Download URL: open_ialarm_mk_local_api-1.0.0.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d6eb283c25895759f831eb96c941f51a3f92b7dc5182012fbd2ac7de033679d
|
|
| MD5 |
7650c2a5a37215b320391967bb838cc8
|
|
| BLAKE2b-256 |
ea3755636cd170e69afb28755b9d13ef19a67029cf4d6046c5f336c60e4cb8af
|
Provenance
The following attestation bundles were made for open_ialarm_mk_local_api-1.0.0.tar.gz:
Publisher:
publish.yml on VoidElle/open-ialarm-mk-local-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_ialarm_mk_local_api-1.0.0.tar.gz -
Subject digest:
1d6eb283c25895759f831eb96c941f51a3f92b7dc5182012fbd2ac7de033679d - Sigstore transparency entry: 1744864370
- Sigstore integration time:
-
Permalink:
VoidElle/open-ialarm-mk-local-api@d7f98aabdc367c7d48e8dc800ac8d2bcc4a150b9 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/VoidElle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d7f98aabdc367c7d48e8dc800ac8d2bcc4a150b9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file open_ialarm_mk_local_api-1.0.0-py3-none-any.whl.
File metadata
- Download URL: open_ialarm_mk_local_api-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22857660d457d54e88ab5d31fb596dd208d893c4d4d1b791d04830f17e444abf
|
|
| MD5 |
c8601bdf611877ce76908159bbb30a1e
|
|
| BLAKE2b-256 |
67a1a3c19c25481659b6b3a985b9906d16c3db51a4beb4d50b4ac54970779af6
|
Provenance
The following attestation bundles were made for open_ialarm_mk_local_api-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on VoidElle/open-ialarm-mk-local-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_ialarm_mk_local_api-1.0.0-py3-none-any.whl -
Subject digest:
22857660d457d54e88ab5d31fb596dd208d893c4d4d1b791d04830f17e444abf - Sigstore transparency entry: 1744864439
- Sigstore integration time:
-
Permalink:
VoidElle/open-ialarm-mk-local-api@d7f98aabdc367c7d48e8dc800ac8d2bcc4a150b9 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/VoidElle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d7f98aabdc367c7d48e8dc800ac8d2bcc4a150b9 -
Trigger Event:
release
-
Statement type: