Skip to main content

DiagralHomekit

PyPI version

Allow to control your Diagral alarm systems through Apple Homekit.

First, you need to create a configuration file ~/.diagralhomekit/config.ini with connection details for all Diagral systems.

[diagral:Home]
name=[an explicit name for this system]
login=[email address of the Diagral account]
password=[password for the Diagral account]
imap_login=[IMAP login for the email address receiving alarm alerts]
imap_password=[IMAP password]
imap_hostname=[IMAP server]
imap_port=[IMAP port]
imap_use_tls=[true/1/on if you use SSL for the IMAP connection]
master_code=[a Diagral master code, able to arm or disarm the alarm]
system_id=[system id — see below]
transmitter_id=[transmitter id — see below]
central_id=[central id — see below]

system_id, transmitter_id and central_id can be retrieved with the following command, that prepares a configuration file:

python3 -m diagralhomekit --config-dir ~/.diagralhomekit --create-config 'diagral@account.com:password'

Then you can run the script:

python3 -m diagralhomekit --port 6666 --config-dir ~/.diagralhomekit -v 2

On the first launch, a QR code is displayed and can be scanned in Homekit, like any Homekit-compatible device.

You can send logs to Loki with --loki-url=https://username:password@my.loki.server/loki/api/v1/push. You can also send alerts to Sentry with --sentry-dsn=my_sentry_dsn.

Everything can be configured by environment variables instead of arguments:

DIAGRAL_PORT=6666
DIAGRAL_CONFIG=/etc/diagralhomekit
DIAGRAL_SENTRY_DSN=https://sentry_dsn@sentry.io/42
DIAGRAL_LOKI_URL=https://username:password@my.loki.server/loki/api/v1/push
DIAGRAL_VERBOSITY=1

As many sensitive data must be stored in this configuration file, so you should create a dedicated email address and Diagral account.

Plex sensor

A presence can be detected when a specified Plex player is playing something:

[plex:appletv_web]
server_token=[authentication token]
server_url=[url of your Plex server]
player_name=[Displayed name for the player]
player_device=None,
player_product=[Product name of the targeted player]
player_title=[Title of the targeted player]
player_address=[IP address of the targeted player]

Only one of the last four properties is required to match with the targeted player. To get actual property values, you can use curl:

curl -H Accept:application/json -H X-Plex-Token:[authentication token] [url of your Plex server]/status/sessions

HTTP monitoring

You can monitor some websites, as air purifier sensors (no Homekit sensor is available for HTTP monitoring…):

[internet:website]
url=[url to check]
name=[Displayed name]

Weather monitoring

You can monitor weather, and emulate a presence when it will rain in the next 10 minutes:

[meteofrance:paris]
name=Paris
latitude=48.866667
longitude=2.333333
country=FR
region=Île-de-France

UPS monitoring

UPS can also be monitoring, as soon as NUT is locally installed (standard UPS monitoring server on Linux.

[ups:home]
name=eaton650

Release files for diagralhomekit 0.9.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diagralhomekit 0.9.16
File Size Uploaded
diagralhomekit-0.9.16.tar.gz 25.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diagralhomekit 0.9.16
File Interpreter ABI Platform
diagralhomekit-0.9.16-py3-none-any.whl Python 3 none any Details

Total release size: 60.5 kB

Release files / diagralhomekit-0.9.16.tar.gz

Download URL diagralhomekit-0.9.16.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3310f472e81e40980941b5d01c326a5bfcd4b1e2add68be3124c602dc36d15b4
BLAKE2b-256 checksum
How to use checksums
48f63ce615c969e5012023a31bee731a29da05996cf60a37a42b8f4d1e25ca45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Darwin/24.3.0

Release files / diagralhomekit-0.9.16-py3-none-any.whl

Download URL diagralhomekit-0.9.16-py3-none-any.whl
Size 34.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3cb80481e45466b94e83d7838c7027cce1c3da119bc91036d79fa6a86543decd
BLAKE2b-256 checksum
How to use checksums
4c0a6583865dd372ee4e465c3157aab4c6899a168698c786d74b258c26142e0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Darwin/24.3.0

Release history Release notifications | RSS feed

This release

0.9.16 This release

2 release files

0.9.12

2 release files

0.9.11

2 release files

0.9.10

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page