2 Commits 19584c17d1 ... 09daadee23

Author SHA1 Message Date
  subDesTagesMitExtraKaese 09daadee23 reuse hardware for previous purpose 1 month ago
  subDesTagesMitExtraKaese 0cdac52705 update platform syntax 1 month ago
4 changed files with 398 additions and 26 deletions
  1. 1 0
      .gitignore
  2. 10 26
      config.yaml
  3. 289 0
      data.yml
  4. 98 0
      generate.py

+ 1 - 0
.gitignore

@@ -3,5 +3,6 @@
 # You can modify this file to suit your needs.
 /.esphome/
 /secrets.yaml
+/mqtt.yaml
 
 /venv/

+ 10 - 26
config.yaml

@@ -1,12 +1,16 @@
 esphome:
   name: ir-blaster
-  platform: ESP8266
+esp8266:
   board: d1_mini
 
 wifi:
   networks:
-  - ssid: "NETZ39"
-    password: !secret WifiPassword
+  - ssid: !secret WifiSSID1
+    password: !secret WifiPassword1
+  - ssid: !secret WifiSSID2
+    password: !secret WifiPassword2
+  - ssid: !secret WifiSSID3
+    password: !secret WifiPassword3
 
 # Enable logging
 logger:
@@ -22,9 +26,7 @@ web_server:
 #  encryption:
 #    key: ""
 
-mqtt:
-  broker: mqtt.n39.eu
-  port: 1883
+<<: !include mqtt.yml
 
 ota:
   - platform: esphome
@@ -38,26 +40,8 @@ time:
       - ptbtime2.ptb.de
       - ptbtime3.ptb.de
 
-button:
-  - platform: template
-    name: Casio Power Button
-    on_press:
-      - remote_transmitter.transmit_nec:
-          address: 0xF484
-          command: 0xF40B
-          command_repeats: 3
-  - platform: template
-    name: "Monitor An/Aus"
-    on_press:
-      - remote_transmitter.transmit_lg:
-          data: 0x02FD48B7 # power on/off
-          nbits: 32
-  - platform: template
-    name: "Ventilator An/Aus"
-    on_press:
-      - remote_transmitter.transmit_pronto:
-          data: "0000 006D 0018 0000 002E 0013 002E 0013 000E 0034 002D 0013 002E 0013 000E 0034 000D 0034 000D 0034 000D 0034 000D 0034 000D 0034 002E 0117 002E 0013 002E 0013 000E 0034 002E 0013 002E 0013 000E 0034 000D 0034 000D 0034 000D 0034 000D 0034 000D 0034 002E 0181 06C3"
- 
+<<: !include data.yml
+
 remote_receiver:
   pin: 
     number: GPIO2

+ 289 - 0
data.yml

@@ -0,0 +1,289 @@
+button:
+- name: 'on'
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500,
+        -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500,
+        -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700,
+        500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: 'off'
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500,
+        -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500,
+        -600, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700,
+        500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: candle
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500,
+        -600, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500,
+        -1700, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: warm white
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500,
+        -1700, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -600, 500, -600, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: white
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500,
+        -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -600, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: cold white
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500,
+        -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500,
+        -600, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700,
+        500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: night
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500,
+        -600, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -600, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: sleep
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: reading
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500,
+        -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500,
+        -600, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500, -1700,
+        500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: yoga
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -600, 500,
+        -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -1700, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: morning
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500,
+        -600, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500,
+        -600, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: color wheel
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -600, 500,
+        -600, 500, -1700, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -1700, 500, -1700, 500, -600, 500, -600, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: random
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -600, 500,
+        -1700, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -1700, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: evening
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500,
+        -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500,
+        -1700, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700,
+        500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: trees
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -600, 500,
+        -1700, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -1700, 500, -600, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: water
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500,
+        -600, 500, -1700, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600,
+        500, -1700, 500, -1700, 500, -600, 500, -600, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: fire
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500,
+        -1700, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600,
+        500, -1700, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: hearts
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500,
+        -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 3, wait_time: 0.5s}
+  platform: template
+- name: saturate
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500,
+        -600, 500, -1700, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -600, 500, -1700, 500, -600, 500, -600, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 5, wait_time: 0.5s}
+  platform: template
+- name: lighter
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 5, wait_time: 0.5s}
+  platform: template
+- name: blue
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500,
+        -1700, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600,
+        500, -1700, 500, -600, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 5, wait_time: 0.5s}
+  platform: template
+- name: red
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -1700, 500,
+        -1700, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 5, wait_time: 0.5s}
+  platform: template
+- name: orange
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500, -600, 500,
+        -600, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -1700,
+        500]
+      repeat: {times: 5, wait_time: 0.5s}
+  platform: template
+- name: green
+  on_press:
+  - remote_transmitter.transmit_raw:
+      carrier_frequency: 38000
+      code: [9000, -4400, 500, -600, 500, -1700, 500, -600, 500, -600, 500, -600,
+        500, -600, 500, -600, 500, -600, 500, -600, 500, -1700, 500, -1700, 500, -1700,
+        500, -1700, 500, -1700, 500, -1700, 500, -1700, 500, -600, 500, -600, 500,
+        -600, 500, -1700, 500, -600, 500, -600, 500, -600, 500, -600, 500, -1700,
+        500, -1700, 500, -1700, 500, -600, 500, -1700, 500, -1700, 500, -1700, 500,
+        -1700, 500]
+      repeat: {times: 5, wait_time: 0.5s}
+  platform: template

+ 98 - 0
generate.py

@@ -0,0 +1,98 @@
+import yaml
+
+
+DELAY_RESEND = 488400
+DELAY_HOLD_1 = 39800
+DELAY_HOLD_N = 95200
+
+PREAMBLE = 9000
+PREPAUSE = 4400
+PREHOLD  = 2200
+
+SIGNAL  = 500
+PAUSE_1 = 1700
+PAUSE_0 = 600
+
+rgbButtonsSingle = {
+  "on": 0x407F807F,
+  "off": 0x407F40BF,
+  "candle": 0x407F8877,
+  "warm white": 0x407F6897,
+  "white": 0x407F50AF,
+  "cold white": 0x407FC03F,
+  "night": 0x407F48B7,
+  "sleep": 0x407FE817,
+  "reading": 0x407FD02F,
+  "yoga": 0x407F20DF,
+  "morning": 0x407FC837,
+  "color wheel": 0x407F18E7,
+  "random": 0x407F30CF,
+  "evening": 0x407FA05F,
+  "trees": 0x407F28D7,
+  "water": 0x407F9867,
+  "fire": 0x407FB04F,
+  "hearts": 0x407F609F,
+
+}
+rgbButtonsRepeat = {
+  "saturate": 0x407F58A7,
+  "lighter": 0x407FF00F,
+  "blue": 0x407FA857,
+  "red": 0x407F708F,
+  "orange": 0x407FE01F,
+  "green": 0x407F10EF,
+}
+
+def ir_send_rgb(value):
+  irSignal = [0] * 67
+  irRepeatDelay = DELAY_RESEND
+  
+  irSignal[0] = PREAMBLE
+  irSignal[1] = -PREPAUSE
+  irSignal[2] = SIGNAL
+  
+  for i in range(32):
+    irSignal[65-i*2] = -PAUSE_1 if value & 1<<i else -PAUSE_0
+    irSignal[66-i*2] = SIGNAL
+  return irSignal
+
+data = {
+    'button': [
+        {
+            'platform': "template",
+            'name': key,
+            'on_press': [
+                {
+                    'remote_transmitter.transmit_raw': {
+                        'code': ir_send_rgb(value),
+                        'carrier_frequency': 38_000,
+                        'repeat': {
+                          'times': 3,
+                          'wait_time': "0.5s",
+                        },
+                    }
+                }
+            ]
+        } for key, value in rgbButtonsSingle.items()
+    ] + [
+        {
+            'platform': "template",
+            'name': key,
+            'on_press': [
+                {
+                    'remote_transmitter.transmit_raw': {
+                        'code': ir_send_rgb(value),
+                        'carrier_frequency': 38_000,
+                        'repeat': {
+                          'times': 5,
+                          'wait_time': "0.5s",
+                        },
+                    }
+                }
+            ]
+        } for key, value in rgbButtonsRepeat.items()
+    ]
+}
+
+with open('data.yml', 'w') as outfile:
+    yaml.dump(data, outfile, default_flow_style=None)