Skip to main content

Apple HomeKit integration for Diagral alarm systems

Project description

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

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

diagralhomekit-0.9.13.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

diagralhomekit-0.9.13-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file diagralhomekit-0.9.13.tar.gz.

File metadata

  • Download URL: diagralhomekit-0.9.13.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for diagralhomekit-0.9.13.tar.gz
Algorithm Hash digest
SHA256 8f9203fb5cabda5f56c043ab34b653ff5d0343b45ece9421ef4db31e91a13b80
MD5 d59ea3b7ee97dca919d37ceb763ca240
BLAKE2b-256 f71558605be36840c6bee4e35a8cddd421fecba944adb587e662102c13eb622b

See more details on using hashes here.

File details

Details for the file diagralhomekit-0.9.13-py3-none-any.whl.

File metadata

File hashes

Hashes for diagralhomekit-0.9.13-py3-none-any.whl
Algorithm Hash digest
SHA256 15a4a268dbd23afaa67b49c53de0b9da039439c3b34f37472c51e1a37b0b939d
MD5 10a4c9b36d571af651fae519d2caeeb8
BLAKE2b-256 73b433051498ebd29d00bb143894a7176650ba2893fa2a03cf981c538f92df9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page