diff options
author | makefu <github@syntax-fehler.de> | 2019-03-06 16:42:27 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2019-03-06 16:42:27 +0100 |
commit | 9c702551abbf5c486d9dac3becc4d5e998511a52 (patch) | |
tree | 6b8aacd5ead80d213fe8588fca1fe491d18f7110 /makefu/2configs/bureautomation/light | |
parent | fb1d5f4addd1b3b564248b1359253bf788b1c08a (diff) |
ma bureautomation: split into files
Diffstat (limited to 'makefu/2configs/bureautomation/light')
-rw-r--r-- | makefu/2configs/bureautomation/light/buzzer.nix | 28 | ||||
-rw-r--r-- | makefu/2configs/bureautomation/light/statuslight.nix | 56 |
2 files changed, 84 insertions, 0 deletions
diff --git a/makefu/2configs/bureautomation/light/buzzer.nix b/makefu/2configs/bureautomation/light/buzzer.nix new file mode 100644 index 000000000..2067e47bf --- /dev/null +++ b/makefu/2configs/bureautomation/light/buzzer.nix @@ -0,0 +1,28 @@ +let + tasmota_pwm = name: topic: pwmid: max: + let + id = "PWM${toString pwmid}"; + in { platform = "mqtt"; + inherit name; + state_topic = "/bam/${topic}/stat/RESULT"; + state_value_template = ''{%- if value_json["PWM"]["${id}"]| int > 0 -%} ${toString max} {%- else -%} 0 {%- endif -%}''; + + command_topic = "/bam/${topic}/cmnd/${id}"; + on_command_type = "brightness"; + brightness_command_topic = "/bam/${topic}/cmnd/${id}"; + brightness_value_template = ''{{value_json["PWM"]["${id}"]}}''; + brightness_scale = max; + payload_on = "${toString max}"; + payload_off = "0"; + availability_topic = "/bam/${topic}/tele/LWT"; + payload_available= "Online"; + payload_not_available= "Offline"; + retain = true; + optimistic = false; + qos = 0; + }; +in +[ +# (tasmota_pwm "RedButton LED" "redbutton" 1 1023) #LED PWM1 + (tasmota_pwm "RedButton Buzzer" "redbutton" 2 512) #buzzer PWM2 +] diff --git a/makefu/2configs/bureautomation/light/statuslight.nix b/makefu/2configs/bureautomation/light/statuslight.nix new file mode 100644 index 000000000..3a9582f2f --- /dev/null +++ b/makefu/2configs/bureautomation/light/statuslight.nix @@ -0,0 +1,56 @@ +let + tasmota_rgb = name: topic: +# LED WS2812b +# effect_state_topic: "stat/led/Scheme" +# effect_command_topic: "cmnd/led/Scheme" +# effect_value_template: "{{ value_json.Scheme }}" + { platform = "mqtt"; + inherit name; + retain = false; + qos = 1; + optimistic = false; + # state + # TODO: currently broken, will not use the custom state topic + state_topic = "/bam/${topic}/stat/POWER"; + command_topic = "/bam/${topic}/cmnd/POWER"; + availability_topic = "/bam/${topic}/tele/LWT"; + payload_on= "ON"; + payload_off= "OFF"; + payload_available= "Online"; + payload_not_available= "Offline"; + # brightness + brightness_state_topic = "/bam/${topic}/stat/Dimmer"; + brightness_command_topic = "/bam/${topic}/cmnd/Dimmer"; + brightness_value_template = "{{ value_json.Dimmer }}"; + brightness_scale = 100; + # color + rgb_state_topic = "/bam/${topic}/stat/Color"; + rgb_command_topic = "/bam/${topic}/cmnd/Color2"; + rgb_command_mode = "hex"; + rgb_command_template = "{{ '%02x%02x%02x' | format(red, green, blue)}}"; + # effects + effect_state_topic = "/bam/${topic}/stat/Scheme"; + effect_command_topic = "/bam/${topic}/cmnd/Scheme"; + effect_value_template = "{{ value_json.Scheme }}"; + effect_list = [ + 0 # single color for LED light + 1 # start wake up sequence (same as Wakeup) + 2 # cycle up through colors using Speed option + 3 # cycle down through colors using Speed option + 4 # random cycle through colors using Speed and Fade + 5 # clock mode (example) + 6 # candlelight pattern + 7 # RGB pattern + 8 # Christmas pattern + 9 # Hannukah pattern + 10 # Kwanzaa pattern + 11 # rainbow pattern + 12 # fire pattern + ]; + }; +in +[ + (tasmota_rgb "Status Felix" "status1") + (tasmota_rgb "Status Daniel" "status2") + (tasmota_rgb "Buslicht" "buslicht") +] |