various: update
This commit is contained in:
parent
5c4e95ccc9
commit
216ac2e318
4 changed files with 25 additions and 0 deletions
Binary file not shown.
Binary file not shown.
|
@ -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
24
system/nixos/temper.nix
Normal 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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue