summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/ham/multi/fliegen-couter.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-11-18 22:23:33 +0100
committermakefu <github@syntax-fehler.de>2020-11-18 22:23:33 +0100
commit78fc347be0a0b680bd39a72ac94418d211f5d777 (patch)
tree9e3b7ccd59bb6b1422f5fdc3422e641bd055ea30 /makefu/2configs/ham/multi/fliegen-couter.nix
parente04ae7a3147c731fa3eff16721253cec4dfccdbc (diff)
ma ham: use new home-assistant merge function
Diffstat (limited to 'makefu/2configs/ham/multi/fliegen-couter.nix')
-rw-r--r--makefu/2configs/ham/multi/fliegen-couter.nix100
1 files changed, 52 insertions, 48 deletions
diff --git a/makefu/2configs/ham/multi/fliegen-couter.nix b/makefu/2configs/ham/multi/fliegen-couter.nix
index d5c180e03..5b8abb2ff 100644
--- a/makefu/2configs/ham/multi/fliegen-couter.nix
+++ b/makefu/2configs/ham/multi/fliegen-couter.nix
@@ -15,53 +15,57 @@ let
data.entity_id = "counter.${for}_fliegen";
}) incr;
};
-in {
- counter = {
- felix_fliegen = {};
- misa_fliegen = {};
+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";
+ }
+ ];
+ }
+ ];
};
- 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";
- }
- ];
- }
- ];
}