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/home/ham/multi/fliegen-couter.nix | 71 ------------------ makefu/2configs/home/ham/multi/flurlicht.nix | 57 --------------- makefu/2configs/home/ham/multi/heizung.nix | 11 --- makefu/2configs/home/ham/multi/kurzzeitwecker.nix | 88 ----------------------- makefu/2configs/home/ham/multi/the_playlist.nix | 86 ---------------------- 5 files changed, 313 deletions(-) delete mode 100644 makefu/2configs/home/ham/multi/fliegen-couter.nix delete mode 100644 makefu/2configs/home/ham/multi/flurlicht.nix delete mode 100644 makefu/2configs/home/ham/multi/heizung.nix delete mode 100644 makefu/2configs/home/ham/multi/kurzzeitwecker.nix delete mode 100644 makefu/2configs/home/ham/multi/the_playlist.nix (limited to 'makefu/2configs/home/ham/multi') diff --git a/makefu/2configs/home/ham/multi/fliegen-couter.nix b/makefu/2configs/home/ham/multi/fliegen-couter.nix deleted file mode 100644 index 5b8abb2ff..000000000 --- a/makefu/2configs/home/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"; - } - ]; - } - ]; - }; -} diff --git a/makefu/2configs/home/ham/multi/flurlicht.nix b/makefu/2configs/home/ham/multi/flurlicht.nix deleted file mode 100644 index 25eb78b7f..000000000 --- a/makefu/2configs/home/ham/multi/flurlicht.nix +++ /dev/null @@ -1,57 +0,0 @@ -# provides: -# light -# automation -# binary_sensor -let - hlib = (import ../lib); - tasmota = hlib.tasmota; -in -{ - binary_sensor = [ - (tasmota.motion { name = "Flur Bewegung"; host = "flurlicht";}) - ]; - light = [ (tasmota.rgb { name = "Flurlicht"; host = "flurlicht";} ) ]; - automation = [ - { alias = "Dunkel bei Sonnenuntergang"; - trigger = { - platform = "sun"; - event = "sunset"; - # offset: "-00:45:00" - }; - action = [ - { - service= "light.turn_on"; - data = { - entity_id= "light.flurlicht"; - # rgb_color = [ 0,0,0 ]; <-- TODO default color - brightness_pct = 15; - }; - } - { - service= "light.turn_off"; - entity_id= "light.flurlicht"; - } - ]; - } - { alias = "Hell bei Sonnenaufgang"; - trigger = { - platform = "sun"; - event = "sunrise"; - # offset: "-00:00:00" - }; - action = [ - { - service= "light.turn_on"; - data = { - entity_id= "light.flurlicht"; - brightness_pct = 85; - }; - } - { - service= "light.turn_off"; - entity_id= "light.flurlicht"; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/multi/heizung.nix b/makefu/2configs/home/ham/multi/heizung.nix deleted file mode 100644 index 73f90dfe0..000000000 --- a/makefu/2configs/home/ham/multi/heizung.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - services.home-assistant.config = - { - # 18 Grad - script.alle_heizungen_aus.sequence = [{ - service = "climate.set_temperature"; - target.entity_id = [ "climate.wohnzimmer_heizung" ]; - data.temperature = "18.0"; - }]; - }; -} diff --git a/makefu/2configs/home/ham/multi/kurzzeitwecker.nix b/makefu/2configs/home/ham/multi/kurzzeitwecker.nix deleted file mode 100644 index 1e6fae90c..000000000 --- a/makefu/2configs/home/ham/multi/kurzzeitwecker.nix +++ /dev/null @@ -1,88 +0,0 @@ -# Provides: -# timer -# automation -# script - -# Needs: -# sensor.zigbee_btn1_click -# notify.signal_home -let - button = "sensor.zigbee_btn2_click"; - notify = "notify.signal_home"; - # für {{ _intent.siteId }} - name of the rhasspy instance: arbeitszimmer -in -{ - services.home-assistant.config = { - automation = []; - timer.kurzzeitwecker = { - name = "Wecker Wohnung"; - }; - timer.wecker_arbeitszimmer = { - name = "Wecker Arbeitszimmer"; - }; - timer.wecker_wohnzimmer = { - name = "Wecker Wohnzimmer"; - }; - intent = {}; - intent_script = { - TimerjobStart = { - speech.text = '' - {% set h = hours|default('0')|string %} - {% set m = minutes|default('0')|string %} - {% if h == "0" %} - Wecker gestellt {{ m }} Minuten - {% elif m == "0" %} - Wecker gestellt {{ h }} Stunden - {% else %} - Wecker gestellt {{ h }} Stunden und {{ m }} Minuten - {% endif %} - ''; - action = [ - { - service = "timer.start"; - - data.entity_id = "timer.kurzzeitwecker"; - data.duration = '' - {% set h = hours|default("0")|int %} - {% set m = minutes|default("0")|int %} - {{ "%02d" | format(h) }}:{{ "%02d" | format(m) }}:00 - ''; - - } - ]; - }; - TimerjobRemaining = { - speech.text = '' - {% set timer = states('timer.kurzzeitwecker') %} - {% if timer == 'idle' %} - Wecker läuft nicht - {% elif timer == 'active' %} - {% set remaining = as_timestamp( state_attr('timer.kurzzeitwecker','finishes_at') )-( as_timestamp(now())) %} - {% set s = ((remaining % 60)) | int %} - {% set m = ((remaining % 3600) / 60) | int %} - {% set h = ((remaining % 86400) / 3600) | int %} - {% if h == 0 %} - Es verbleiben {{ m }} Minuten und {{ s }} Sekunden - {% elif m == 0 %} - Es verbleiben {{ h }} Stunden - {% elif m == 0 and h == 0 %} - Es verbleiben {{ s }} Sekunden - {% else %} - Es verbleiben {{ h }} Stunden {{ m }} Minuten - {% endif %} - {% endif %} - ''; - }; - TimerjobStop = { - speech.text = '' - Wecker gestoppt - ''; - action = [ - { service = "timer.cancel"; - data.entity_id = "timer.kurzzeitwecker"; - } - ]; - }; - }; - }; -} diff --git a/makefu/2configs/home/ham/multi/the_playlist.nix b/makefu/2configs/home/ham/multi/the_playlist.nix deleted file mode 100644 index 0d714ea44..000000000 --- a/makefu/2configs/home/ham/multi/the_playlist.nix +++ /dev/null @@ -1,86 +0,0 @@ -# Inputs: -# binary_sensor.playlist_button_good -# binary_sensor.playlist_button_bad - -# outputs -# rest_command -# automation -# sensor -{ - services.home-assistant.config = - { - rest_command = { - good_song = { - url = "http://prism.r:8001/good"; - method = "POST"; - }; - bad_song = { - url = "http://prism.r:8001/skip"; - method = "POST"; - }; - }; - automation = [ - { - alias = "playlist song publish"; - trigger = { - #platform = "event"; - #event_data.entity_id = "sensor.the_playlist_song"; - platform = "state"; - entity_id = "sensor.the_playlist_song"; - }; - action = { - service = "mqtt.publish"; - data = { - topic = "/ham/the_playlist/song"; - payload_template = "{{ states.sensor.the_playlist_song.state }}"; - }; - }; - } - { - alias = "playlist upvote on button"; - trigger = { - platform = "state"; - entity_id = "binary_sensor.playlist_button_good"; - from = "off"; - to = "on"; - }; - action.service = "rest_command.good_song"; - } - { - alias = "playlist downvote on button"; - trigger = { - platform = "state"; - entity_id = "binary_sensor.playlist_button_bad"; - from = "off"; - to = "on"; - }; - action.service = "rest_command.bad_song"; - } - ]; - sensor = [ - { platform = "rest"; - name = "pl"; - resource = "http://prism.r:8001/current"; - scan_interval = 30; - value_template = "1"; - json_attributes = [ "name" "filename" "youtube" ]; - } - { platform = "template"; - sensors = { - the_playlist_song = { - friendly_name = "Current Song"; - value_template = ''{{ states.sensor.pl.attributes['name'] }}''; - }; - the_playlist_url = { - friendly_name = "Song Youtube URL"; - value_template = ''{{ states.sensor.pl.attributes['youtube'] }}''; - }; - the_playlist_filename = { - friendly_name = "Song Filename"; - value_template = ''{{ states.sensor.pl.attributes['filename'] }}''; - }; - }; - } - ]; - }; -} -- cgit v1.2.3