Hi there, sorry if this has been already covered, I have just create a set of entities to take control over services and daemons on my Pi4 server.
Basically it is just a wrapper to systemctl start, stop and status using command_line switches:
switch:
- platform: command_line
scan_interval: 180
switches:
kodi:
command_on: 'sudo systemctl start kodi'
command_off: 'sudo systemctl stop kodi'
command_state: 'systemctl is-active kodi'
value_template: '{{ value == "active" }}'
transmission_daemon:
command_on: 'sudo systemctl start transmission-daemon'
command_off: 'sudo systemctl stop transmission-daemon'
command_state: 'systemctl is-active transmission-daemon'
value_template: '{{ value == "active" }}'
motion:
command_on: 'sudo systemctl start motion'
command_off: 'sudo systemctl stop motion'
command_state: 'systemctl is-active motion'
value_template: '{{ value == "active" }}'
pure_ftpd:
command_on: 'sudo systemctl start pure-ftpd'
command_off: 'sudo systemctl stop pure-ftpd'
command_state: 'systemctl is-active pure-ftpd'
value_template: '{{ value == "active" }}'
And here you have the simplest result in lovelace:
I am pretty sure there are more elegant ways to achieve same result. May be with a template script?
I can’t wait to hear your comments
Hope this help