Compare commits
2 Commits
master
..
8ec0178c34
| Author | SHA1 | Date | |
|---|---|---|---|
|
8ec0178c34
|
|||
|
300ad171ef
|
@@ -1,5 +1,2 @@
|
|||||||
[env]
|
[env]
|
||||||
RUST_LOG = "automation=debug"
|
RUST_LOG = "automation=debug"
|
||||||
|
|
||||||
[target.x86_64-unknown-linux-musl]
|
|
||||||
rustflags = ["-C", "link-arg=-lc"]
|
|
||||||
|
|||||||
@@ -2,5 +2,3 @@
|
|||||||
.env
|
.env
|
||||||
# Use the rust environment provided by the container
|
# Use the rust environment provided by the container
|
||||||
rust-toolchain.toml
|
rust-toolchain.toml
|
||||||
Dockerfile
|
|
||||||
docker-bake.hcl
|
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ jobs:
|
|||||||
-e AUTOMATION__SECRETS__MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} \
|
-e AUTOMATION__SECRETS__MQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} \
|
||||||
-e AUTOMATION__SECRETS__HUE_TOKEN=${{ secrets.HUE_TOKEN }} \
|
-e AUTOMATION__SECRETS__HUE_TOKEN=${{ secrets.HUE_TOKEN }} \
|
||||||
-e AUTOMATION__SECRETS__NTFY_TOPIC=${{ secrets.NTFY_TOPIC }} \
|
-e AUTOMATION__SECRETS__NTFY_TOPIC=${{ secrets.NTFY_TOPIC }} \
|
||||||
-e AUTOMATION__SECRETS__PRINTER_DEVICE_ID=${{ secrets.PRINTER_DEVICE_ID }} \
|
|
||||||
-e AUTOMATION__SECRETS__PRINTER_ACCESS_CODE=${{ secrets.PRINTER_ACCESS_CODE }} \
|
|
||||||
$(echo ${{ toJSON(needs.build.outputs.images) }} | jq .automation -r)
|
$(echo ${{ toJSON(needs.build.outputs.images) }} | jq .automation -r)
|
||||||
|
|
||||||
docker network connect web automation_rs
|
docker network connect web automation_rs
|
||||||
|
|||||||
+3
-4
@@ -1,4 +1,5 @@
|
|||||||
FROM rust:1.95-alpine AS base
|
FROM rust:1.95 AS base
|
||||||
|
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
|
||||||
RUN cargo install cargo-chef --locked --version 0.1.71 && \
|
RUN cargo install cargo-chef --locked --version 0.1.71 && \
|
||||||
cargo install cargo-auditable --locked --version 0.6.6
|
cargo install cargo-auditable --locked --version 0.6.6
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -9,7 +10,6 @@ COPY . .
|
|||||||
RUN cargo chef prepare --recipe-path recipe.json
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
RUN apk add --no-cache g++=15.2.0-r2 cmake=4.1.3-r0 make=4.4.1-r3 openssl-dev=3.5.7-r0 openssl-libs-static=3.5.7-r0
|
|
||||||
# HACK: Now we can use unstable feature while on stable rust!
|
# HACK: Now we can use unstable feature while on stable rust!
|
||||||
ENV RUSTC_BOOTSTRAP=1
|
ENV RUSTC_BOOTSTRAP=1
|
||||||
COPY --from=planner /app/recipe.json recipe.json
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
@@ -20,8 +20,7 @@ ARG RELEASE_VERSION
|
|||||||
ENV RELEASE_VERSION=${RELEASE_VERSION}
|
ENV RELEASE_VERSION=${RELEASE_VERSION}
|
||||||
RUN cargo auditable build --release
|
RUN cargo auditable build --release
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/cc-debian13:nonroot AS runtime
|
||||||
FROM gcr.io/distroless/static-debian13:nonroot AS runtime
|
|
||||||
COPY --from=builder /app/target/release/automation /app/automation
|
COPY --from=builder /app/target/release/automation /app/automation
|
||||||
ENV AUTOMATION__ENTRYPOINT=/app/config/config.lua
|
ENV AUTOMATION__ENTRYPOINT=/app/config/config.lua
|
||||||
ENV LUA_PATH="/app/?.lua;;"
|
ENV LUA_PATH="/app/?.lua;;"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use bambulab::{Command, Message};
|
|||||||
use google_home::errors::{self};
|
use google_home::errors::{self};
|
||||||
use google_home::traits::OnOff;
|
use google_home::traits::OnOff;
|
||||||
use lua_typed::Typed;
|
use lua_typed::Typed;
|
||||||
use tracing::{debug, trace};
|
use tracing::trace;
|
||||||
|
|
||||||
use crate::{DebugWrap, LuaDeviceCreate};
|
use crate::{DebugWrap, LuaDeviceCreate};
|
||||||
|
|
||||||
@@ -104,7 +104,6 @@ impl LuaDeviceCreate for Bambu {
|
|||||||
bambu.config.callbacks.state.call(bambu.clone()).await;
|
bambu.config.callbacks.state.call(bambu.clone()).await;
|
||||||
}
|
}
|
||||||
Message::Connected => {
|
Message::Connected => {
|
||||||
debug!(id = bambu.config.device_id, "Connected");
|
|
||||||
client.publish(Command::PushAll).await.unwrap();
|
client.publish(Command::PushAll).await.unwrap();
|
||||||
|
|
||||||
bambu.config.callbacks.connected.call(bambu.clone()).await;
|
bambu.config.callbacks.connected.call(bambu.clone()).await;
|
||||||
|
|||||||
+2
-2
@@ -10,12 +10,12 @@ return {
|
|||||||
openid_url = "https://login.huizinga.dev/api/oidc",
|
openid_url = "https://login.huizinga.dev/api/oidc",
|
||||||
},
|
},
|
||||||
mqtt = {
|
mqtt = {
|
||||||
host = ((host == "zeus" or host == "hephaestus") and "olympus.huizinga.lan") or "mosquitto",
|
host = ((host == "zeus" or host == "hephaestus") and "olympus.lan.huizinga.dev") or "mosquitto",
|
||||||
port = 8883,
|
port = 8883,
|
||||||
client_name = "automation-" .. host,
|
client_name = "automation-" .. host,
|
||||||
username = "mqtt",
|
username = "mqtt",
|
||||||
password = secrets.mqtt_password,
|
password = secrets.mqtt_password,
|
||||||
tls = false,
|
tls = host == "zeus" or host == "hephaestus",
|
||||||
},
|
},
|
||||||
modules = {
|
modules = {
|
||||||
require("config.battery"),
|
require("config.battery"),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function module.setup(mqtt_client)
|
|||||||
local light = nil
|
local light = nil
|
||||||
|
|
||||||
local bambu = devices.Bambu.new({
|
local bambu = devices.Bambu.new({
|
||||||
host = "10.0.0.108",
|
host = "thalia.huizinga.lan",
|
||||||
device_id = secrets.printer_device_id,
|
device_id = secrets.printer_device_id,
|
||||||
access_code = secrets.printer_access_code,
|
access_code = secrets.printer_access_code,
|
||||||
callbacks = {
|
callbacks = {
|
||||||
|
|||||||
+1
-3
@@ -5,9 +5,7 @@ group "default" {
|
|||||||
targets = ["automation"]
|
targets = ["automation"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "docker-metadata-action" {
|
target "docker-metadata-action" {}
|
||||||
tags = []
|
|
||||||
}
|
|
||||||
|
|
||||||
target "automation" {
|
target "automation" {
|
||||||
inherits = ["docker-metadata-action"]
|
inherits = ["docker-metadata-action"]
|
||||||
|
|||||||
Reference in New Issue
Block a user