Skip to content

Home Assistant component for managing systemd services

Notifications You must be signed in to change notification settings

dmamontov/hass-systemd-manager

Repository files navigation

Systemd Manager for Home Assistant

hacs_badge donate paypal donate tinkoff

The component allows you to manage systemd services via D-Bus

Table of Contents

Prerequisites

Ubuntu

  1. This component uses D-Bus to control systemd. You need to have D-Bus itself and its python bindings in order to use this component:
sudo apt install dbus libdbus-glib-1-dev libdbus-1-dev python-dbus
  1. You also need to set up a polkit rule so that your user can control systemd via D-Bus. To do this, run the command and paste the content:
sudo nano /etc/polkit-1/localauthority/50-local.d/systemd-manager.pkla
[Allow user systemd-manager to execute systemctl commands]
Identity=unix-user:<your user from which hass is executed.>
Action=org.freedesktop.systemd1.manage-units
ResultAny=yes

Other

Not yet tested

Install

Installed through the custom repository HACS - dmamontov/hass-systemd-manager

Or by copying the systemd_manager folder from the latest release to the custom_components folder (create if necessary) of the configs directory.

Config

Via GUI (Only)

Settings > Integrations > Plus > Systemd Manager

All you have to do is select the systemd services you want to manage.

Warnings

  1. Only one configuration is allowed;
  2. Do not select all services, this increases the load on the processor, especially D-Bus;

Advanced config

To get the status of the services, the component requests the status of the services every 10 seconds. This value can be changed in the component's settings.

Services

All services support only entity_id.

Mode detail

start

service: systemd_manager.start
data:
  mode: REPLACE # One of REPLACE, FAIL, ISOLATE, IGNORE_DEPENDENCIES, IGNORE_REQUIREMENTS
target:
  entity_id: switch.systemd_...

stop

service: systemd_manager.stop
data:
  mode: REPLACE # One of REPLACE, FAIL, IGNORE_DEPENDENCIES, IGNORE_REQUIREMENTS
target:
  entity_id: switch.systemd_...

restart

service: systemd_manager.restart
data:
  mode: REPLACE # One of REPLACE, FAIL, IGNORE_DEPENDENCIES, IGNORE_REQUIREMENTS
target:
  entity_id: switch.systemd_...

enable

service: systemd_manager.enable
target:
  entity_id: switch.systemd_...

disable

service: systemd_manager.disable
target:
  entity_id: switch.systemd_...

Performance table

  1. Install Flex Table from HACS
  2. Add new Lovelace tab with Panel Mode
  3. Add new Lovelace card:

About

Home Assistant component for managing systemd services

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages