Browse Source

aggiornati gli elenchi delle valvole e delle pompe

mauro 4 months ago
parent
commit
44dc81654a
7 changed files with 41 additions and 17 deletions
  1. 4 2
      down.sh
  2. 1 1
      load.sh
  3. 22 5
      mqtt.cli.py
  4. 0 0
      other/10minuti.sh
  5. 0 0
      other/manual
  6. 11 7
      start.sh
  7. 3 2
      up.sh

+ 4 - 2
down.sh

@@ -1,7 +1,9 @@
+raspi-gpio set 10 dh  #pompa serbatoio
+raspi-gpio set 11 dh  #pompa pozzo
 raspi-gpio set 4 dh
 raspi-gpio set 5 dh
 raspi-gpio set 6 dh
 raspi-gpio set 7 dh
 raspi-gpio set 8 dh
-raspi-gpio set 9 dh
-raspi-gpio set 10 dh
+raspi-gpio set 9 dh  # valvola controllo pozzo/acqua comunale
+

+ 1 - 1
load.sh

@@ -9,7 +9,7 @@ log=$(mktemp)
 
 if [ __${tempo}__ == ____ ] ; then
   echo "non e' stato indicato il tempo, si va in automatico" |tee -a ${log}
-  tempo=1800
+  tempo=2000
 fi
 
 # verifica la presenza del file "irrigatore" |tee -a ${log}

+ 22 - 5
mqtt.cli.py

@@ -13,6 +13,7 @@ def on_connect(client, userdata, flags, reason_code, properties):
   client.subscribe('request/+',0)
   client.subscribe('Irrigatore/#',0)
   client.subscribe('Pompa/#',0)
+  client.subscribe('Valvola/#',0)
   #client.subscribe('$SYS/#',0)
   client.publish('message',"{'message':'avvio'}")
 
@@ -38,11 +39,27 @@ def on_message(client,userdata,msg):
     print('payload',msg.payload)
 
   if ok:
-    print(data['irrigatore'],data['status'],type(data['irrigatore']))
-    if data['status'] == 1:
-      GPIO.output(data['irrigatore'],GPIO.HIGH)
-    else:
-      GPIO.output(data['irrigatore'],GPIO.LOW)
+    if 'irrigatore' in data:
+      print(data['irrigatore'],data['status'],type(data['irrigatore']))
+      if data['status'] == 1:
+        GPIO.output(data['irrigatore'],GPIO.HIGH)
+      else:
+        GPIO.output(data['irrigatore'],GPIO.LOW)
+
+    if 'pompa' in data:
+      print(data['pompa'],data['status'],type(data['pompa']))
+      if data['status'] == 1:
+        GPIO.output(data['pompa'],GPIO.HIGH)
+      else:
+        GPIO.output(data['pompa'],GPIO.LOW)
+
+    if 'valvola' in data:
+      print(data['valvola'],data['status'],type(data['valvola']))
+      if data['status'] == 1:
+        GPIO.output(data['valvola'],GPIO.HIGH)
+      else:
+        GPIO.output(data['valvola'],GPIO.LOW)
+
 
 GPIO.setmode(GPIO.BCM)
 

+ 0 - 0
10minuti.sh → other/10minuti.sh


+ 0 - 0
manual → other/manual


+ 11 - 7
start.sh

@@ -1,6 +1,8 @@
 #!/usr/bin/env bash
 
-echo "Start Irrigatore" | mail -s "Start Irrigatore" root
+orario=$(date)
+echo "${orario} Start Irrigatore" | mail -s "${orario} Start Irrigatore" root
+
 raspi-gpio set 4 op
 sleep 2
 raspi-gpio set 4 dh
@@ -23,13 +25,15 @@ raspi-gpio set 8 dh
 
 raspi-gpio set 9 op
 sleep 1
-raspi-gpio set 9 dh
 
-raspi-gpio set 10 op
-sleep 1
-raspi-gpio set 10 dh
+	raspi-gpio set 10 op
+	sleep 1
+	raspi-gpio set 10 dh
+
+	raspi-gpio set 11 op
+	sleep 1
+	raspi-gpio set 11 dh
 
-raspi-gpio set 11 op
 sleep 1
-raspi-gpio set 11 dh
+raspi-gpio set 9 dh
 

+ 3 - 2
up.sh

@@ -1,8 +1,9 @@
-raspi-gpio set 10 dl
+raspi-gpio set 10 dl  #pompa serbatoio
+raspi-gpio set 11 dl  #pompa pozzo
 raspi-gpio set 4 dl
 raspi-gpio set 5 dl
 raspi-gpio set 6 dl
 raspi-gpio set 7 dl
 raspi-gpio set 8 dl
-raspi-gpio set 9 dl
+raspi-gpio set 9 dl   #elettrovalvola controllo pozzo/comune