]> www.infradead.org Git - users/dwmw2/esp32-pool.git/commitdiff
Domoticz notification for mains switches
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 5 Sep 2023 21:00:31 +0000 (22:00 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 5 Sep 2023 21:00:31 +0000 (22:00 +0100)
pool.yaml

index 07c4677c34b56a93047ed41c41ec51aece2b233f..1b649aed5f2fdca175078b54069b450d8d9a63ac 100644 (file)
--- a/pool.yaml
+++ b/pool.yaml
@@ -592,6 +592,22 @@ switch:  #### To switch on and off the communication with the BLE device ####
     pin:
       number: GPIO15
       inverted: true
+    on_turn_on:
+      then:
+        - mqtt.publish_json:
+            topic: domoticz/in
+            payload: |-
+              root["command"] = "udevice";
+              root["idx"] = 516;
+              root["nvalue"] = 1;
+    on_turn_off:
+      then:
+        - mqtt.publish_json:
+            topic: domoticz/in
+            payload: |-
+              root["command"] = "udevice";
+              root["idx"] = 516;
+              root["nvalue"] = 0;
 
   - platform: gpio
     id: pool_pump
@@ -599,6 +615,22 @@ switch:  #### To switch on and off the communication with the BLE device ####
     pin:
       number: GPIO16
       inverted: true
+    on_turn_on:
+      then:
+        - mqtt.publish_json:
+            topic: domoticz/in
+            payload: |-
+              root["command"] = "udevice";
+              root["idx"] = 518;
+              root["nvalue"] = 1;
+    on_turn_off:
+      then:
+        - mqtt.publish_json:
+            topic: domoticz/in
+            payload: |-
+              root["command"] = "udevice";
+              root["idx"] = 518;
+              root["nvalue"] = 0;
 
   - platform: gpio
     id: pool_light
@@ -606,6 +638,22 @@ switch:  #### To switch on and off the communication with the BLE device ####
     pin:
       number: GPIO4
       inverted: true
+    on_turn_on:
+      then:
+        - mqtt.publish_json:
+            topic: domoticz/in
+            payload: |-
+              root["command"] = "udevice";
+              root["idx"] = 515;
+              root["nvalue"] = 1;
+    on_turn_off:
+      then:
+        - mqtt.publish_json:
+            topic: domoticz/in
+            payload: |-
+              root["command"] = "udevice";
+              root["idx"] = 515;
+              root["nvalue"] = 0;
 
   - platform: gpio
     id: shed_fan
@@ -613,3 +661,19 @@ switch:  #### To switch on and off the communication with the BLE device ####
     pin:
       number: GPIO32
       inverted: true
+    on_turn_on:
+      then:
+        - mqtt.publish_json:
+            topic: domoticz/in
+            payload: |-
+              root["command"] = "udevice";
+              root["idx"] = 517;
+              root["nvalue"] = 1;
+    on_turn_off:
+      then:
+        - mqtt.publish_json:
+            topic: domoticz/in
+            payload: |-
+              root["command"] = "udevice";
+              root["idx"] = 517;
+              root["nvalue"] = 0;