From 3b0cd1e1d3dd1296a6c9ae163bc53db4805bee82 Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 9 Feb 2019 23:19:53 +0100 Subject: ma google-muell: bump to latest version, use new config --- 2configs/homeautomation/google-muell.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to '2configs/homeautomation') diff --git a/2configs/homeautomation/google-muell.nix b/2configs/homeautomation/google-muell.nix index 235cc1546..5870f298d 100644 --- a/2configs/homeautomation/google-muell.nix +++ b/2configs/homeautomation/google-muell.nix @@ -3,13 +3,20 @@ with import ; let pkg = pkgs.ampel; home = "/var/lib/ampel"; - sec = "${toString }/google-muell.json"; + sec = "${toString }/ampel/google-muell.json"; ampelsec = "${home}/google-muell.json"; - cred = "${toString }/google-muell-creds.json"; + cred = "${toString }/ampel/google-muell-creds.json"; # TODO: generate this credential file locally ampelcred = "${home}/google-muell-creds.json"; - esp = "192.168.8.204"; sleepval = "1800"; + default-color = "244,220,66"; + config_json = toFile "config.json" (toJSON { + mq_hostname = "localhost"; + mq_port = 1883; + mq_username = "sensor"; + mq_topic = "/ham/flurlicht/cmnd/MEM1"; + mq_password = replaceChars ["\n"] [""] (readFile "${toString }/mqtt/sensor"); + }); in { users.users.ampel = { uid = genid "ampel"; @@ -27,7 +34,7 @@ in { install -m600 -o ampel ${sec} ${ampelsec} install -m600 -o ampel ${cred} ${ampelcred} ''; - ExecStart = "${pkg}/bin/google-muell --esp=${esp} --client-secrets=${ampelsec} --credential-path=${ampelcred} --sleepval=${sleepval}"; + ExecStart = "${pkg}/bin/google-muell --config ${config_json} --default-color=${default-color} --client-secrets=${ampelsec} --credential-path=${ampelcred} --sleepval=${sleepval}"; PermissionsStartOnly = true; Restart = "always"; RestartSec = 10; -- cgit v1.2.3