summaryrefslogtreecommitdiffstats
path: root/makefu
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-07-01 09:35:01 +0200
committermakefu <github@syntax-fehler.de>2020-07-01 09:40:46 +0200
commitf4e98bc021585f1ed02571dcde6183c0171e5607 (patch)
tree60ee3803851b93a03741ee35a5684a0017b74980 /makefu
parent1ed4ded92f83e4d2f91b0b46c514acb420b7e0c3 (diff)
ma ham/flycounter: init
Diffstat (limited to 'makefu')
-rw-r--r--makefu/2configs/ham/default.nix9
-rw-r--r--makefu/2configs/ham/multi/fliegen-couter.nix67
2 files changed, 75 insertions, 1 deletions
diff --git a/makefu/2configs/ham/default.nix b/makefu/2configs/ham/default.nix
index 2db4ad4de..c7e8733b7 100644
--- a/makefu/2configs/ham/default.nix
+++ b/makefu/2configs/ham/default.nix
@@ -15,6 +15,7 @@ let
kurzzeitwecker = import ./multi/kurzzeitwecker.nix;
firetv_restart = import ./multi/firetv_restart.nix;
the_playlist = import ./multi/the_playlist.nix;
+ fliegen-counter = import ./multi/fliegen-couter.nix;
# switch
# automation
# binary_sensor
@@ -28,10 +29,13 @@ in {
services.home-assistant = {
package = (upkgs.home-assistant.overrideAttrs (old: {
+ doCheck = false;
+ checkPhase = ":";
+ installCheckPhase = ":";
})).override {
extraPackages = ps: with ps; [
python-forecastio jsonrpc-async jsonrpc-websocket mpd2 pkgs.picotts
- (ps.callPackage ./androidtv {})
+ (callPackage ./androidtv {})
];
};
config = {
@@ -48,6 +52,7 @@ in {
conversation = {};
history = {};
logbook = {};
+ counter = fliegen-counter.counter;
logger = {
default = "info";
};
@@ -138,6 +143,7 @@ in {
++ the_playlist.sensor
++ zigbee.sensor ;
frontend = { };
+ calendar = [ (import ./calendar/nextcloud.nix) ];
# light = flurlicht.light;
http = { };
switch = [];
@@ -146,6 +152,7 @@ in {
++ kurzzeitwecker.automation
#++ flurlicht.automation
++ the_playlist.automation
+ ++ fliegen-counter.automation
++ zigbee.automation;
script =
{ }
diff --git a/makefu/2configs/ham/multi/fliegen-couter.nix b/makefu/2configs/ham/multi/fliegen-couter.nix
new file mode 100644
index 000000000..d5c180e03
--- /dev/null
+++ b/makefu/2configs/ham/multi/fliegen-couter.nix
@@ -0,0 +1,67 @@
+# 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 {
+ 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";
+ }
+ ];
+ }
+ ];
+}