1
0
Fork 0

various: update

This commit is contained in:
Daniel Kempkens 2024-09-17 09:02:38 +02:00
parent 5c4e95ccc9
commit 216ac2e318
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
4 changed files with 25 additions and 0 deletions

View file

@ -37,6 +37,7 @@ in
../nixos/uptime-kuma.nix ../nixos/uptime-kuma.nix
../nixos/weewx-proxy.nix ../nixos/weewx-proxy.nix
../nixos/temper.nix
../nixos/container.nix ../nixos/container.nix
]; ];

24
system/nixos/temper.nix Normal file
View file

@ -0,0 +1,24 @@
{ pkgs, ... }:
{
systemd.services.temper-to-home-assistant =
let
script = pkgs.writeScriptBin "temper-to-ha-mqtt" ''
#! ${pkgs.runtimeShell} -e
temp=$(${pkgs.python312Packages.temperusb}/bin/temper-poll -c -s 0)
${pkgs.mosquitto}/bin/mosquitto_pub -h 10.0.0.230 -m "$temp" -t hadata/temper/serverraum -u mqtt_bridge -P verySecurePassword
'';
in
{
description = "Send current temperature reading to HA using MQTT";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
startAt = "*-*-* *:*:00";
serviceConfig = {
Type = "oneshot";
ExecStart = "${script}/bin/temper-to-ha-mqtt";
};
};
}