Created OZWCP systemd unit file

So I got tired of having to stop HASS, start ozwcp, then stop ozwcp and start hass…or even the few times where i did one without doing the other.

I modified the systemd file for HASS and added a conflict directive to look out for my newly created ozwcp systemd file. Now when starting HASS, if ozwcp is running, it will stop ozwcp first. I did the same in the ozwcp systemd file, but I did not enabled ozwcp to start on boot.

Now, all i have to do is systemctl start ozwcp.service or systemctl start home-assistant.service

Below are the systemd unit files, in case anyone wants to use, comment or improve

filename: ozwcp.service

[Unit]
Description=Open ZWave Control Panel
After=network.target
#ensures that home-assistant is not running, if it is, stop it
#replace with the name of your home-assistant systemd file
Conflicts=home-assistant.service

[Service]
Type=simple
#assumes system user homeassistant exists
User=homeassistant
#directory for ozwcp
WorkingDirectory=/srv/homeassistant/src/open-zwave-control-panel
#execution path for ozwcp
ExecStart= /srv/homeassistant/src/open-zwave-control-panel/ozwcp -p 8888

[Install]
WantedBy=multi-user.target

filename: home-assistant.service

[Unit]
Description=Home Assistant
After=network.target
Conflicts=ozwcp.service

[Service]
Type=simple
User=homeassistant
#make sure the virtualenv python binary is used
Environment=VIRTUAL_ENV="/srv/homeassistant"
Environment=PATH="$VIRTUAL_ENV/bin:$PATH"
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"

[Install]
WantedBy=multi-user.target
5 Likes