From 060a8f28fa1fc648bdf66afb31a5d1efac868837 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 28 Jul 2023 22:24:15 +0200 Subject: makefu: move out to own repo, add vacation-note --- makefu/2configs/stats/telegraf/airsensor.nix | 49 ------------------ makefu/2configs/stats/telegraf/bamstats.nix | 35 ------------- makefu/2configs/stats/telegraf/default.nix | 30 ----------- makefu/2configs/stats/telegraf/europastats.nix | 43 ---------------- makefu/2configs/stats/telegraf/hamstats.nix | 69 -------------------------- 5 files changed, 226 deletions(-) delete mode 100644 makefu/2configs/stats/telegraf/airsensor.nix delete mode 100644 makefu/2configs/stats/telegraf/bamstats.nix delete mode 100644 makefu/2configs/stats/telegraf/default.nix delete mode 100644 makefu/2configs/stats/telegraf/europastats.nix delete mode 100644 makefu/2configs/stats/telegraf/hamstats.nix (limited to 'makefu/2configs/stats/telegraf') diff --git a/makefu/2configs/stats/telegraf/airsensor.nix b/makefu/2configs/stats/telegraf/airsensor.nix deleted file mode 100644 index 9d481000f..000000000 --- a/makefu/2configs/stats/telegraf/airsensor.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ pkgs, ...}: -let - genTopic = name: topic: tags: { - servers = [ "tcp://localhost:1883" ]; - qos = 0; - connection_timeout = "30s"; - topics = [ topic ]; - tags = tags; - persistent_session = false; - name_override = name; - data_format = "value"; - data_type = "float"; - }; - bamStat = stat: # Temperature or Humidity - host: # easy{1-4} - sensor: # dht11, dht22, ds18 - (genTopic stat - "/bam/${host}/${sensor}/${stat}" - {"host" = host; - "scope" = "bam"; - "sensor" = sensor; - } ); - dht22 = host: [(bamStat "Temperature" host "dht22") - (bamStat "Humidity" host "dht22")]; - dht11 = host: [(bamStat "Temperature" host "dht11") - (bamStat "Humidity" host "dht11")]; - ds18 = host: [(bamStat "Temperature" host "ds18")]; -in { - services.udev.extraRules = '' - SUBSYSTEMS=="usb", ATTRS{product}=="iAQ Stick", GROUP="input" - ''; - users.users.telegraf.extraGroups = [ "input" ]; - services.telegraf.extraConfig.inputs.exec = [ - { - commands = [ "${pkgs.airsensor-py}/bin/airsensor-py"]; - timeout = "10s"; - data_format = "value"; - data_type = "integer"; - name_override = "airquality"; - interval = "10s"; - tags.unit="VOC"; - } - ]; - services.telegraf.extraConfig.inputs.mqtt_consumer = - (dht22 "easy1") - ++ (dht22 "easy2") - ++ (dht11 "easy3") - ++ (ds18 "easy3"); -} diff --git a/makefu/2configs/stats/telegraf/bamstats.nix b/makefu/2configs/stats/telegraf/bamstats.nix deleted file mode 100644 index ae5301204..000000000 --- a/makefu/2configs/stats/telegraf/bamstats.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ pkgs, ...}: - -let - genTopic = name: topic: tags: { - servers = [ "tcp://localhost:1883" ]; - qos = 0; - connection_timeout = "30s"; - topics = [ topic ]; - tags = tags; - persistent_session = false; - name_override = name; - data_format = "value"; - data_type = "float"; - }; - bamStat = stat: # Temperature or Humidity - host: # easy{1-4} - sensor: # dht11, dht22, ds18 - (genTopic stat - "/bam/${host}/${sensor}/${stat}" - {"host" = host; - "scope" = "bam"; - "sensor" = sensor; - } ); - dht22 = host: [(bamStat "Temperature" host "dht22") - (bamStat "Humidity" host "dht22")]; - dht11 = host: [(bamStat "Temperature" host "dht11") - (bamStat "Humidity" host "dht11")]; - ds18 = host: [(bamStat "Temperature" host "ds18")]; -in { - services.telegraf.extraConfig.inputs.mqtt_consumer = - (dht22 "easy1") - ++ (dht22 "easy2") - ++ (dht11 "easy3") - ++ (ds18 "easy3"); -} diff --git a/makefu/2configs/stats/telegraf/default.nix b/makefu/2configs/stats/telegraf/default.nix deleted file mode 100644 index 941685695..000000000 --- a/makefu/2configs/stats/telegraf/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{...}: -let - url = "http://localhost:8086"; - mqtt_server = "localhost:1883"; -in { - services.telegraf = { - enable = true; - extraConfig = { - agent.debug = false; - outputs = { - influxdb = [{ - urls = [ url ]; - database = "telegraf"; - }]; - #file = [{ # debugging - # files = [ "stdout" ]; - # data_format = "influx"; - #}]; - - mqtt = [{ - servers = [ mqtt_server ]; - topic_prefix = "/telegraf"; - data_format = "json"; - qos = 0; - batch = false; - }]; - }; - }; - }; -} diff --git a/makefu/2configs/stats/telegraf/europastats.nix b/makefu/2configs/stats/telegraf/europastats.nix deleted file mode 100644 index 2ab62766a..000000000 --- a/makefu/2configs/stats/telegraf/europastats.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ pkgs, ...}: -let - pkg = with pkgs.python3Packages;buildPythonPackage rec { - rev = "be31da7"; - name = "europastats-${rev}"; - propagatedBuildInputs = [ - requests - docopt - ]; - src = pkgs.fetchgit { - url = "http://cgit.euer.krebsco.de/europastats"; - inherit rev; - sha256 = "0qj18vgj9nm6aisyqhk3iz3rf8xp7mn5jc6sfylcaw588a9sjfvc"; - }; - }; -in { - services.telegraf.extraConfig.inputs.exec = [ - { - commands = [ "${pkg}/bin/europa-attractions"]; - timeout = "1m"; - data_format = "json"; - name_override = "europawaiting"; - interval = "1m"; - tag_keys = [ - "status" - "type" - "name" - ]; - } - { - commands = [ "${pkg}/bin/europa-weather"]; - timeout = "20s"; - data_format = "json"; - name_override = "europaweather"; - interval = "10m"; - tag_keys = [ - "type" - "name" - "offset" - ]; - } - ]; -} diff --git a/makefu/2configs/stats/telegraf/hamstats.nix b/makefu/2configs/stats/telegraf/hamstats.nix deleted file mode 100644 index 99cb0cd04..000000000 --- a/makefu/2configs/stats/telegraf/hamstats.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ pkgs, lib, ...}: - -let - genTopic_zigbee = name: tags: { - servers = [ "tcp://localhost:1883" ]; - username = "stats"; - password = lib.removeSuffix "\n" (builtins.readFile ); - qos = 0; - connection_timeout = "30s"; - topics = [ "/ham/zigbee/${name}" ]; - inherit tags; - persistent_session = false; - name_override = "zigbee ${tags.room} ${name}"; - data_format = "json"; - json_string_fields = [ "linkquality" "temperature" "humidity" "pressure" "battery" "contact" ]; - # json_name_key = - - }; - genTopic_plain = name: topic: tags: { - servers = [ "tcp://localhost:1883" ]; - username = "stats"; - password = lib.removeSuffix "\n" (builtins.readFile ); - qos = 0; - connection_timeout = "30s"; - topics = [ topic ]; - inherit tags; - persistent_session = false; - name_override = tags.sensor; - data_type = "float"; - data_format = "value"; - # json_query = tags.sensor; #TODO? - }; - flycounter = name: - (genTopic_plain name ''/ham/flycounter/${name}'' - { inherit name; - "sensor" = name; - "type" = "gauge"; - "scope" = "ham"; - } ); - esensor = room: name: sensor: - (genTopic_plain sensor ''/ham/${room}/${name}/sensor/${sensor}/state'' - { inherit room sensor name; - "scope" = "ham"; - } ); - zsensor = room: name: - (genTopic_zigbee name - { inherit room name; - "scope" = "ham"; - } ); - zigbee_temphum = room: name: [ - (zsensor room name) - ]; - esphome_temphum = room: name: [ - (esensor room name ''${room}_${name}_temperature'') - (esensor room name ''${room}_${name}_humidity'') - (esensor room name ''${room}_${name}_pressure'') - ]; -in { - services.telegraf.extraConfig.inputs.mqtt_consumer = - (zigbee_temphum "Wohnzimmer" "temp1") - ++ (zigbee_temphum "Badezimmer" "temp2") - ++ (zigbee_temphum "Kinderzimmer" "temp3") - ++ (esphome_temphum "arbeitszimmer" "box") - ++ (esphome_temphum "schlafzimmer" "plug") - ++ (esphome_temphum "wohnzimmer" "plug") - ++ (esphome_temphum "terrasse" "plug") - ++ [ (flycounter "misa_fliegen") (flycounter "felix_fliegen") ] - ; -} -- cgit v1.2.3