Browse Source

aggiornato repository con le versioni che prevedono pompa e cisterna

mauro 5 months ago
parent
commit
789426a90e
7 changed files with 110 additions and 19 deletions
  1. 7 7
      down.sh
  2. 1 6
      go.sh
  3. 42 0
      load.sh
  4. 5 0
      manual
  5. 5 0
      mqtt.run.sh
  6. 42 0
      pump.sh
  7. 8 6
      up.sh

+ 7 - 7
down.sh

@@ -1,7 +1,7 @@
-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 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

+ 1 - 6
go.sh

@@ -1,15 +1,10 @@
 #!/bin/bash
-
-# $linea: quale linea attivare
-# $tempo: per quanto tempo questa linea resta attiva. Di default 30 seondi (vedi codice)
 linea=$1
 tempo=$2
 
-#$pompasi: se impostato a 1, fa si che venga attivata la $pompa dopo l'apertura delle elettrovalvole
-pompasi=0
+pompasi=1
 pompa=10
 
-### evitare le modifiche dopo questa riga ###
 log=$(mktemp)
 
 if [ __${tempo}__ == ____ ] ; then

+ 42 - 0
load.sh

@@ -0,0 +1,42 @@
+#!/bin/bash
+linea=9
+tempo=$2
+
+pompasi=1
+pompa=11
+
+log=$(mktemp)
+
+if [ __${tempo}__ == ____ ] ; then
+  echo "non e' stato indicato il tempo, si va in automatico" |tee -a ${log}
+  tempo=1800
+fi
+
+# verifica la presenza del file "irrigatore" |tee -a ${log}
+if [ -f  ~/script/irrigatore ]; then 
+  echo "File 'irrigatore' presente" |tee -a ${log}
+  echo "Apertura valvola ${linea} per ${tempo}"  |tee -a ${log}
+  raspi-gpio set ${linea} dl 
+  if [ ${pompasi} == 1 ]; then
+    echo "Accensione pompa ${pompa}" |tee -a ${log}
+    raspi-gpio set ${pompa} dl
+  fi
+
+  sleep ${tempo}
+  if [ ${pompasi} == 1 ]; then
+    echo "Spengo pompa ${pompa}" |tee -a ${log}
+    raspi-gpio set ${pompa} dh
+  fi
+  echo "Chiusura valvola ${linea}" |tee -a ${log}
+  raspi-gpio set ${linea} dh
+else
+  echo "Accensione linea ${linea} per ${tempo}\nDisattivata: manca file 'irrigatore' in home" |tee -a ${log}
+fi
+
+cat ${log} | mail -s "linea ${linea} per ${tempo}" root
+rm ${log}
+
+#dl lo attiva
+#dh lo disattiva
+#op abilita la linea
+

+ 5 - 0
manual

@@ -0,0 +1,5 @@
+bash /home/mauro/script/go.sh 4 25m
+bash /home/mauro/script/go.sh 5 25m
+bash /home/mauro/script/go.sh 6 20m
+bash /home/mauro/script/go.sh 7 20m
+bash /home/mauro/script/go.sh 8 25m

+ 5 - 0
mqtt.run.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+. ~/paho/bin/activate
+cd ~/script
+./mqtt.cli.py
+

+ 42 - 0
pump.sh

@@ -0,0 +1,42 @@
+#!/bin/bash
+linea=$1
+tempo=$2
+
+pompasi=1
+pompa=10
+
+log=$(mktemp)
+
+if [ __${tempo}__ == ____ ] ; then
+  echo "non e' stato indicato il tempo, si va in automatico" |tee -a ${log}
+  tempo=30s
+fi
+
+# verifica la presenza del file "irrigatore" |tee -a ${log}
+if [ -f  ~/script/irrigatore ]; then 
+  echo "File 'irrigatore' presente" |tee -a ${log}
+  echo "Apertura valvola ${linea} per ${tempo}"  |tee -a ${log}
+  raspi-gpio set ${linea} dl 
+  if [ ${pompasi} == 1 ]; then
+    echo "Accensione pompa ${pompa}" |tee -a ${log}
+    raspi-gpio set ${pompa} dl
+  fi
+
+  sleep ${tempo}
+  if [ ${pompasi} == 1 ]; then
+    echo "Spengo pompa ${pompa}" |tee -a ${log}
+    raspi-gpio set ${pompa} dh
+  fi
+  echo "Chiusura valvola ${linea}" |tee -a ${log}
+  raspi-gpio set ${linea} dh
+else
+  echo "Accensione linea ${linea} per ${tempo}\nDisattivata: manca file 'irrigatore' in home" |tee -a ${log}
+fi
+
+cat ${log} | mail -s "linea ${linea} per ${tempo}" root
+rm ${log}
+
+#dl lo attiva
+#dh lo disattiva
+#op abilita la linea
+

+ 8 - 6
up.sh

@@ -1,6 +1,8 @@
-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 dl
+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
+