Skip to content
davidedmundsonPublic

About

Linux (KDE?) integration for Home Assistant via MQTT

Resources

Stars

340 stars

Watchers

11 watching

Forks

Repository files navigation

Kiot - KDE Internet Of Things

Navigation

About

Kiot (KDE Internet Of Things) is a background daemon that exposes useful information and actions from your local desktop session to a home automation controller like Home Assistant.

Important: Kiot does not directly control smart home devices. Instead, it exposes desktop state information to your home automation controller, allowing you to create automations there. For example:

  • If you want a light to turn on when your PC enters "Do Not Disturb" mode, Kiot exposes the "Do Not Disturb" state to Home Assistant, where you can create the automation to control the light.

Maintainers

  • David Edmundson
  • Odd Østlie

Current State

This is pre-alpha software suitable for users comfortable with:

  • Compiling software from source
  • Editing configuration files manually
  • Testing early-stage software

Setup

Recommended Setup (Helper Script)

The fastest way to install dependencies and build Kiot is using the interactive helper menu:

chmod +x helper.sh
./helper.sh

Dependencies

Ensure you have these packages installed:

  • cmake
  • extra-cmake-modules
  • qt6-base or qt6-base-dev
  • qt6-mqtt or qt6-mqtt-dev
  • bluez-qt or libkf6bluezqt-dev
  • pulseaudio-qt or libkf6pulseaudioqt-dev

Note: Package names may vary slightly depending on your Linux distribution. If packages aren't available through your package manager, you may need to install them manually.

Download and Install

  1. Clone the repository:

    git clone https://github.com/davidedmundson/kiot.git
    cd kiot
  2. Build and install:

    mkdir build
    cd build
    cmake ..
    make
    sudo make install  # May require sudo privileges
  3. If you encounter missing dependencies during the build process, install them using your distribution's package manager.

Configuration

MQTT Configuration

Home Assistant must have MQTT server enabled. See the Home Assistant MQTT documentation.

Create a configuration file at ~/.config/kiotrc with the following content:

[general]
host=some.host
port=1883
user=myUsername
password=myPassword

Note

If Kiot is running and you change the configuration, you must restart Kiot for changes to take effect.

Home Assistant Managed MQTT

  • host: Your Home Assistant local address
  • port: 1883 (default)
  • user and password: Credentials of a Home Assistant user (recommended to create a dedicated MQTT user)

Home Assistant Container

  • host: IP address where the MQTT broker is accessible
  • port: 1883 (default)
  • user and password: Credentials configured for your MQTT broker

On the Home Assistant side, everything should work automatically with MQTT discovery. After configuring Kiot, try rebooting Home Assistant, then launch the kiot program to see if everything connects properly.

Configuration Examples

More in depth examples can be found here examples

Basic Configuration

[general]
host=192.168.1.100
port=1883
user=mqtt_user
password=secure_password
tls=false
autostart=false 
discoveryprefix=homeassistant #For auto device detection in home assistant use default 

Scripts Configuration

[Scripts][launch_chrome]
Name=Launch Chrome
Exec=google-chrome

[Scripts][steam_bigpicture]
Exec=steam steam://open/bigpicture
Name=Launch steam bigpicture

[Scripts][youtube_studio]
Exec=brave  --new-window  "https://studio.youtube.com"
Name=Launch YoutubeStudio
icon=mdi:youtube-studio
#icon is optional, defaults to "mdi:script-text" if not set

Shortcuts Configuration

[Shortcuts][myShortcut1]
Name=Do a thing
# Becomes available in KDE's Global Shortcuts KCM for key assignment
# Appears as a trigger in Home Assistant for keyboard-driven automations

Custom sensors configuration

[CustomSensors][gpu_power]
name=Gpu power draw
command=nvidia-smi -q -d POWER | grep "Instantaneous Power Draw" -m 1 | cut -d':' -f2 | cut -d' ' -f2
device_class=power
# Interval syntax is like the systemd time span syntax (man systemd.time).
# NOTE: Some units are deliberately not supported (microseconds, milliseconds, weeks, months, years).
# NOTE: Only whitespace-delimited style is supported (e.g. "1m 30s", not "1m30s").
# Examples: "10s", "1m 30s", "2h". A bare number is in seconds. Defaults is 10s.
interval=10s
state_class=measurement
unit_of_measurement=W

[CustomSensors][cpu_power]
name=Cpu power draw
command=bash -c 'F=/sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj; E1=$(cat $F); sleep 1; E2=$(cat $F); awk "BEGIN {print ($E2 - $E1) / 1000000}"'
device_class=power
interval=1m 30s
state_class=measurement
unit_of_measurement=W

Integration Management

[Integrations]
# This section is auto-generated and lets you enable/disable integrations
AccentColour=true
Active=true
ActiveWindow=true
Audio=true
Battery=true
Bluetooth=true
CameraWatcher=true
DnD=true
Gamepad=true
LockedState=true
Nightmode=true
Notifications=true
PowerController=true
Scripts=true
Shortcuts=true
Docker=true
AppLauncher=true
MPRISPlayer=true

Supported Features

Plugins

Feature Entity Type Description
User Activity Binary Sensor Detects when user is active/inactive
Locked State Lock Screen lock state monitoring and control
Power Control Button Suspend, hibernate, power off, and restart
Camera Activity Binary Sensor Detects when camera is in use
Accent Colour Sensor Current desktop accent color
Shortcuts Select + Device Trigger Register custom shortcuts for HA automations AND trigger any Global shortcut via DBus
Night Mode Binary Sensor Night mode/blue light filter status
Active Window Sensor Currently focused application window
Audio Controller Number + Select Volume control and device/app selection
Battery Status Sensor Battery charge level and attributes
Do Not Disturb Binary Sensor DnD mode status
Gamepad Connected Binary Sensor Gamepad/joystick connection detection
Scripts Button Execute custom scripts
Bluetooth Switch Bluetooth adapter control and device connection management
Applauncher Select Launch applications from HA, scans for installed apps
CustomSensors Sensor Custom sensor integration with output from terminal command
Docker Switch Docker container control and status as attributes
MPRIS Media Player MPRIS media player control Custom Integration
Game Launcher Select Game launcher for steam/heroic/lutris/Faugus games
Notifications Notify Send notifications to KDE via MQTT
SystemD Switch Systemd user service control
DisplayManager Number, Select, Switch Screen control and management
Macro executor Notify Execute macros from HA via virtual keyboard README

Experimental Plugins

So let me start with saying experimental plugins are not included in the normal build and must be compiled by you. check the folder for more info Experimental

Feature Entity Type Description
SendSpin None Turn your KDE session into a smart speaker for music assistant

Flatpak Build

Flatpak installation is also supported:

Quick Build

Run

chmod +x helper.sh
./helper.sh

Then select option 3 (Flatpak build and install menu). In the next menu select option 1 (Build and Install as user)

Or you can directly execute:

./scripts/flatpak.sh

Manual build

  1. Clone this repository
  2. Run:
    flatpak-builder build .flatpak-manifest.yaml --user --install --force-clean
    This builds and installs Kiot as a Flatpak, automatically fetching all dependencies.

Flatpak Notes

  • The Flatpak version does not autostart automatically
  • Some integrations may have limited functionality due to Flatpak sandboxing
  • Log files are stored within the Flatpak sandbox

Future Development

Long-term, Flatpak distribution is the primary focus. The goal is to publish to Flathub once a user interface is implemented.

Planned Improvements

  1. Better Documentation - Needs to be updated for the new modular setup

Project Structure

As part of the modular rewrite of Kiot, the repository is organized into distinct, well-documented directories:

  • Core (core/) – Contains the main binary logic, entry point, appdata/metadata generation, and custom logging.

  • Shared (Shared/) – Shared utility classes (PlatformHelper, DBusProperty) and foundational elements.

    • Entities (Shared/entities/) – Core entity implementations required by all integrations to build and communicate with Home Assistant via MQTT.
  • Plugins (Plugins/) – Some information about the plugins that Kiot supports.

  • Examples (examples/) – Detailed configuration files and inspiration.

Contributing

Contributions are welcome!

  1. Test thoroughly
  2. Document new integrations
  3. Follow existing entity patterns

Troubleshooting

Common Issues

  1. MQTT Connection Failed: Verify credentials and network connectivity
  2. Missing Entities in Home Assistant: Check MQTT discovery is enabled in HA
  3. Permission Errors: Some integrations may require additional permissions
  4. Flatpak Limitations: Some system integrations may not work in sandboxed environment

Getting Help

  • Check the configuration examples above, or for more in depth examples go here examples
  • Review the Home Assistant MQTT documentation
  • Examine system logs for error messages

See Also


About

Linux (KDE?) integration for Home Assistant via MQTT

Resources

Stars

340 stars

Watchers

11 watching

Forks

Releases

Packages

Contributors

Languages