A simple web page to control a single light.
yagami uses the homeassistant REST API to get the state of the light (on or off), and to toggle the state when the web page is clicked.
The following env vars need to be set:
LIGHT_ID=<home assistant light ID, eg: light.foobar>YAGAMI_TOKEN=<home assistant API token>YAGAMI_PUBLIC_PATH=<path to the directory that contains html file and images>HOME_ASSISTANT_URL=<base URL of home assistant server, eg: 192.168.1.1:8123>
- Rust (https://www.rust-lang.org/tools/install)
- Cargo (comes with Rust)
- Clone this repository
- Run
cargo build --release - The binary will be in the
target/releasedirectory.
You can run yagami locally:
cargo run --releaseA Systemd unit file, yagami.service, is provided to run yagami as a service.
To use it:
- Copy the binary
yagamito/usr/bin/(see Build instructions) - Create an environment file
/var/lib/yagami/yagami.envthat contains the necessary env variables (see Environment variables) - Copy the file
yagami.serviceto/etc/systemd/system/and enable it with:
sudo systemctl daemon-reload
sudo systemctl enable --now yagami.service
