SystemCtl and daemon panel

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:
image

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 :slight_smile:

Hope this help

2 Likes

With icons to get a better glance :slight_smile:
image

Would you mind posting the code for the icons?

Nice, I keep meaning to control systemD services with nodered but this way looks better to me. :slight_smile:

Simply choose icons in the material design library and customize your entities.
Mine are here:

homeassistant:
  customize:
    switch.motion:
      icon: mdi:motion-sensor
    switch.kodi:
      icon: mdi:kodi
    switch.rpiplay:
      icon: mdi:apple-airplay
    switch.shairport_sync:
      icon: mdi:ipod
    switch.transmission_daemon:
      icon: mdi:progress-download
    switch.sshd:
      icon: mdi:console
    switch.pure_ftpd:
      icon: mdi:folder-swap
    switch.mosquitto:
      icon: mdi:quality-medium

1 Like