|
|
5 years ago | |
|---|---|---|
| .github | 5 years ago | |
| systemctl_mqtt | 5 years ago | |
| tests | 5 years ago | |
| .dockerignore | 5 years ago | |
| .gitignore | 5 years ago | |
| .isort.cfg | 5 years ago | |
| .pylintrc | 5 years ago | |
| CHANGELOG.md | 5 years ago | |
| COPYING | 5 years ago | |
| Dockerfile | 5 years ago | |
| Pipfile | 5 years ago | |
| Pipfile.lock | 5 years ago | |
| README.md | 5 years ago | |
| docker-apparmor-profile | 5 years ago | |
| docker-compose.yml | 5 years ago | |
| mypy.ini | 5 years ago | |
| setup.py | 5 years ago |
MQTT client triggering shutdown on systemd-based systems
$ pip3 install --user --upgrade systemctl-mqtt
$ systemctl-mqtt --mqtt-host HOSTNAME_OR_IP_ADDRESS
On debian-based systems, dependencies can optionally be installed via:
$ sudo apt-get install --no-install-recommends python3-dbus python3-gi python3-paho-mqtt
Schedule poweroff by sending a MQTT message to topic systemctl/hostname/poweroff.
$ mosquitto_pub -h MQTT_BROKER -t systemctl/hostname/poweroff -n
# https://www.home-assistant.io/docs/mqtt/broker/#configuration-variables
mqtt:
broker: BROKER_HOSTNAME_OR_IP_ADDRESS
# credentials, additional options…
script:
poweroff_raspberry_pi:
sequence:
service: mqtt.publish
data:
topic: systemctl/raspberrypi/poweroff
homeassistant:
customize:
script.poweroff_raspberry_pi:
friendly_name: poweroff pi
icon: mdi:power
docker-compose.yml.sudo apparmor_parser ./docker-apparmor-profilesudo docker-compose up --buildPre-built docker image are available at https://hub.docker.com/r/fphammerle/systemctl-mqtt/tags
Annotation of signed tags docker/* contains docker image digests: https://github.com/fphammerle/systemctl-mqtt/tags
systemctl-mqtt --mqtt-username me --mqtt-password secret …
# or
systemctl-mqtt --mqtt-username me --mqtt-password-file /var/lib/secrets/mqtt/password …