https://github.com/benleb/automoli-go
💡 Fully automatic light management based on conditions like motion, illuminance, humidity, and other clever features. Completely rewritten in go!
https://github.com/benleb/automoli-go
Last synced: about 1 year ago
JSON representation
💡 Fully automatic light management based on conditions like motion, illuminance, humidity, and other clever features. Completely rewritten in go!
- Host: GitHub
- URL: https://github.com/benleb/automoli-go
- Owner: benleb
- License: mit
- Created: 2024-10-15T11:41:38.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-05T20:47:27.000Z (over 1 year ago)
- Last Synced: 2025-03-01T20:03:39.662Z (over 1 year ago)
- Language: Go
- Size: 173 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [](https://github.com/benleb/automoli-go)
[](https://goreportcard.com/report/github.com/benleb/automoli-go) [](https://pkg.go.dev/github.com/benleb/automoli-go) [](https://github.com/benleb/automoli-go/actions/workflows/build.yml) [](http://unmaintained.tech/)
Fully *automatic light management* based on motion, daytime, brightness and even humidity 💦 🚿
🕓 multiple **daytimes** to define different scenes for morning, noon, ...
💡 supports **Hue** (for Hue Rooms/Groups) & **Home Assistant** scenes
🔌 switches **lights** and **plugs** (with lights)
☀️ supports **illumination sensors** to switch the light just if needed
💦 supports **humidity sensors** as blocker (the "*shower case*")
🔒 **locks** the light if the light was manually turned on
*- successor of the famous original [ad-AutoMoLi](https://github.com/benleb/ad-automoli) (written in Python as [AppDaemon](https://github.com/AppDaemon/appdaemon) plugin/app) -*
## install
via [go install](https://go.dev/ref/mod#go-install)
```bash
go install github.com/benleb/automoli-go@latest
```
## run
see the [example config](automoli.yaml) for a multi-room configuration with different daytimes and sensors and settings.
```bash
# run
automoli-go run --config ~/automoli.yaml
# more options
automoli-go --help
```
### systemd service example
this is an **example** how the [systemd service file](automoli.service) can be used for running AutoMoLi as a service.
uuser, group and repo/config directory may need to be adjusted.
```bash
# clone repo
git clone https://github.com/benleb/automoli-go ~/automoli
# create a new user and group for automoli
useradd --system --home-dir /etc/automoli --user-group automoli
# create config directory and set permissions
mkdir /etc/automoli && chown automoli:automoli /etc/automoli
# link or copy the systemd service file
ln -s ~/automoli/automoli.service /etc/systemd/system/automoli.service
```
## build
### single target
```bash
# build for current platform
goreleaser build --clean --snapshot --single-target
# build for specific platform
GOOS="linux" GOARCH="amd64" GOAMD64="v3" goreleaser build --clean --snapshot --single-target
```
### docker image
with [ko](https://ko.build)
```bash
# build image and push to registry
KO_DOCKER_REPO=your.registry.io:5000 ko build --verbose --base-import-paths --tags dev
```
## development
### lint
with [golangci-lint](https://golangci-lint.run)
```bash
# run all linters
golangci-lint run --verbose --enable-all --fix --max-issues-per-linter 0 --max-same-issues 0
```
### tests
```bash
# run tests with coverage
go test -cover ./...
```
### release/tag
vith [goreleaser](https://goreleaser.com) triggered by a git tag
```bash
# create a new annotated tag
git tag -a "vX.Y.Z" -m "short release description vX.Y.Z"
# push tag to trigger the release workflow
git push --follow-tags
```