Amidst the mists and fiercest frosts,
with stoutest wrists and loudest boasts,
He thrusts his fists against the posts,
And still insists he sees the ghosts.
Kaithem is Linux home/commercial automation server written in pure Python(3.10 and up). Not tested outside of Linux. Resource usage is low enough to run well on the Raspberry Pi.
You automate things by directly writing python and HTML via a web IDE, or by using the built-in Chandler module, which is a full web-based lighting aud audio control board with a visual programming language adding interactivity.
The careful text-books measure
(Let all who build beware!)
The load, the shock, the pressure
Material can bear.
git clone --depth 1 https://github.com/EternityForest/KaithemAutomation
cd KaithemAutomation
Now you have the repo cloned, all the relevant commands are in the Makefile. This is an interpreted package, and we use Poetry and pipx, but we also use Make just to keep commands in one handy place.
Many of these have to do with audio features, not all are needed. See Makefile for what is actually installed. This also installs virtualenv support.
It installs the full suite of GStreamer plugins, and OpenCV for NVR object detection, so it's a bit heavy.
make root-install-system-dependencies
Skip this if you already have them!
# pipx is a wonderful tool that installs
# Applications in virtual environments
# and makes them available on the command line.
sudo apt install pipx
python3 -m pipx ensurepath
# Poetry manages project
# specific virtual environments
pipx install poetry
After doing this, log out and log back into the py. The program doesn't appear in your usable packages until you do that, because Debian strangely enough doesn't have the directory on PATH by default
Now that you have the system dependencies, you should have pipx from your package manager.
cd into the folder you cloned, probably with
cd ~/KaithemAutomation
# This line tells Poetry to put
# it's virtualenv right in the project folder
# Where apps like VS Code will know how to work with it
# If you intend to do any development.
# If you already have a .venv in your folder, it
# May be best to delete it and start over.
poetry config --local virtualenvs.in-project true
# This config setting is needed on many platforms,
# the keyring is not used with Kaithem and on
# some systems enabling it crashes everything.
poetry config --local keyring.enabled false
poetry install -v
# Poetry will run it in the virtualenv
poetry run python dev_run.py
# Hit Ctrl-C to stop. may need to try a few times if there are mamy active threads, or just wait a few.
# On some systems, to use audio mixing
# You may need to run 'sudo make root-use-pipewire-jack'
# And prefix everything that uses JACK with pw-jack
# pw-jack poetry run python dev_run.py
Expect this to take a few minutes. If it gets stuck at Preparing... it is probably not actually stuck and just needs a few. It should only be 15mins max though, at least on a Pi4.
Then visit http://YOUR_PI_ADDRESS:8002/index and log in with your normal Linux username and password.
Most likely it will be http://raspberrypi.local:8002/index if you kept the defaults when installing.
So, when the buckled girder
Lets down the grinding span,
The blame of loss, or murder,
Is laid upon the man.
Not on the Stuff — the Man!
See Wiki Tutorial (https://github.com/EternityForest/KaithemAutomation/wiki/Remote-Access)
Kaithem does not support advanced audio features on anything other than pipewire via the JACK protocol.
Out of the box, JACK apps might not work on Ubuntu. Try:
sudo make root-use-pipewire-jack
And then rebooting. In theory you can just restart the services, but it seems to need a reboot to take effect.
This will make ALL jack apps go through pipewire, you won't ever need to launch jackd. I'm not sure why you would ever want to use the original JACK server, so this shouldn't cause any issues.
Unfortunately, it doesn't work on pi, you'll need to prefix stuff that should use jack with pw-jack.
pw-jack poetry run python dev_run.py
Kaithem's installer does this automatically when you use
Some systems like to set volume to 40% at boot, at the ALSA mixer level. Try:
make user-max-volume-at-boot
as whatever user you plan to run kaithem under.
You can also try setting volume to full and storing it
amixer set Master 100%
sudo alsactl store
You might not have pipewire configured correctly. The pi default config seems to set the buffer too low.
Update kaithem and run make user-set-global-pipewire-conf
as the user that will be doing this stuff, to get some reasonable defaults. nano ~/.config/pipewire/pipewire.conf
to tweak further.
To run as a systemd user service(Runs as soon as you log in or the desktop/kiosk starts) Expect the command to take about 15 minutes.
sudo make root-use-pipewire-jack
make user-start-kaithem-at-boot
On a dedicated system, you probably want to disable a buch of stuff the Pi comes with that normally writes to the SD card all the time, disable auto update for most system packages(Assuming you're on a private network), and a few other tweaks.
sudo make root-install-linux-tweaks
sudo make root-install-sd-protection
Info for devs here on the wiki (https://github.com/EternityForest/KaithemAutomation/wiki/Development)
Good men, the last wave by, crying how bright
Their frail deeds might have danced in a green bay,
Rage, rage against the dying of the light.
(See Full Changelog)