LogoLitehouseDocs

Quickstart

Installing and using Litehouse

Litehouse is a lightweight program for home automation. Think of it as a set of rules you define about what should happen when certain triggers are set. For example:

If it is 7am...

Set triggers at arbitrary times or when receiving updates from other sources

Check the weather for rain

Use one of many integrations to popular APIs to fetch arbitrary data

Send me a text message

Pick from a variety of actions to interact with the outside world

Or, alternatively...

If the washing machine power consumption goes below 5W

Integrate with a wide range of home automation hardware

Flash the lights 10 times in the living room

Group together commands into macros and execute them in a fault tolerant way

Litehouse does all these things securely and efficiently. It is designed to use minimal resources allowing it to be run on any hardware. This is achieved by through web-assembly plugins and a custom registry allowing for extremely low idle memory usage, fast startup, unparalleled security, and buzzwords.

Installation

Direct

You can install the server directly onto most OSes with a single command.

Prebuilt

We have pre-built binaries available for windows, macOS and linux. The latest version is v0.3.1. To see more about this release, see here:

github.com
Release v0.3.1 ยท arlyon/litehouse

Install litehouse 0.3.1 Install prebuilt binaries via shell script curl --proto '=https' --tlsv1.2 -LsSf https://github.com/arlyon/litehouse/releases/download/v0.3.1/litehouse-installer.sh | sh Ins...

To install, run one of the commands below. Each of these comes with an update utility as well.

powershell -c "irm https://github.com/arlyon/litehouse/releases/download/v0.3.1/litehouse-installer.ps1 | iex"

Bleeding Edge

Alternatively, you can build the latest bleeding edge version. For this, you need a rust toolchain. Please visit rustup.rs and follow the instructions. Then, you can install litehouse directly from source by specifying the git repo.

Terminal
cargo install --git https://github.com/arlyon/litehouse litehouse

Docker

Getting started with docker is an easy approach if you have docker easily available. The docker image is lightweight, weighing in at 10MB.

Terminal
docker run -d \
    --name litehouse \
    -v /path/to/settings.json:/settings.json \
    -v /path/to/schema.json:/schema.json \
    -v /path/to/wasm:/wasm \
    ghcr.io/arlyon/litehouse:latest

Litehouse Docker Image

For more information on the Litehouse Docker image, have a look at image in the GitHub package registry.

Docker Compose

In fact, to make it a little easier, you can also take advantage of the docker-compose file in the repo.

docker-compose.yaml
version: "3"
services:
  litehouse:
    image: ghcr.io/arlyon/litehouse:latest
    volumes:
      - /path/to/settings.json:/settings.json
      - /path/to/schema.json:/schema.json
      - /path/to/wasm:/wasm

Podman

Good news! The setup is pretty much the same as docker, but with some extra goodies.

Terminal
podman run -d \
    --name litehouse \
    -v /path/to/settings.json:/settings.json \
    -v /path/to/schema.json:/schema.json \
    -v /path/to/wasm:/wasm \
    ghcr.io/arlyon/litehouse:latest

Podman play kube

An alternative to docker-compose is to use a kubernetes definition file.

kube.yaml
apiVersion: v1
kind: Pod
metadata:
  name: litehouse
spec:
  containers:
    - name: server
      image: ghcr.io/arlyon/litehouse:latest
      env:
        - name: RUST_LOG
          value: debug,cranelift_codegen=info,rustls=info,wasmtime=info,wasmtime_cranelift=info
      volumeMounts:
        - mountPath: /settings.json
          name: settings
        - mountPath: /wasm
          name: wasm
  volumes:
    - name: wasm
      hostPath:
        path: /home/arlyon/wasm
        type: DirectoryOrCreate
    - name: settings
      hostPath:
        path: /home/arlyon/settings.json
        type: FileOrCreate

Podman quadlet

Quadlet is a tool built-in in podman that integrates containers into systemd so that their lifecycles are managed in the same way as other services. This way, logs are also routed through the regular OS journal. To set it up, place a kube systemd service file in ~/.config/containers/systemd. This also has the benefit of integrating with podman's auto-update system which will automatically check for updates at a fixed interval and restart the service.

litehouse.kube
[Unit]
Description=Litehouse server
After=local-fs.target
 
[Install]
WantedBy=multi-user.target default.target
 
[Service]
Restart=always
 
[Kube]
Yaml=kube.yaml

Flatcar Linux / coreOS

Combining the kubernetes config and systemd, you can deploy Litehouse on CoreOS or similar systems, using Butane to generate an Ignition configuration file. Here's an example Butane configuration that creates a user, configures ssh access, and uploads all the required files onto the system.

litehouse.bu
variant: fcos
version: 1.4.0
passwd:
  users:
    - name: core
      ssh_authorized_keys:
        - <your ssh key>
      groups:
        - sudo
        - docker
storage:
  files:
    # allow rootless containers to stick around
    - path: /var/lib/systemd/linger/core
    - path: /app/settings.json
      contents:
        local: settings.json
    - path: /var/home/core/.config/containers/systemd/litehouse.kube
      contents:
        local: litehouse.kube
    - path: /var/home/core/.config/containers/systemd/kube.yaml
      contents:
        local: kube.yaml
  directories:
    - path: /app/wasm

To generate the Ignition file, run butane, mounting the folder that the three files are in into the container.

podman run --interactive -v ~/:/folder --rm quay.io/coreos/butane:release \
    --pretty --strict -d /folder < litehouse.bu > config.ign

Learn more

To learn more about the podman ecosystem, see below.

App

Coming soon...

We would also like to bring a desktop app into the mix. This would allow you to run litehouse on your laptop with a handy management UI built in.


Is this something you want?

Getting Set Up

We recommend running litehouse in its own folder, since it needs a few files out of the box. To start, let's run a few commands.

Terminal
litehouse init
litehouse search tasmota
tasmota@0.1.0
tasmota@0.1.1
tasmota@0.1.2
litehouse add tasmota@0.1.2
litehouse generate

You will now notice a set of files in your folder.

tasmota@0.1.2.wasm
schema.json
settings.json
  • the schema.json file is generated by litehouse to provide intellisense when editing your settings.json file
  • the settings.json file is where you define which plugins to use and how
  • the wasm folder contains the downloaded plugins

Let's add a plugin instance!

settings.json
{
  "$schema": "schema.json",
  "plugins": {
+  "light": {
+    "plugin": "tasmota@0.1.2",
+    "config": {
+      "ip": [192,168,1,10]
+    }
+  }
  },
  "imports": [
    "tasmota@0.1.2"
  ]
}

Notice that as you type, your editor knows what plugins are available, and what the config for that plugin is. No more invalid yaml! Let's make sure that we have everything right.

Terminal
litehouse validate
litehouse run

Congrats! You have just run your first litehouse instance.

What is Next?

On this page

Edit on Github