Add mains relay switches
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 5 Sep 2023 20:48:17 +0000 (21:48 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 5 Sep 2023 20:48:23 +0000 (21:48 +0100)
Move the 1wire power relay to GPIO12 because that doesn't offend the
strapping, while the mains relay seems to pull it up?

pool.yaml

index 8963e4fd3957b67b00871ce03adea49445445272..07c4677c34b56a93047ed41c41ec51aece2b233f 100644 (file)
--- a/pool.yaml
+++ b/pool.yaml
@@ -1,9 +1,13 @@
 #
 # Olimex ESP32-Gateway.
 #
-# GPIO13: 1Wire sensors for solar in/out temperatures
-# GPIO14: 12v relay for bypass valve: high to close (pump via roof)
-# GPIO16: 5v relay for 1Wire sensors' power (to reset them)
+# GPIO4 (green): mains relay for pool light
+# GPIO12 (orange): 5v relay for 1Wire sensors' power (to reset them)
+# GPIO13 (yellow): 1Wire sensors for solar in/out temperatures
+# GPIO14 (green): 12v relay for bypass valve: high to close (pump via roof)
+# GPIO15 (white): mains relay for patio light
+# GPIO16 (yellow): mains relay for pool pump
+# GPIO32 (blue): mains relay for shed fan
 
 esphome:
   name: pool
@@ -172,6 +176,35 @@ mqtt:
                     id(valve_output).turn_on();
                   else
                     id(valve_output).turn_off();
+                  break;
+
+                case 515: /* Pool light switch */
+                  if (nvalue)
+                    id(pool_light).turn_on();
+                  else
+                    id(pool_light).turn_off();
+                  break;
+
+                case 516: /* Patio light switch */
+                  if (nvalue)
+                    id(patio_light).turn_on();
+                  else
+                    id(patio_light).turn_off();
+                  break;
+
+                case 517: /* Shed fan switch */
+                  if (nvalue)
+                    id(shed_fan).turn_on();
+                  else
+                    id(shed_fan).turn_off();
+                  break;
+
+                case 518: /* Pool pump switch */
+                  if (nvalue)
+                    id(pool_pump).turn_on();
+                  else
+                    id(pool_pump).turn_off();
+                  break;
             }
 
     - topic: glow/BCDDC2C24DB0/SENSOR/electricitymeter
@@ -545,10 +578,38 @@ switch:  #### To switch on and off the communication with the BLE device ####
     id: power_1w
     name: "Power 1Wire"
     pin:
-      number: GPIO16
+      number: GPIO12
       inverted: true
     restore_mode: ALWAYS_ON
     on_turn_on:
       - lambda: |-
           id(solar_in_fails) = 0;
           id(solar_out_fails) = 0;
+
+  - platform: gpio
+    id: patio_light
+    name: "Patio Light"
+    pin:
+      number: GPIO15
+      inverted: true
+
+  - platform: gpio
+    id: pool_pump
+    name: "Pool Pump"
+    pin:
+      number: GPIO16
+      inverted: true
+
+  - platform: gpio
+    id: pool_light
+    name: "Pool Light"
+    pin:
+      number: GPIO4
+      inverted: true
+
+  - platform: gpio
+    id: shed_fan
+    name: "Shed Fan"
+    pin:
+      number: GPIO32
+      inverted: true