- Python 94.9%
- Dockerfile 5.1%
| lihoaxd | Fix lock update/logging if neither code nor token defined | |
| schema | Update schema | |
| .gitignore | Initial commit | |
| compose.yml | Add compose file | |
| Containerfile | Add metadata labels to container | |
| LICENSE | Initial commit | |
| make_schema.py | Reformat using black | |
| poetry.lock | improve logging and fix group name resolution | |
| pyproject.toml | improve logging and fix group name resolution | |
| README.md | improve logging and fix group name resolution | |
lihoaxd
Management daemon for Linuxhotel Access System
Deployment
Configuration
lihoaxd is configured using environment variables. For now, this requires the
deployment host to be trustworthy, as the environment variables contain secrets.
The following varuables are available:
| Variable | Description | Default |
|---|---|---|
LOGURU_LEVEL |
Log level | DEBUG |
LIHOMA_TOKEN |
API token to retrieve door access codes from Lihoma | |
LIHOAXD_mqtt__server |
Address of MQTT server | 127.0.0.1 |
LIHOAXD_mqtt__port |
MQTT port | 1883 |
LIHOAXD_mqtt__server |
MQTT username | lihoax_manager |
LIHOAXD_mqtt__password |
MQTT password | |
LIHOAXD_mqtt__topic_base |
Base topic for config messages | hotel/locks |
LIHOAXD_mqtt__client_id |
Client ID for manager | lihoaxd |
LIHOAXD_defaults__valid_from_time |
Time of day when access codes become valid | 15:00:00 |
LIHOAXD_defaults__valid_until_time |
Time of day when access codes bevome invalid | 15:00:00 |
LIHOAXD_defaults__code_timeout |
Timeout for keypad code input in seconds | 5 |
LIHOAXD_defaults__code_length |
Maximum length of keypad codes | 5 |
LIHOAXD_defaults__buzzer_time |
Open door buzzer for this time in seconds | 3 |
LIHOAXD_defaults__buzzer_freq |
Frequency of buzzer current | 0 |
LIHOAXD_update__interval |
Interval (in seconds) between lock config updates | 60 |
LIHOAXD_groups__* |
Lock groups (see below) |
Lock groups
Lock groups are aliases to group several locks. Every lock has an identity for which
it will receive individual access codes that should be valid. In addition, access configuration
may be set for groups. The backend (e.g. Lihoma) provides access codes for a group name as if
it were a single lock, and lihoaxd deploys it to all locks in a group.
Lock groups are configured by setting an environment variable with the group name, and a
comma-separated list of locks, like LIHOAXD_groups__seminargast=sauna,glastuer,hotel,seminar.
Container deployment
To deploy from the OCI image, create an environment file (e.g. /etc/default/lihoaxd), then start the container using:
podman run -d --env-file=/etc/default/lihoaxd --restart=unless-stopped codeberg.org/linuxhotel/lihoaxd:latest
Internals
MQTT protocol
In this documentation, hotel/locks is assumed as topic base. This value is
configurable in lihoaxd and lihoax-lock.
For every lock, lihoaxd publishes a configuration containing
the lock id and access codes on hotel/locks/{lock_id}/config.
The payload for the lock config is described in the Lock type
in the lihoaxd JSON schema.
Every lock publishes true on hotel/locks/{lock_id}/state/online when it
connects, and ensures that this state will be correct even in case of an
unexpected disconnect using the last will feature.