MQTT client triggering shutdown on systemd-based systems
Project description
systemctl-mqtt
MQTT client triggering shutdown on systemd-based systems
Setup
$ 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-paho-mqtt
Schedule poweroff by sending a MQTT message to topic systemctl/hostname/poweroff
.
$ mosquitto_pub -h MQTT_BROKER -t systemctl/hostname/poweroff -n
Home Assistant 🏡
Sample Setup
# 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 🐳
- Clone this repository.
- Edit
docker-compose.yml
. - Load AppArmor profile:
sudo apparmor_parser ./docker-apparmor-profile
sudo docker-compose up --build
MQTT Authentication
systemctl-mqtt --mqtt-username me --mqtt-password secret …
# or
systemctl-mqtt --mqtt-username me --mqtt-password-file /var/lib/secrets/mqtt/password …
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
systemctl-mqtt-0.1.0.tar.gz
(32.0 kB
view hashes)
Built Distribution
Close
Hashes for systemctl_mqtt-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a32d4610277d4e773ff68b6dd316a4a48c357a0fd8cef25338425cb2f4ae8c5 |
|
MD5 | 88d2b80c177feff73c2d3bd369529e67 |
|
BLAKE2b-256 | 51376f1007c9e3fea2126ba26d682bf509c3e2e5df99f083c1b984b7f747e355 |