From babd5c8bb32eed564d5c874ba9795fe7caf9848d Mon Sep 17 00:00:00 2001
From: jabertwo <git@jabertwo.de>
Date: Tue, 11 Jul 2023 23:43:23 +0200
Subject: [PATCH] Nodered automations in ha, now working

---
 .../templates/config/esphome_plug02.yaml      |  4 ++
 .../templates/config/esphome_plug03.yaml      |  4 ++
 .../templates/config/esphome_plug07.yaml      |  4 ++
 .../templates/config/esphome_plug08.yaml      |  4 ++
 .../templates/config/configuration.yaml       | 49 ++++++-------------
 5 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/intern/docker_esphome/templates/config/esphome_plug02.yaml b/intern/docker_esphome/templates/config/esphome_plug02.yaml
index c613318b..f904a63f 100644
--- a/intern/docker_esphome/templates/config/esphome_plug02.yaml
+++ b/intern/docker_esphome/templates/config/esphome_plug02.yaml
@@ -19,6 +19,10 @@
       payload: "CLOSED"
       then:
         - switch.turn_off: relay
+    - topic: warpzone/door/status_once
+      payload: "OPEN"
+      then:
+        - switch.turn_on: relay
 
 status_led:
   pin:
diff --git a/intern/docker_esphome/templates/config/esphome_plug03.yaml b/intern/docker_esphome/templates/config/esphome_plug03.yaml
index 07c62e6f..0ee4706d 100644
--- a/intern/docker_esphome/templates/config/esphome_plug03.yaml
+++ b/intern/docker_esphome/templates/config/esphome_plug03.yaml
@@ -19,6 +19,10 @@
       payload: "CLOSED"
       then:
         - switch.turn_off: relay
+    - topic: warpzone/door/status_once
+      payload: "OPEN"
+      then:
+        - switch.turn_on: relay
 
 status_led:
   pin:
diff --git a/intern/docker_esphome/templates/config/esphome_plug07.yaml b/intern/docker_esphome/templates/config/esphome_plug07.yaml
index a2d482ab..56c4caa9 100644
--- a/intern/docker_esphome/templates/config/esphome_plug07.yaml
+++ b/intern/docker_esphome/templates/config/esphome_plug07.yaml
@@ -19,6 +19,10 @@
       payload: "CLOSED"
       then:
         - switch.turn_off: relay
+    - topic: warpzone/door/status_once
+      payload: "OPEN"
+      then:
+        - switch.turn_on: relay
         
 substitutions:
   plug_name: {{ devicename }}
diff --git a/intern/docker_esphome/templates/config/esphome_plug08.yaml b/intern/docker_esphome/templates/config/esphome_plug08.yaml
index 5537965c..8d53bcbe 100644
--- a/intern/docker_esphome/templates/config/esphome_plug08.yaml
+++ b/intern/docker_esphome/templates/config/esphome_plug08.yaml
@@ -15,6 +15,10 @@
       payload: "OFF"
       then:
         - switch.turn_off: relay
+    - topic: warpzone/door/status_once
+      payload: "OPEN"
+      then:
+        - switch.turn_on: relay
         
 substitutions:
   plug_name: {{ devicename }}
diff --git a/intern/docker_homeassistant/templates/config/configuration.yaml b/intern/docker_homeassistant/templates/config/configuration.yaml
index a64d8cf5..b5fc3ebf 100644
--- a/intern/docker_homeassistant/templates/config/configuration.yaml
+++ b/intern/docker_homeassistant/templates/config/configuration.yaml
@@ -736,32 +736,15 @@ automation ansible:
           - conditions:
               - condition: state
                 entity_id: input_select.zonenstatus
-                state: ""
+                state: "opened"
             sequence:
-              - type: turn_on
-                device_id: 9f6aded98a4a96ab85c96b829895f449
-                entity_id: switch.esphome_plug02_relay
-                domain: switch
-              - type: turn_on
-                device_id: 502f88ff07aa71cb053ad4112e0dd6bd
-                entity_id: switch.esphome_plug03_relay
-                domain: switch
-              - type: turn_on
-                device_id: 1637a583963ba02dc7baa17427f8ac00
-                entity_id: switch.esphome_plug07_relay
-                domain: switch
-              - type: turn_on
-                device_id: 1da3229859c49c822fd8e9c630fa9004
-                entity_id: switch.esphome_plug08_relay
-                domain: switch
-              - type: turn_on
-                device_id: 5e6ae37116ba1d3f3d95b8d571d28149
-                entity_id: light.liba_logo_leds
-                domain: light
-              - type: turn_on
-                device_id: 5e6ae37116ba1d3f3d95b8d571d28149
-                entity_id: light.kuehl_leds
-                domain: light
+              - service: light.turn_on
+                data:
+                  effect: Rainbow
+                target:
+                  entity_id:
+                    - light.liba_logo_leds
+                    - light.kuehl_leds
               - type: turn_on
                 device_id: 7ba91dde6b1413340fdc66f2984dfd00
                 entity_id: light.brightness
@@ -769,7 +752,7 @@ automation ansible:
           - conditions:
               - condition: state
                 entity_id: input_select.zonenstatus
-                state: ""
+                state: "closed"
             sequence:
               - type: turn_off
                 device_id: 1dace6e3f89d85152cde6383312792eb
@@ -803,14 +786,12 @@ automation ansible:
                 device_id: 1da3229859c49c822fd8e9c630fa9004
                 entity_id: switch.esphome_plug08_relay
                 domain: switch
-              - type: turn_off
-                device_id: 5e6ae37116ba1d3f3d95b8d571d28149
-                entity_id: light.liba_logo_leds
-                domain: light
-              - type: turn_off
-                device_id: 5e6ae37116ba1d3f3d95b8d571d28149
-                entity_id: light.kuehl_leds
-                domain: light
+              - service: light.turn_off
+                data: {}
+                target:
+                  entity_id:
+                    - light.liba_logo_leds
+                    - light.kuehl_leds
               - type: turn_off
                 device_id: 7ba91dde6b1413340fdc66f2984dfd00
                 entity_id: light.brightness
-- 
GitLab