Skip to main content

Shutdown with shelly plug 2

I will switch off the "Shelly plu s" after the shutdown of the device.

Create file with nano /usr/lib/systemd/system-shutdown/systemd-halt.service

[Unit]
Description=Run mycommand at shutdown
Requires=network.target
DefaultDependencies=no
Before=shutdown.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=curl -u username:password "http://IP-Address/relay/0?turn=on&timer=30"

[Install]
WantedBy=multi-user.target

After that enable service with systemctl enable /usr/lib/systemd/system-shutdown/systemd-halt.service .