Home Automation is only useful if it's automatic. So with a proof of concept Python script I needed to turn it into a service. This is pretty easy with systemd. All you need is a "yourservicename.service" file in the /etc/systemd/system folder that calls your script.
Important parts on this are to name the correct user and file location in your service:
[Service] Type=simple User=pi ExecStart=/usr/bin/python3 /home/pi/wemoswitch-to-mqtt/wemo-mqtt-control.py [Install] WantedBy=multi-user.target
Start it with systemctl (protip, you'll want to use systemctl status yourservicename.service to see if it had errors or is running correctly):
systemctl enable mqtt_porchlight.service systemctl start mqtt_porchlight.service
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.