summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/ham/multi/fliegen-couter.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-03-09 22:14:51 +0100
committermakefu <github@syntax-fehler.de>2021-03-09 22:14:51 +0100
commitce2aadff1c8d1d44a51c3be27570c64e14fd13c1 (patch)
tree42ea3346ff62034aae8014e00d7f475f51276e6e /makefu/2configs/ham/multi/fliegen-couter.nix
parent914163cec3b89e2abcbc58e535e648ac9788b305 (diff)
ma ham -> ma home/ham
Diffstat (limited to 'makefu/2configs/ham/multi/fliegen-couter.nix')
-rw-r--r--makefu/2configs/ham/multi/fliegen-couter.nix71
1 files changed, 0 insertions, 71 deletions
diff --git a/makefu/2configs/ham/multi/fliegen-couter.nix b/makefu/2configs/ham/multi/fliegen-couter.nix
deleted file mode 100644
index 5b8abb2ff..000000000
--- a/makefu/2configs/ham/multi/fliegen-couter.nix
+++ /dev/null
@@ -1,71 +0,0 @@
-# uses:
-# sensor.btn1_click
-# sensor.btn2_click
-let
- hlib = import ../lib;
- fly_swat = for: btn: method: incr: {
- alias = "Increment ${method} for ${for}";
- trigger = {
- platform = "state";
- entity_id = "sensor.${btn}_click";
- to = method;
- };
- action = builtins.genList (cnt: {
- service = "counter.increment";
- data.entity_id = "counter.${for}_fliegen";
- }) incr;
- };
-in
-{
- services.home-assistant.config =
- {
- counter = {
- felix_fliegen = {};
- misa_fliegen = {};
- };
- automation = [
- (fly_swat "misa" "btn1" "single" 1)
- (fly_swat "misa" "btn1" "double" 2)
- (fly_swat "misa" "btn1" "triple" 3)
- (fly_swat "felix" "btn2" "single" 1)
- (fly_swat "felix" "btn2" "double" 2)
- (fly_swat "felix" "btn2" "triple" 3)
- {
- alias = "Send Fly Counter Update";
- trigger = [
- {
- platform = "state";
- entity_id = "counter.felix_fliegen";
- }
- {
- platform = "state";
- entity_id = "counter.misa_fliegen";
- #above = -1;
- }
- ];
- action = {
- service = "mqtt.publish";
- data_template = { # gauge-style
- payload = "{{ trigger.to_state.state }}";
- topic = "${hlib.prefix}/flycounter/{{ trigger.to_state.object_id }}";
- };
- };
- }
- {
- alias = "Reset Fly counters on midnight";
- trigger = {
- platform = "time";
- at = "01:00:00";
- };
- action = [
- { service = "counter.reset";
- data.entity_id = "counter.misa_fliegen";
- }
- { service = "counter.reset";
- data.entity_id = "counter.felix_fliegen";
- }
- ];
- }
- ];
- };
-}