103 Commits

Author SHA1 Message Date
lejubila
50fc8a72b2 Change number of version 2020-09-06 08:28:04 +02:00
lejubila
9183bbcef5 Add support for send log to piGardenWeb 2020-09-06 08:24:26 +02:00
lejubila
bdab0fb6fe Fix changelog 2020-05-16 18:14:21 +02:00
lejubila
6ed0510c7f Published version 0.6.0: - Add support for enable all cron fron api
- Update rainsensorqty driver to version 0.2.5b
2020-05-16 18:11:51 +02:00
lejubila
15e36e95a3 Update rainsensorqty to version 0.2.5 2020-04-08 22:17:14 +02:00
lejubila
3a5c3ef934 Add support for enable all cron fron api 2020-04-07 23:20:41 +02:00
lejubila
f3c11a7fee Corretto repositori git da cui scaricare wiringPi 2020-04-01 12:45:58 +02:00
lejubila
ac95194b3e Rimosso file con riferimento alla vecchia versione di rainsensorqty 2019-09-24 18:47:39 +02:00
lejubila
a125ff31d8 Aggiornato changelog alla version 0.5.14 2019-09-24 17:12:25 +02:00
lejubila
bb435f0ee6 Merge branch 'rainsensorqty' into develop
Eseguito merge del brench rainsensorqty nel brench develop
2019-09-24 17:06:25 +02:00
lejubila
b8daa7acab Cambiato numero di versione 2019-09-24 17:05:50 +02:00
lejubila
dd289f8b31 Adattato alla versione 0.3.3 i nomi zone presente nelle schedulazione mostrate nello stato in formato json 2019-09-24 16:58:23 +02:00
androtto
2add0c725f versione 0.2.3 2019-09-21 23:00:50 +02:00
androtto
0b34b7010f version 0.2.1 2019-09-02 14:42:29 +02:00
lejubila
c527702c72 Aggiunto elenco elettrovalvole con relativi alias nello status json 2019-09-01 22:22:42 +02:00
lejubila
b6de96debe Aggiunto api per gestire le schedulazioni di piGardenSched 2019-08-29 19:00:42 +02:00
lejubila
ea681816fe Aggiunto nello status json la lettura delle schedulazioni gestite con piGardenSched 2019-08-25 17:25:12 +02:00
lejubila
8ca698d4ee rimosso alcune linee commentate 2019-08-24 10:04:46 +02:00
lejubila
70943c5f5e Rimosso alcune linee commentate 2019-08-24 09:59:18 +02:00
lejubila
aa9799cdaf Rimosso alcune linee commentate 2019-08-24 09:52:46 +02:00
lejubila
6d4f522f21 Aggiunto changelog per nuova versione, e file di configurazione di esempio per il nuovo driver rainsensorqty 2019-08-12 08:40:55 +02:00
lejubila
51e4391237 Merge branch 'rainsensorqty' into develop 2019-08-12 08:26:28 +02:00
lejubila
e2eda96f2c Aggiornato driver rainsensorqty alla versione 0.2.0 2019-08-12 08:24:57 +02:00
lejubila
aa12f5a8a5 Aggiunto compressione file di log dei driver 2019-06-23 12:44:33 +02:00
lejubila
40ab2e3b25 Aggiunto implementazione driver rainsensorqty railizzato da @androtto 2018-12-09 12:49:09 +01:00
lejubila
40eb0b2429 Iniziato integrazione codice di @androtto nel driver rainsensorqty 2018-11-17 09:20:24 +01:00
lejubila
9d9ef42679 Aggiornato numero versione 2018-11-13 12:47:26 +01:00
lejubila
70c4e063f8 corretto bug su driver openweathermap che in alcuni casi causa una malformazione dello status json e impediva la comunicazione con piGardenWeb 2018-11-13 12:45:28 +01:00
lejubila
4d4b35c3cc corretto bug su driver openweathermap che in alcuni casi causa una malformazione dello status json e impediva la comunicazione con piGardenWeb 2018-11-13 12:43:26 +01:00
lejubila
71e91cc861 Corretto bug che impediva la pubblicazione del topic mqtt per ogni evento 2018-11-12 23:15:34 +01:00
David Bigagli
e26292fe36 Delete mqtt_status.sh 2018-11-11 23:39:22 +01:00
lejubila
d99566ef93 aggiunto scheletro driver rainsensorqty 2018-11-11 23:31:13 +01:00
lejubila
a76c797b22 Corretto nome variabile errata EV1_MONOSTAVLE nel file di configurazione 2018-11-11 15:34:28 +01:00
lejubila
07a594e799 aggiunto possibilità di disabilitare servizio meteo online 2018-11-11 11:57:59 +01:00
lejubila
dfa68c2b83 Implementato possibilità di disabilitare servizio meteo online impostando il valore none in WEATHER_SERVICE 2018-11-11 11:49:35 +01:00
lejubila
e284bbcb25 Fix bug in single monostable solenodid management caused from wrong variable name EV_IS_MONOSTAVLE 2018-11-11 11:14:28 +01:00
lejubila
d324faf8bb Fix bug in single monostable solenodid management caused from wrong variable name EV_IS_MONOSTAVLE 2018-11-11 10:13:21 +01:00
lejubila
383cbc44a9 Fix bug in single monostable solenodid management caused from wrong variable name EV_IS_MONOSTAVLE 2018-11-11 10:09:02 +01:00
lejubila
9864709b44 Cambiato changelog 2018-11-01 12:03:07 +01:00
lejubila
6d8c82f0a3 Modificato gestione di invio messaggi tramite socket server 2018-10-14 22:47:43 +02:00
lejubila
a997081aa9 Rimosso mqttconnector 2018-09-22 08:23:13 +02:00
lejubila
c145171306 Aggiunto nel json_status il tipo di evento attualmente triggerato 2018-09-22 08:20:54 +02:00
lejubila
e9a676188f Aggiunto supporto mqtt per la pubblicazione dello stato in formato json verso il broker 2018-09-20 10:53:40 +02:00
lejubila
0d748031fd variato file di configurazione di mqttconnector 2018-08-15 12:09:47 +02:00
lejubila
3ed46d80ad Merge branch 'master' of https://github.com/lejubila/piGarden 2018-07-18 23:10:29 +02:00
lejubila
05a73720bb Inserito data nel CHANGELOG prima della pubbilicazione della release, aggiunto prima implementazione sperimentale di mqttconnector 2018-07-18 23:08:16 +02:00
lejubila
2ea6588c32 Implementato controllo meteo su servizio online tramite driver, implementato driver per interfacciarsi con le api di openweathermap e wunderground 2018-07-15 23:18:59 +02:00
David Bigagli
fc717f18a2 Update README.md 2018-06-05 18:00:25 +02:00
David Bigagli
50117a5a96 Update README.md 2018-06-05 17:57:14 +02:00
David Bigagli
309c209b1b Update README.md 2018-06-05 17:56:35 +02:00
David Bigagli
9a81f0fbba Update README.md 2018-06-05 17:53:36 +02:00
lejubila
419695b420 Implementato driver subsistem per il controllo delle condizioni meteo tramite servizio online. Implementato driver 'wunderground' per il controllo meteo tramite il servizio wunderground 2018-06-05 16:31:45 +02:00
lejubila
3239006922 Modificato file README dei driver, variato numero di versione di piGarden 2018-06-01 22:16:26 +02:00
lejubila
24baa97dad Corretto nome di funzione nel driver sonoff_tasmota_http 2018-05-24 22:06:12 +02:00
lejubila
c354f72c0c Eseguito correzioni su driver sonoff_tasmota_http 2018-05-23 17:57:24 +02:00
lejubila
6f80b8ea21 Corretto problema parsing json su driver sonoff_tasmota_http 2018-05-22 12:53:57 +02:00
lejubila
87edbbbe7a Eseguito correzioni su driver sonoff_tasmota_http 2018-05-21 22:21:27 +02:00
lejubila
3eb45fd1e9 Aggiunto prima implementazione del driver sonoff_tesmota_http, aggiunto implementazione parametro EVx_MONOSTABLE per potere definire singolarmente le elettrovamvole monostabili, corretto alcuni commenti 2018-05-20 17:14:58 +02:00
lejubila
7c96a6afd1 Modificato output di notifiche eventi dello script rpinotify.sh, aggiornato CHANGELOG per nuova versione 2018-05-04 21:17:32 +02:00
lejubila
c664bea16a corretto timestamp su eventi ev_not_open_for_rain, ev_not_open_for_rain_online, ev_not_open_for_rain_sensor 2018-05-03 12:02:48 +02:00
lejubila
78fa176848 Implementato eventi events/ev_not_open_for_rain, events/ev_not_open_for_rain_sensor, events/ev_not_open_for_rain_online. Aggiornato script di invio mail notifiche 2018-05-03 11:45:47 +02:00
lejubila
5c00853e39 Aggiunto driver 'remote' per gestire da un'installazione master di piGarden più installazioni remote 2018-03-25 12:32:39 +02:00
lejubila
dd3cab12c2 Aggiornaeto numero di release 2017-12-13 15:47:06 +01:00
lejubila
38ecd92d7a Corretto problema di inizializzazione variabile LOG_OUTPUT_DRV_FILE 2017-12-13 15:43:06 +01:00
lejubila
22ec16cc9d Aggunto eventi cron_add_before, cron_add_after, cron_del_before, cron_del_after, ev_open_in_before, ev_open_in_after, exec_poweroff_before, exec_poweroff_after, exec_reboot_before, exec_reboot_after ed eseguito bugfix vari 2017-11-19 23:24:48 +01:00
lejubila
8d4849db75 Merge branch 'master' into develop 2017-11-01 18:10:41 +01:00
lejubila
35665c74a7 Corretto lettura parametri su script sendmail.sh 2017-11-01 18:09:26 +01:00
lejubila
80bcbbc92a corretto parametri in sendmail.sh 2017-11-01 18:03:52 +01:00
David Bigagli
67f2d6fe7f Merge pull request #9 from polcape/patch-1
Corretto errore variabile in drv_rain_sensor_get
2017-11-01 18:01:37 +01:00
Paolo
83e23d6bad Corretto errore variabile
Non veniva riconosciuto il valore del sensore pioggia in quanto veniva utilizzata una variabile in scrittura (val) che non veniva poi letta.
2017-11-01 17:48:56 +01:00
lejubila
daf8a7baa6 Implementato supporto a zone non soggette a pioggia (con il parametro EVx_NORAIN) 2017-10-28 00:12:06 +02:00
lejubila
4a0d6178d3 Teriminato debug gestione eventi, creato script sendmail.sh per l'invio di una mail allo scatenarsi du un evento 2017-10-27 23:26:12 +02:00
lejubila
3761c6cb94 terminata implementazione gestione eventi 2017-10-26 23:56:06 +02:00
lejubila
e29dc9dfd4 aggiunto directory relative ad identificare gli eventi 2017-10-26 23:10:34 +02:00
lejubila
6ccb8d3c19 aggiunto file contenente le funzioni per la gestioni degli eventi 2017-10-26 22:46:55 +02:00
lejubila
b3dae26372 iniziato implementazione gestione eventi 2017-10-25 23:44:06 +02:00
lejubila
c048337056 Eseguito merge del brench drv nel brench develop 2017-10-12 23:54:18 +02:00
lejubila
ecbef2c94c Variato changelog, corretto commenti in alcuni file, variato nome della directory di lock 2017-10-12 23:46:07 +02:00
lejubila
10aed48887 driver spb16ch: corretto sistema di attivazione schede 2017-09-19 22:24:38 +02:00
lejubila
4b690b4b7f variato gestione funzioni di lock/unlock per incrementare le prestazioni 2017-09-18 18:55:52 +02:00
lejubila
6afdb24d82 driver spb16ch: corretto inizializzazione e pilotaggio schede, aumentato prestazioni di esecuzione script staticizzando in fase di init gli identificativi delle board utilizzate in modo che che non vengano ricalcolati ad ogni esecuzione successiva dello script 2017-09-16 17:48:19 +02:00
lejubila
2f2cfdc720 eseguito ottimizzazione su chiamate json_status da socket server per migliorare tempi di risposta 2017-09-16 02:34:24 +02:00
lejubila
2b5b3e9687 corretto numero totale zone nel file di configurazione 2017-09-14 12:20:37 +02:00
lejubila
ba128967bd implementato spengimento di tutte le board spb16ch e riattivazione della sola scheda su cui è collegato il rele al quale si sta impartendo l'ordine di apertura/chiusura 2017-09-13 23:59:02 +02:00
lejubila
e64f651cab implementato comandi e socket server api per lo spengimento e riavvio del sistema. Corretto problema che lasciava sul sistema file di appoggio per i messaggi da inviare tramite socket server 2017-09-10 12:44:35 +02:00
lejubila
59b27365ed aggiunto api per eseguire la chiusura di tutte le zone e per la disabilitare tutte le schdulazioni 2017-09-10 02:16:01 +02:00
lejubila
fcbfa3cd32 eseguito merge su CHANGELOG.md 2017-09-09 23:26:02 +02:00
lejubila
3e34f05b4e corretto bug che non faceva aggirnare i dati meteo in caso di pioggia 2017-09-09 23:22:00 +02:00
lejubila
75dd4f5c48 ottimizzato loop di inizializzazione sul driver spb16ch 2017-09-09 00:37:11 +02:00
lejubila
4e15c37fe2 driver spb16ch: eseguito mappatura dei 128 relè distribuito sulle 8 possibili schede installabili 2017-09-05 00:24:33 +02:00
lejubila
9fc7c971f1 Corretto problema su gestione cron con cron type simili. Per esempio se veniva inserita una schedulazione per la zona Zona_10 questa veniva riconosciuta anche per la zona con nome Zona_1 2017-09-01 01:06:53 +02:00
lejubila
c370890f0b variato commento con specifiche mappatura rele 2017-08-31 09:54:13 +02:00
lejubila
efbd3c687d driver spb16ch: modificato mappatura rele e script python da lanciare per l'apertura/chiusura dei rele 2017-08-30 23:13:34 +02:00
lejubila
2f7b286424 separato codice di gestione pioggia da script principale, variato numero di versione, rimosso commenti non necessari in testa ai file di inclusione 2017-08-21 08:47:11 +02:00
lejubila
7f6a593833 modificato istruzioni di installazione 2017-08-21 08:34:47 +02:00
lejubila
4322a83977 Terminato gertione driver e implementato prima versione beta del driver spb16ch 2017-08-20 12:21:30 +02:00
lejubila
2056b30be0 Variato emissione log chiamate alle callback dei driver 2017-08-16 16:37:35 +02:00
lejubila
317781e217 Spostato diverse parti dello script in file di inclusione, completato driver di esempio 2017-08-15 12:35:28 +02:00
lejubila
426ccab0d2 continua modifiche per gestione driver 2017-08-03 23:43:06 +02:00
lejubila
867b4e4374 iniziato gestione driver 2017-08-03 00:18:35 +02:00
lejubila
2cdea46a11 Aggiunto schemi elettrici in formato kicad per l'impianto nella versione con elettrovalvole bistabili e monostabili 2017-07-13 22:43:17 +02:00
lejubila
9cb7d6ce9d Variato numero di versione 2017-06-17 15:31:11 +02:00
lejubila
ce062f30ca Rimosso lock/unlock nella funzione init per risolvere problema di inizializzazione 2017-06-17 15:23:09 +02:00
127 changed files with 9350 additions and 920 deletions

View File

@@ -1,18 +1,94 @@
# 0.6.1 - 06/09/2020
- Add support for send log to piGardenWeb
# 0.6.0 - 16/05/2020
- Add support for enable all cron fron api
- Update rainsensorqty driver to version 0.2.5b
# 0.5.14 - 24/09/2019
- Updated rainsensorqty driver to version 0.2.3
- Added api and command for manage piGardenSched scheduling
# 0.5.13 - 12/08/2019
- Added driver rainsensorqty for menage rainfall detection based on quantity
# 0.5.12.1 - 23/06/2019
- Added zip log drver file when exceeding the size limit
# 0.5.12 - 13/11/2018
- Fixed a bug that prevented the publication of the mqtt topic for each event
- Fixed a bug on openweathermap driver which in some cases causes a malformation of the json status and prevented communication with piGardenWeb
# 0.5.11 - 11/11/2018
- Added ability to disable online weather service by defining WEATHER_SERVICE="none" in the configuration file
# 0.5.10 - 11/11/2018
- Fix bug in single monostable solenodid management caused from wrong variable name EV_IS_MONOSTAVLE
# 0.5.9 - 01/11/2018
- Added mqtt support for publishing status to broker
# 0.5.8 - 19/07/2018
- Added "openweathermap" driver for impement check weather condition from openweatermap api
# 0.5.7 - 01/06/2018
- Added "sonoff_tasmota_http" driver for interfacin with Sonoff module with Tasmota firmware over http protocol
# 0.5.6 - 04/05/2018
- Added events ev_not_open_for_rain, ev_not_open_for_rain_sensor, ev_not_open_for_rain_online
- Added script rpinotify.sh for notificate events to telegram
# 0.5.5 - 25/03/2018
- Added "remote" driver to control remote pigarden
# 0.5.4 - 13/11/2017
- Fix bad initialization LOG_OUTPUT_DRV_FILE variable if not defined in config file
# 0.5.3 - 19/11/2017
- Fix send parameter on event init_before and init_after
- Added WEATHER argument in check_rain_sensor_after and check_rain_sensor_change event
- Added events cron_add_before, cron_add_after, cron_del_before, cron_del_after, ev_open_in_before, ev_open_in_after, exec_poweroff_before, exec_poweroff_after, exec_reboot_before, exec_reboot_after
- Added to sendmail.sh argument passed form check_rain_sensor_after and check_rain_sensor_change event
- Added to sendmail.sh new events
- Fix wrong state on event script sendmail.sh
# 0.5.2 - 01/11/2017
- Fix problem inconsistent return value in drv_rain_sensor_get
- Fix get parameter in event script sendmail.sh
# 0.5.1 - 28/10/2017
- Added events managemets
- Added support for zones not subject to rainfall (with parameter EVx_NORAIN)
# 0.5.0 - 12/10/2017
- Implemented driver subsystem for interfacing with other board
- Added driver spb16ch for interfacing with "Smart Power Board 16 channel with RTC"
- Added socket server api for close all zones and disable all scheduling
- Implement command and socket server api to perform system shutdown and reboot
- Fix problem with cron management on similar type cron
- Fix bug: in case of rain the weather data were not updated
- Fix bug: delete the temporary files for managing the socket server messages that were kept on the system
- Change manage of the lock/unlock function for encrase performance (do you need manualy remove the file /var/shm/piGarden.lock or /tmp/piGarden.lock)
- Add kicad electric schemas
## 0.4.4 - 17/06/2017
- Remove lock/unlock from init function for resove bug
## 0.4.3 - 17/06/2017
Fix path of sed in lock function
- Fix path of sed in lock function
## 0.4.2 - 16/06/2017
Fix another problem on generate installation identifier to sendo for statistic
- Fix another problem on generate installation identifier to sendo for statistic
## 0.4.1 - 14/06/2017
Fix problem on send identifier installation for statistic
- Fix problem on send identifier installation for statistic
## 0.4.0 - 14/06/2017
Add credentials support to socket server (define TCPSERVER_USER and TCPSERVER_PWD in your config file)
Add management lock/unlock for prevent concurrente call to open/close solenoid
Added the ability to enter an open / close schedule in disabled mode
Add send statistic information to remote server
During the initialization function, information on the last rain is no longer removed
- Add credentials support to socket server (define TCPSERVER_USER and TCPSERVER_PWD in your config file)
- Add management lock/unlock for prevent concurrente call to open/close solenoid
- Added the ability to enter an open / close schedule in disabled mode
- Add send statistic information to remote server
- During the initialization function, information on the last rain is no longer removed
## 0.3.1 - 13/05/2017
Add experimental support for monostable solenoid valve:
@@ -20,27 +96,27 @@ Add experimental support for monostable solenoid valve:
- if the solenoid valves close instead of opening and vice versa, reverse the values of the RELE_GPIO_CLOSE and RELE_GPIO_OPEN variables in your configuration file
## 0.3.0 - 07/05/2017
Add command "open_in" for scheduling on the fly the opens/close a solenoid
Add command "del_cron_open_in" for delete scheduling the fly the opens/close a solenoid
Add api in socket server for command open_in and delete_cron_open_in
Fix minor bug on command "open"
Changed the path of some temporary files to prevent sd card faults
- Add command "open_in" for scheduling on the fly the opens/close a solenoid
- Add command "del_cron_open_in" for delete scheduling the fly the opens/close a solenoid
- Add api in socket server for command open_in and delete_cron_open_in
- Fix minor bug on command "open"
- Changed the path of some temporary files to prevent sd card faults
## 0.2.2 - 25/04/2017
Fix bug: if it's reining, the solenoid valves were also closed even if they were pushed open in "force" mode
- Fix bug: if it's reining, the solenoid valves were also closed even if they were pushed open in "force" mode
## 0.2.1 - 22/04/2017
Add installation instructions in README.md file
- Add installation instructions in README.md file
## 0.2 (Easter egg) - 17/04/2017
Implementation of socket server for communicate with piGardenWeb
Implementation of messages (error, warning, success) passed to piGardenWeb
Added many information in json status to be passed to piGardenWeb
Added management cron for scheduling open and closed solenoid, for initialize control unit, for rain control
- Implementation of socket server for communicate with piGardenWeb
- Implementation of messages (error, warning, success) passed to piGardenWeb
- Added many information in json status to be passed to piGardenWeb
- Added management cron for scheduling open and closed solenoid, for initialize control unit, for rain control
## 0.1.1 - 24/12/2015 - BugFix
Fix the problem for 'av_status' parameter
- Fix the problem for 'av_status' parameter
## 0.1 - 18/12/2015 - First release
First release to piGarden
- First release to piGarden

View File

@@ -4,13 +4,13 @@ Bash script to manage an irrigation system built with a Raspberry Pi
## Official documentation
Documentation of piGarden and build system irrigation with Raspberry Pi can be found on the [www.lejubila.net/tag/pigarden/](http://www.lejubila.net/tag/pigarden/)
Documentation of piGarden and build system irrigation with Raspberry Pi can be found on the [www.lejubila.net/pigarden/](http://www.lejubila.net/pigarden/)
## License
This script is open-sourced software under GNU GENERAL PUBLIC LICENSE Version 2
## Installation
## Installation to Raspbian Jessie
1) Installs the necessary packages on your terminal:
@@ -26,7 +26,7 @@ sudo apt-get install flex -y
sudo apt-get install bison -y
sudo apt-get install gcc -y
sudo apt-get install make -y
sudo apt-get install autotools -y
sudo apt-get install libtool autoconf automake gettext autotools-dev -y
sudo apt-get install dh-autoreconf -y
wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-1.5.tar.gz
tar xfvz jq-1.5.tar.gz
@@ -41,8 +41,8 @@ sudo make install
``` bash
cd
git clone git://git.drogon.net/wiringPi
cd wiringPi
git clone https://github.com/WiringPi/WiringPi.git
cd WiringPi
git pull origin
./build
```
@@ -66,5 +66,3 @@ sudo cp piGarden/conf/piGarden.conf.example /etc/piGarden.conf
Customize the configuration file.
For more information see
[www.lejubila.net/2015/12/impianto-di-irrigazione-con-raspberry-pi-pigarden-lo-script-di-gestione-quinta-parte/](https://www.lejubila.net/2015/12/impianto-di-irrigazione-con-raspberry-pi-pigarden-lo-script-di-gestione-quinta-parte/)
and
[www.lejubila.net/2017/04/pigarden-0-2-easter-egg/](https://www.lejubila.net/2017/04/pigarden-0-2-easter-egg/)

View File

@@ -2,9 +2,23 @@
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
LOG_FILE_MAX_SIZE=1048576 # 1MB
#
# Enable send log to piGardenWeb
#
#LOG_URL="http://url_of_your_pigardenweb/api/log"
#LOG_API_TOKEN="token_of_pigardenweb_user"
#LOG_CURL_PARAM="--data-urlencode -k"
# Log file for driver output
LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
# Status directory
STATUS_DIR="/home/pi/piGarden/state"
# Event directory
EVENT_DIR="/home/pi/piGarden/events"
# Posizione gpio
GPIO="/usr/local/bin/gpio"
@@ -47,13 +61,21 @@ READLINK="/bin/readlink"
# Percorso stat
STAT="/usr/bin/stat"
# Percorso mosquito_pub
# # Installare con apt install mosquitto-clients
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
# se impostato a 0 il sistema gestirà elettrovalvole bistabili
EV_MONOSTABLE=0
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
SUPPLY_GPIO_1=2
SUPPLY_GPIO_2=3
SUPPLY_GPIO_1=2 # Physical 3 - wPi 8
SUPPLY_GPIO_2=3 # Physical 5 - wPi 9
# Stato dei due gpio per impartire l'alimentazione positiva alle elettrovalvole (aperta)
SUPPLY_GPIO_POS=0
@@ -68,7 +90,7 @@ RELE_GPIO_CLOSE=0
RELE_GPIO_OPEN=1
# Id del gpio usato per collegare il sensore di rilevamento pioggia
RAIN_GPIO=25
RAIN_GPIO=25 # Physical 22 - wPi 6
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
RAIN_GPIO_STATE=0
@@ -82,26 +104,40 @@ EV_TOTAL=6
# Definizione delle elettrovalvole
EV1_ALIAS="1" #
EV1_GPIO=17
EV1_GPIO=17 # Physical 11 - wPi 0
#EV1_NORAIN=1 # Non interrompe l'irrigazione di questa zona in caso di pioggia
#EV1_MONOSTABLE=1 # L'elettrovalvola è monostabile
EV2_ALIAS="2" #
EV2_GPIO=27
EV2_GPIO=27 # Physical 13 - wPi 2
EV3_ALIAS="3" #
EV3_GPIO=22
EV3_GPIO=22 # Physical 15 - wPi 3
EV4_ALIAS="4" #
EV4_GPIO=18
EV4_GPIO=18 # Physical 12 - wPi 1
EV5_ALIAS="5" #
EV5_GPIO=23
EV5_GPIO=23 # Physical 16 - wPi 4
EV6_ALIAS="6" #
EV6_GPIO=24
EV6_GPIO=24 # Physical 18 - wPi 5
# Definisce l'api key e il luogo per recuperare lo stato meteo online
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
# Se non vuoi configurare nessun servizio imposta il vale "none"
WEATHER_SERVICE="openweathermap"
#WEATHER_SERVICE="none" # Nessun servizio configurato
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
OPENWEATHERMAP_KEY=""
OPENWEATHERMAP_LOCATION="q=Pieve%20a%20Nievole,it" # https://openweathermap.org/current
OPENWEATHERMAP_TZ="Europe/Rome" # Time zone
# Parametri di wunderground, definisce l'api key e il luogo per recuperare lo stato meteo online
WUNDERGROUND_KEY=""
WUNDERGROUND_LOCATION="IY/Monsummano" # http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching&MR=1
WUNDERGROUND_LOCATION="IT/Pieve%20a%20Nievole" # http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching&MR=1
# Blocca l'irrigazione se l'ultima pioggia rilevata online è avvenuta nell'ultima quantità di tempo inserita.
# Il tempo è espresso in secondi. Quindi inserendo 86400, se nelle ultime 24 ore ha piovuto viene bloccata l'irrigazione. Inserendo il valore zero non viene eseguito nessun controllo.
@@ -121,3 +157,12 @@ TCPSERVER_PWD=""
# Con impostato il valore 1 non invia l'identificativi per statistiche di utilizzo
NO_SEND_IDENTIFIER=0
# Parametri connessione al broker mqtt
MQTT_ENABLE=0 # set 1 to enable
MQTT_HOST=you_host_mqtt
MQTT_PORT=1883
MQTT_USER=your_user_mqtt
MQTT_PWD=yout_password_mqtt
MQTT_TOPIC="pigarden/result"
MQTT_CLIENT_ID=piGarden

View File

@@ -0,0 +1,174 @@
# Log file
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
LOG_FILE_MAX_SIZE=1048576 # 1MB
#
# Enable send log to piGardenWeb
#
#LOG_URL="http://url_of_your_pigardenweb/api/log"
#LOG_API_TOKEN="token_of_pigardenweb_user"
#LOG_CURL_PARAM="--data-urlencode -k"
# Log file for driver output
LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
# Status directory
STATUS_DIR="/home/pi/piGarden/state"
# Event directory
EVENT_DIR="/home/pi/piGarden/events"
# Posizione gpio
GPIO="/usr/local/bin/gpio"
# Posizione js
JQ="/usr/local/bin/jq"
# Percorso curl
CURL="/usr/bin/curl"
# Percorso wc
WC="/usr/bin/wc"
# Percorso gzip
GZIP="/bin/gzip"
# Percorso mv
MV="/bin/mv"
# Percorso di tr
TR="/usr/bin/tr"
# Percorso di cut
CUT="/usr/bin/cut"
# Percorso tcpserver
TCPSERVER="/usr/bin/tcpserver"
# Percorso cron
CRONTAB="/usr/bin/crontab"
# Percorso grep
GREP="/bin/grep"
# Percorsp sed
SED="/bin/sed"
# Percorso readlink
READLINK="/bin/readlink"
# Percorso stat
STAT="/usr/bin/stat"
# Percorso mosquito_pub
# # Installare con apt install mosquitto-clients
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
# se impostato a 0 il sistema gestirà elettrovalvole bistabili
EV_MONOSTABLE=0
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
SUPPLY_GPIO_1=2 # Physical 3 - wPi 8
SUPPLY_GPIO_2=3 # Physical 5 - wPi 9
# Stato dei due gpio per impartire l'alimentazione positiva alle elettrovalvole (aperta)
SUPPLY_GPIO_POS=0
# Stato dei due gpio per impartire l'alimentazione negativa alle elettrovalvole (chiusa)
SUPPLY_GPIO_NEG=1
# Stato di ingresso da assegnare al gpio per chiudere il rele
RELE_GPIO_CLOSE=0
# Stato di ingresso da assegnare al gpio per aprire il rele
RELE_GPIO_OPEN=1
# Id del gpio usato per collegare il sensore di rilevamento pioggia
# attraverso il driver rainsensorqty
RAIN_GPIO="drv:rainsensorqty:25" # Physical 22 - wPi 6
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
# variabile usata anche da drv:rainsensorqty, se e' a 1, significa che il reed contact e' collegato ad un circuito pull-down, vuol dire che attende l'impulso a 1 per contare le vaschette, normalmente e' a 0.
# se e' a 0, significa che il reed contact e' collegato ad un circuito pull-up, vuol dire che attende l'impulso a 0 per contare le vaschette, normalmente e' a 0.
RAIN_GPIO_STATE=0
RAINSENSORQTY_LOOPSFORSETRAINING=16 # dopo 16 impulsi, 16 vaschette riempite si considera pioggia
RAINSENSORQTY_SECSBETWEENRAINEVENT=10800 # =3h, significa che dopo 3 ore si resetta il numero di vaschette riempire e solo dopo un nuovo ciclo di riempimento si considera una nuova pioggia
RAINSENSORQTY_MMEACH=0.33 # see RAINSENSORQTY driver readme for details
# Numero totale di elettrovalvole
EV_TOTAL=6
# Definizione delle elettrovalvole
EV1_ALIAS="1" #
EV1_GPIO=17 # Physical 11 - wPi 0
#EV1_NORAIN=1 # Non interrompe l'irrigazione di questa zona in caso di pioggia
#EV1_MONOSTABLE=1 # L'elettrovalvola è monostabile
EV2_ALIAS="2" #
EV2_GPIO=27 # Physical 13 - wPi 2
EV3_ALIAS="3" #
EV3_GPIO=22 # Physical 15 - wPi 3
EV4_ALIAS="4" #
EV4_GPIO=18 # Physical 12 - wPi 1
EV5_ALIAS="5" #
EV5_GPIO=23 # Physical 16 - wPi 4
EV6_ALIAS="6" #
EV6_GPIO=24 # Physical 18 - wPi 5
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
# Se non vuoi configurare nessun servizio imposta il vale "none"
WEATHER_SERVICE="openweathermap"
#WEATHER_SERVICE="none" # Nessun servizio configurato
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
OPENWEATHERMAP_KEY=""
OPENWEATHERMAP_LOCATION="q=Pieve%20a%20Nievole,it" # https://openweathermap.org/current
OPENWEATHERMAP_TZ="Europe/Rome" # Time zone
# Parametri di wunderground, definisce l'api key e il luogo per recuperare lo stato meteo online
WUNDERGROUND_KEY=""
WUNDERGROUND_LOCATION="IT/Pieve%20a%20Nievole" # http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching&MR=1
# Blocca l'irrigazione se l'ultima pioggia rilevata online è avvenuta nell'ultima quantità di tempo inserita.
# Il tempo è espresso in secondi. Quindi inserendo 86400, se nelle ultime 24 ore ha piovuto viene bloccata l'irrigazione. Inserendo il valore zero non viene eseguito nessun controllo.
NOT_IRRIGATE_IF_RAIN_ONLINE=86400
# Il parametro è simile a quello precedente, il controllo però anziché essere fatto attingendo a wunderground, viene eseguito direttamente sul sensore se installato. Inserendo il valore zero non viene eseguito nessun controllo.
NOT_IRRIGATE_IF_RAIN_SENSOR=86400
# Indirizzo ip e porta di ascolto del socket server
TCPSERVER_IP="127.0.0.1"
TCPSERVER_PORT="8084"
# Utente e password che i clients devono utilizzare per stabilire una connessione tramite socket server
TCPSERVER_USER=""
TCPSERVER_PWD=""
# Con impostato il valore 1 non invia l'identificativi per statistiche di utilizzo
NO_SEND_IDENTIFIER=0
# Parametri connessione al broker mqtt
MQTT_ENABLE=0 # set 1 to enable
MQTT_HOST=you_host_mqtt
MQTT_PORT=1883
MQTT_USER=your_user_mqtt
MQTT_PWD=yout_password_mqtt
MQTT_TOPIC="pigarden/result"
MQTT_CLIENT_ID=piGarden

View File

@@ -0,0 +1,177 @@
# Log file
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
LOG_FILE_MAX_SIZE=1048576 # 1MB
#
# Enable send log to piGardenWeb
#
#LOG_URL="http://url_of_your_pigardenweb/api/log"
#LOG_API_TOKEN="token_of_pigardenweb_user"
#LOG_CURL_PARAM="--data-urlencode -k"
# Log file for driver output
#LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
# Status directory
STATUS_DIR="/home/pi/piGarden/state"
# Event directory
EVENT_DIR="/home/pi/piGarden/events"
# Posizione gpio
GPIO="/usr/local/bin/gpio"
# Posizione js
JQ="/usr/local/bin/jq"
# Percorso curl
CURL="/usr/bin/curl"
# Percorso wc
WC="/usr/bin/wc"
# Percorso gzip
GZIP="/bin/gzip"
# Percorso mv
MV="/bin/mv"
# Percorso di tr
TR="/usr/bin/tr"
# Percorso di cut
CUT="/usr/bin/cut"
# Percorso tcpserver
TCPSERVER="/usr/bin/tcpserver"
# Percorso cron
CRONTAB="/usr/bin/crontab"
# Percorso grep
GREP="/bin/grep"
# Percorsp sed
SED="/bin/sed"
# Percorso readlink
READLINK="/bin/readlink"
# Percorso stat
STAT="/usr/bin/stat"
# Percorso mosquito_pub
# Installare con apt install mosquitto-clients
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
EV_MONOSTABLE=0
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
SUPPLY_GPIO_1=2
SUPPLY_GPIO_2=3
# Stato dei due gpio per impartire l'alimentazione positiva alle elettrovalvole (aperta)
SUPPLY_GPIO_POS=0
# Stato dei due gpio per impartire l'alimentazione negativa alle elettrovalvole (chiusa)
SUPPLY_GPIO_NEG=1
# Stato di ingresso da assegnare al gpio per chiudere il rele
RELE_GPIO_CLOSE=0
# Stato di ingresso da assegnare al gpio per aprire il rele
RELE_GPIO_OPEN=1
# Id del gpio usato per collegare il sensore di rilevamento pioggia
RAIN_GPIO=25 # Physical 22 - wPi 6
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
RAIN_GPIO_STATE=0
# Numero totale di elettrovalvole
EV_TOTAL=4
# Definizione delle elettrovalvole
EV1_ALIAS="Giardino_Posteriore_DX" #
EV1_GPIO="drv:remote:PIREMOTE1:Giardino_Posteriore_DX"
#EV1_NORAIN=1 # Non interrompe l'irrigazione di questa zona in caso di pioggia
EV2_ALIAS="Giardino_Posteriore_CN" #
EV2_GPIO="drv:remote:PIREMOTE2:Giardino_Posteriore_CN"
EV3_ALIAS="Giardino_Posteriore_SX" #
EV3_GPIO="drv:remote:PIREMOTE2:Giardino_Posteriore_SX"
EV4_ALIAS="Giardino_Posteriore_GPIO" #
EV4_GPIO="18"
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
# Se non vuoi configurare nessun servizio imposta il vale "none"
WEATHER_SERVICE="openweathermap"
#WEATHER_SERVICE="none" # Nessun servizio configurato
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
OPENWEATHERMAP_KEY=""
OPENWEATHERMAP_LOCATION="q=Pieve%20a%20Nievole,it" # https://openweathermap.org/current
OPENWEATHERMAP_TZ="Europe/Rome" # Time zone
# Parametri di wunderground, definisce l'api key e il luogo per recuperare lo stato meteo online
WUNDERGROUND_KEY=""
WUNDERGROUND_LOCATION="IT/Pieve%20a%20Nievole" # http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching&MR=1
# Blocca l'irrigazione se l'ultima pioggia rilevata online è avvenuta nell'ultima quantità di tempo inserita.
# Il tempo è espresso in secondi. Quindi inserendo 86400, se nelle ultime 24 ore ha piovuto viene bloccata l'irrigazione. Inserendo il valore zero non viene eseguito nessun controllo.
NOT_IRRIGATE_IF_RAIN_ONLINE=86400
# Il parametro è simile a quello precedente, il controllo però anziché essere fatto attingendo a wunderground, viene eseguito direttamente sul sensore se installato. Inserendo il valore zero non viene eseguito nessun controllo.
NOT_IRRIGATE_IF_RAIN_SENSOR=86400
# Indirizzo ip e porta di ascolto del socket server
TCPSERVER_IP="127.0.0.1"
TCPSERVER_PORT="8084"
# Utente e password che i clients devono utilizzare per stabilire una connessione tramite socket server
TCPSERVER_USER=""
TCPSERVER_PWD=""
# Con impostato il valore 1 non invia l'identificativi per statistiche di utilizzo
NO_SEND_IDENTIFIER=0
# Parametri connessione al broker mqtt
MQTT_ENABLE=0 # set 1 to enable
MQTT_HOST=you_host_mqtt
MQTT_PORT=1883
MQTT_USER=your_user_mqtt
MQTT_PWD=yout_password_mqtt
MQTT_TOPIC="pigarden/result"
MQTT_CLIENT_ID=piGarden
#
# Configurazione piGarden remoti
#
PIREMOTE1_IP="192.168.1.51"
PIREMOTE1_PORT="8084"
PIREMOTE1_USER=""
PIREMOTE1_PWD=""
PIREMOTE2_IP="192.168.1.52"
PIREMOTE2_PORT="8084"
PIREMOTE2_USER=""
PIREMOTE2_PWD=""

View File

@@ -0,0 +1,177 @@
# Log file
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
LOG_FILE_MAX_SIZE=1048576 # 1MB
#
# Enable send log to piGardenWeb
#
#LOG_URL="http://url_of_your_pigardenweb/api/log"
#LOG_API_TOKEN="token_of_pigardenweb_user"
#LOG_CURL_PARAM="--data-urlencode -k"
# Log file for driver output
#LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
# Status directory
STATUS_DIR="/home/pi/piGarden/state"
# Event directory
EVENT_DIR="/home/pi/piGarden/events"
# Posizione gpio
GPIO="/usr/local/bin/gpio"
# Posizione js
JQ="/usr/local/bin/jq"
# Percorso curl
CURL="/usr/bin/curl"
# Percorso wc
WC="/usr/bin/wc"
# Percorso gzip
GZIP="/bin/gzip"
# Percorso mv
MV="/bin/mv"
# Percorso di tr
TR="/usr/bin/tr"
# Percorso di cut
CUT="/usr/bin/cut"
# Percorso tcpserver
TCPSERVER="/usr/bin/tcpserver"
# Percorso cron
CRONTAB="/usr/bin/crontab"
# Percorso grep
GREP="/bin/grep"
# Percorsp sed
SED="/bin/sed"
# Percorso readlink
READLINK="/bin/readlink"
# Percorso stat
STAT="/usr/bin/stat"
# Percorso mosquito_pub
# # Installare con apt install mosquitto-clients
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
EV_MONOSTABLE=0
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
SUPPLY_GPIO_1=2
SUPPLY_GPIO_2=3
# Stato dei due gpio per impartire l'alimentazione positiva alle elettrovalvole (aperta)
SUPPLY_GPIO_POS=0
# Stato dei due gpio per impartire l'alimentazione negativa alle elettrovalvole (chiusa)
SUPPLY_GPIO_NEG=1
# Stato di ingresso da assegnare al gpio per chiudere il rele
RELE_GPIO_CLOSE=0
# Stato di ingresso da assegnare al gpio per aprire il rele
RELE_GPIO_OPEN=1
# Id del gpio usato per collegare il sensore di rilevamento pioggia
RAIN_GPIO=25 # Physical 22 - wPi 6
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
RAIN_GPIO_STATE=0
# Numero totale di elettrovalvole
EV_TOTAL=4
# Definizione delle elettrovalvole
EV1_ALIAS="Giardino_Posteriore_DX"
EV1_GPIO="drv:sonoff_tasmota_http:SONOFF1:Power1"
EV1_MONOSTABLE=1
EV2_ALIAS="Giardino_Posteriore_CN"
EV2_GPIO="drv:sonoff_tasmota_http:SONOFF1:Power2"
EV2_MONOSTABLE=1
EV3_ALIAS="Giardino_Posteriore_SX"
EV3_GPIO="drv:sonoff_tasmota_http:SONOFF1:Power3"
EV3_MONOSTABLE=1
EV4_ALIAS="Giardino_Anteriore"
EV4_GPIO="drv:sonoff_tasmota_http:SONOFF2:Power1"
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
# Se non vuoi configurare nessun servizio imposta il vale "none"
WEATHER_SERVICE="openweathermap"
#WEATHER_SERVICE="none" # Nessun servizio configurato
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
OPENWEATHERMAP_KEY=""
OPENWEATHERMAP_LOCATION="q=Pieve%20a%20Nievole,it" # https://openweathermap.org/current
OPENWEATHERMAP_TZ="Europe/Rome" # Time zone
# Parametri di wunderground, definisce l'api key e il luogo per recuperare lo stato meteo online
WUNDERGROUND_KEY=""
WUNDERGROUND_LOCATION="IT/Pieve%20a%20Nievole" # http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching&MR=1
# Blocca l'irrigazione se l'ultima pioggia rilevata online è avvenuta nell'ultima quantità di tempo inserita.
# Il tempo è espresso in secondi. Quindi inserendo 86400, se nelle ultime 24 ore ha piovuto viene bloccata l'irrigazione. Inserendo il valore zero non viene eseguito nessun controllo.
NOT_IRRIGATE_IF_RAIN_ONLINE=86400
# Il parametro è simile a quello precedente, il controllo però anziché essere fatto attingendo a wunderground, viene eseguito direttamente sul sensore se installato. Inserendo il valore zero non viene eseguito nessun controllo.
NOT_IRRIGATE_IF_RAIN_SENSOR=86400
# Indirizzo ip e porta di ascolto del socket server
TCPSERVER_IP="127.0.0.1"
TCPSERVER_PORT="8084"
# Utente e password che i clients devono utilizzare per stabilire una connessione tramite socket server
TCPSERVER_USER=""
TCPSERVER_PWD=""
# Con impostato il valore 1 non invia l'identificativi per statistiche di utilizzo
NO_SEND_IDENTIFIER=0
# Parametri connessione al broker mqtt
MQTT_ENABLE=0 # set 1 to enable
MQTT_HOST=you_host_mqtt
MQTT_PORT=1883
MQTT_USER=your_user_mqtt
MQTT_PWD=yout_password_mqtt
MQTT_TOPIC="pigarden/result"
MQTT_CLIENT_ID=piGarden
#
# Configurazione moduli sonoff
#
SONOFF1_IP="192.168.1.1"
SONOFF1_USER="user"
SONOFF1_PWD="pwd"
SONOFF2_IP="192.168.1.21"
SONOFF2_USER=""
SONOFF2_PWD=""

View File

@@ -0,0 +1,550 @@
# Log file
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
LOG_FILE_MAX_SIZE=1048576 # 1MB
#
# Enable send log to piGardenWeb
#
#LOG_URL="http://url_of_your_pigardenweb/api/log"
#LOG_API_TOKEN="token_of_pigardenweb_user"
#LOG_CURL_PARAM="--data-urlencode -k"
# Log file for driver output
#LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
# Status directory
STATUS_DIR="/home/pi/piGarden/state"
# Event directory
EVENT_DIR="/home/pi/piGarden/events"
# Posizione gpio
GPIO="/usr/local/bin/gpio"
# Posizione js
JQ="/usr/local/bin/jq"
# Percorso curl
CURL="/usr/bin/curl"
# Percorso wc
WC="/usr/bin/wc"
# Percorso gzip
GZIP="/bin/gzip"
# Percorso mv
MV="/bin/mv"
# Percorso di tr
TR="/usr/bin/tr"
# Percorso di cut
CUT="/usr/bin/cut"
# Percorso tcpserver
TCPSERVER="/usr/bin/tcpserver"
# Percorso cron
CRONTAB="/usr/bin/crontab"
# Percorso grep
GREP="/bin/grep"
# Percorsp sed
SED="/bin/sed"
# Percorso readlink
READLINK="/bin/readlink"
# Percorso stat
STAT="/usr/bin/stat"
# Percorso mosquito_pub
# Installare con apt install mosquitto-clients
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
EV_MONOSTABLE=1
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
SUPPLY_GPIO_1="drv:spb16ch:15"
SUPPLY_GPIO_2="drv:spb16ch:16"
# Stato dei due gpio per impartire l'alimentazione positiva alle elettrovalvole (aperta)
SUPPLY_GPIO_POS=0
# Stato dei due gpio per impartire l'alimentazione negativa alle elettrovalvole (chiusa)
SUPPLY_GPIO_NEG=1
# Stato di ingresso da assegnare al gpio per chiudere il rele
RELE_GPIO_CLOSE=0
# Stato di ingresso da assegnare al gpio per aprire il rele
RELE_GPIO_OPEN=1
# Id del gpio usato per collegare il sensore di rilevamento pioggia
RAIN_GPIO=
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
RAIN_GPIO_STATE=0
# Numero totale di elettrovalvole
EV_TOTAL=128
# Definizione delle elettrovalvole
EV1_ALIAS="Zona_1" #
EV1_GPIO="drv:spb16ch:1"
#EV1_NORAIN=1 # Non interrompe l'irrigazione di questa zona in caso di pioggia
EV2_ALIAS="Zona_2" #
EV2_GPIO="drv:spb16ch:2"
EV3_ALIAS="Zona_3" #
EV3_GPIO="drv:spb16ch:3"
EV4_ALIAS="Zona_4" #
EV4_GPIO="drv:spb16ch:4"
EV5_ALIAS="Zona_5" #
EV5_GPIO="drv:spb16ch:5"
EV6_ALIAS="Zona_6" #
EV6_GPIO="drv:spb16ch:6"
EV7_ALIAS="Zona_7" #
EV7_GPIO="drv:spb16ch:7"
EV8_ALIAS="Zona_8" #
EV8_GPIO="drv:spb16ch:8"
EV9_ALIAS="Zona_9" #
EV9_GPIO="drv:spb16ch:9"
EV10_ALIAS="Zona_10" #
EV10_GPIO="drv:spb16ch:10"
EV11_ALIAS="Zona_11" #
EV11_GPIO="drv:spb16ch:11"
EV12_ALIAS="Zona_12" #
EV12_GPIO="drv:spb16ch:12"
EV13_ALIAS="Zona_13" #
EV13_GPIO="drv:spb16ch:13"
EV14_ALIAS="Zona_14" #
EV14_GPIO="drv:spb16ch:14"
EV15_ALIAS="Zona_15" #
EV15_GPIO="drv:spb16ch:15"
EV16_ALIAS="Zona_16" #
EV16_GPIO="drv:spb16ch:16"
EV17_ALIAS="Zona_17" #
EV17_GPIO="drv:spb16ch:17"
EV18_ALIAS="Zona_18" #
EV18_GPIO="drv:spb16ch:18"
EV19_ALIAS="Zona_19" #
EV19_GPIO="drv:spb16ch:19"
EV20_ALIAS="Zona_20" #
EV20_GPIO="drv:spb16ch:20"
EV21_ALIAS="Zona_21" #
EV21_GPIO="drv:spb16ch:21"
EV22_ALIAS="Zona_22" #
EV22_GPIO="drv:spb16ch:22"
EV23_ALIAS="Zona_23" #
EV23_GPIO="drv:spb16ch:23"
EV24_ALIAS="Zona_24" #
EV24_GPIO="drv:spb16ch:24"
EV25_ALIAS="Zona_25" #
EV25_GPIO="drv:spb16ch:25"
EV26_ALIAS="Zona_26" #
EV26_GPIO="drv:spb16ch:26"
EV27_ALIAS="Zona_27" #
EV27_GPIO="drv:spb16ch:27"
EV28_ALIAS="Zona_28" #
EV28_GPIO="drv:spb16ch:28"
EV29_ALIAS="Zona_29" #
EV29_GPIO="drv:spb16ch:29"
EV30_ALIAS="Zona_30" #
EV30_GPIO="drv:spb16ch:30"
EV31_ALIAS="Zona_31" #
EV31_GPIO="drv:spb16ch:31"
EV32_ALIAS="Zona_32" #
EV32_GPIO="drv:spb16ch:32"
EV33_ALIAS="Zona_33" #
EV33_GPIO="drv:spb16ch:33"
EV34_ALIAS="Zona_34" #
EV34_GPIO="drv:spb16ch:34"
EV35_ALIAS="Zona_35" #
EV35_GPIO="drv:spb16ch:35"
EV36_ALIAS="Zona_36" #
EV36_GPIO="drv:spb16ch:36"
EV37_ALIAS="Zona_37" #
EV37_GPIO="drv:spb16ch:37"
EV38_ALIAS="Zona_38" #
EV38_GPIO="drv:spb16ch:38"
EV39_ALIAS="Zona_39" #
EV39_GPIO="drv:spb16ch:39"
EV40_ALIAS="Zona_40" #
EV40_GPIO="drv:spb16ch:40"
EV41_ALIAS="Zona_41" #
EV41_GPIO="drv:spb16ch:41"
EV42_ALIAS="Zona_42" #
EV42_GPIO="drv:spb16ch:42"
EV43_ALIAS="Zona_43" #
EV43_GPIO="drv:spb16ch:43"
EV44_ALIAS="Zona_44" #
EV44_GPIO="drv:spb16ch:44"
EV45_ALIAS="Zona_45" #
EV45_GPIO="drv:spb16ch:45"
EV46_ALIAS="Zona_46" #
EV46_GPIO="drv:spb16ch:46"
EV47_ALIAS="Zona_47" #
EV47_GPIO="drv:spb16ch:47"
EV48_ALIAS="Zona_48" #
EV48_GPIO="drv:spb16ch:48"
EV49_ALIAS="Zona_49" #
EV49_GPIO="drv:spb16ch:49"
EV50_ALIAS="Zona_50" #
EV50_GPIO="drv:spb16ch:50"
EV51_ALIAS="Zona_51" #
EV51_GPIO="drv:spb16ch:51"
EV52_ALIAS="Zona_52" #
EV52_GPIO="drv:spb16ch:52"
EV53_ALIAS="Zona_53" #
EV53_GPIO="drv:spb16ch:53"
EV54_ALIAS="Zona_54" #
EV54_GPIO="drv:spb16ch:54"
EV55_ALIAS="Zona_55" #
EV55_GPIO="drv:spb16ch:55"
EV56_ALIAS="Zona_56" #
EV56_GPIO="drv:spb16ch:56"
EV57_ALIAS="Zona_57" #
EV57_GPIO="drv:spb16ch:57"
EV58_ALIAS="Zona_58" #
EV58_GPIO="drv:spb16ch:58"
EV59_ALIAS="Zona_59" #
EV59_GPIO="drv:spb16ch:59"
EV60_ALIAS="Zona_60" #
EV60_GPIO="drv:spb16ch:60"
EV61_ALIAS="Zona_61" #
EV61_GPIO="drv:spb16ch:61"
EV62_ALIAS="Zona_62" #
EV62_GPIO="drv:spb16ch:62"
EV63_ALIAS="Zona_63" #
EV63_GPIO="drv:spb16ch:63"
EV64_ALIAS="Zona_64" #
EV64_GPIO="drv:spb16ch:64"
EV65_ALIAS="Zona_65" #
EV65_GPIO="drv:spb16ch:65"
EV66_ALIAS="Zona_66" #
EV66_GPIO="drv:spb16ch:66"
EV67_ALIAS="Zona_67" #
EV67_GPIO="drv:spb16ch:67"
EV68_ALIAS="Zona_68" #
EV68_GPIO="drv:spb16ch:68"
EV69_ALIAS="Zona_69" #
EV69_GPIO="drv:spb16ch:69"
EV70_ALIAS="Zona_70" #
EV70_GPIO="drv:spb16ch:70"
EV71_ALIAS="Zona_71" #
EV71_GPIO="drv:spb16ch:71"
EV72_ALIAS="Zona_72" #
EV72_GPIO="drv:spb16ch:72"
EV73_ALIAS="Zona_73" #
EV73_GPIO="drv:spb16ch:73"
EV74_ALIAS="Zona_74" #
EV74_GPIO="drv:spb16ch:74"
EV75_ALIAS="Zona_75" #
EV75_GPIO="drv:spb16ch:75"
EV76_ALIAS="Zona_76" #
EV76_GPIO="drv:spb16ch:76"
EV77_ALIAS="Zona_77" #
EV77_GPIO="drv:spb16ch:77"
EV78_ALIAS="Zona_78" #
EV78_GPIO="drv:spb16ch:78"
EV79_ALIAS="Zona_79" #
EV79_GPIO="drv:spb16ch:79"
EV80_ALIAS="Zona_80" #
EV80_GPIO="drv:spb16ch:80"
EV81_ALIAS="Zona_81" #
EV81_GPIO="drv:spb16ch:81"
EV82_ALIAS="Zona_82" #
EV82_GPIO="drv:spb16ch:82"
EV83_ALIAS="Zona_83" #
EV83_GPIO="drv:spb16ch:83"
EV84_ALIAS="Zona_84" #
EV84_GPIO="drv:spb16ch:84"
EV85_ALIAS="Zona_85" #
EV85_GPIO="drv:spb16ch:85"
EV86_ALIAS="Zona_86" #
EV86_GPIO="drv:spb16ch:86"
EV87_ALIAS="Zona_87" #
EV87_GPIO="drv:spb16ch:87"
EV88_ALIAS="Zona_88" #
EV88_GPIO="drv:spb16ch:88"
EV89_ALIAS="Zona_89" #
EV89_GPIO="drv:spb16ch:89"
EV90_ALIAS="Zona_90" #
EV90_GPIO="drv:spb16ch:90"
EV91_ALIAS="Zona_91" #
EV91_GPIO="drv:spb16ch:91"
EV92_ALIAS="Zona_92" #
EV92_GPIO="drv:spb16ch:92"
EV93_ALIAS="Zona_93" #
EV93_GPIO="drv:spb16ch:93"
EV94_ALIAS="Zona_94" #
EV94_GPIO="drv:spb16ch:94"
EV95_ALIAS="Zona_95" #
EV95_GPIO="drv:spb16ch:95"
EV96_ALIAS="Zona_96" #
EV96_GPIO="drv:spb16ch:96"
EV97_ALIAS="Zona_97" #
EV97_GPIO="drv:spb16ch:97"
EV98_ALIAS="Zona_98" #
EV98_GPIO="drv:spb16ch:98"
EV99_ALIAS="Zona_99" #
EV99_GPIO="drv:spb16ch:99"
EV100_ALIAS="Zona_100" #
EV100_GPIO="drv:spb16ch:100"
EV101_ALIAS="Zona_101" #
EV101_GPIO="drv:spb16ch:101"
EV102_ALIAS="Zona_102" #
EV102_GPIO="drv:spb16ch:102"
EV103_ALIAS="Zona_103" #
EV103_GPIO="drv:spb16ch:103"
EV104_ALIAS="Zona_104" #
EV104_GPIO="drv:spb16ch:104"
EV105_ALIAS="Zona_105" #
EV105_GPIO="drv:spb16ch:105"
EV106_ALIAS="Zona_106" #
EV106_GPIO="drv:spb16ch:106"
EV107_ALIAS="Zona_107" #
EV107_GPIO="drv:spb16ch:107"
EV108_ALIAS="Zona_108" #
EV108_GPIO="drv:spb16ch:108"
EV109_ALIAS="Zona_109" #
EV109_GPIO="drv:spb16ch:109"
EV110_ALIAS="Zona_110" #
EV110_GPIO="drv:spb16ch:110"
EV111_ALIAS="Zona_111" #
EV111_GPIO="drv:spb16ch:111"
EV112_ALIAS="Zona_112" #
EV112_GPIO="drv:spb16ch:112"
EV113_ALIAS="Zona_113" #
EV113_GPIO="drv:spb16ch:113"
EV114_ALIAS="Zona_114" #
EV114_GPIO="drv:spb16ch:114"
EV115_ALIAS="Zona_115" #
EV115_GPIO="drv:spb16ch:115"
EV116_ALIAS="Zona_116" #
EV116_GPIO="drv:spb16ch:116"
EV117_ALIAS="Zona_117" #
EV117_GPIO="drv:spb16ch:117"
EV118_ALIAS="Zona_118" #
EV118_GPIO="drv:spb16ch:118"
EV119_ALIAS="Zona_119" #
EV119_GPIO="drv:spb16ch:119"
EV120_ALIAS="Zona_120" #
EV120_GPIO="drv:spb16ch:120"
EV121_ALIAS="Zona_121" #
EV121_GPIO="drv:spb16ch:121"
EV122_ALIAS="Zona_122" #
EV122_GPIO="drv:spb16ch:122"
EV123_ALIAS="Zona_123" #
EV123_GPIO="drv:spb16ch:123"
EV124_ALIAS="Zona_124" #
EV124_GPIO="drv:spb16ch:124"
EV125_ALIAS="Zona_125" #
EV125_GPIO="drv:spb16ch:125"
EV126_ALIAS="Zona_126" #
EV126_GPIO="drv:spb16ch:126"
EV127_ALIAS="Zona_127" #
EV127_GPIO="drv:spb16ch:127"
EV128_ALIAS="Zona_128" #
EV128_GPIO="drv:spb16ch:128"
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
# Se non vuoi configurare nessun servizio imposta il vale "none"
WEATHER_SERVICE="openweathermap"
#WEATHER_SERVICE="none" # Nessun servizio configurato
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
OPENWEATHERMAP_KEY=""
OPENWEATHERMAP_LOCATION="q=Pieve%20a%20Nievole,it" # https://openweathermap.org/current
OPENWEATHERMAP_TZ="Europe/Rome" # Time zone
# Parametri di wunderground, definisce l'api key e il luogo per recuperare lo stato meteo online
WUNDERGROUND_KEY=""
WUNDERGROUND_LOCATION="IT/Pieve%20a%20Nievole" # http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching&MR=1
# Blocca l'irrigazione se l'ultima pioggia rilevata online è avvenuta nell'ultima quantità di tempo inserita.
# Il tempo è espresso in secondi. Quindi inserendo 86400, se nelle ultime 24 ore ha piovuto viene bloccata l'irrigazione. Inserendo il valore zero non viene eseguito nessun controllo.
NOT_IRRIGATE_IF_RAIN_ONLINE=86400
# Il parametro è simile a quello precedente, il controllo però anziché essere fatto attingendo a wunderground, viene eseguito direttamente sul sensore se installato. Inserendo il valore zero non viene eseguito nessun controllo.
NOT_IRRIGATE_IF_RAIN_SENSOR=86400
# Indirizzo ip e porta di ascolto del socket server
TCPSERVER_IP="127.0.0.1"
TCPSERVER_PORT="8084"
# Utente e password che i clients devono utilizzare per stabilire una connessione tramite socket server
TCPSERVER_USER=""
TCPSERVER_PWD=""
# Con impostato il valore 1 non invia l'identificativi per statistiche di utilizzo
NO_SEND_IDENTIFIER=0
# Parametri connessione al broker mqtt
MQTT_ENABLE=0 # set 1 to enable
MQTT_HOST=you_host_mqtt
MQTT_PORT=1883
MQTT_USER=your_user_mqtt
MQTT_PWD=yout_password_mqtt
MQTT_TOPIC="pigarden/result"
MQTT_CLIENT_ID=piGarden
#
# Configurazione schede spb16ch
#
# Stato da assegnare ai gpio per abilitare/disabilitare le schede spb16ch
SPB16CH_GPIO_ON=1
SPB16CH_GPIO_OFF=0
# Gpio di per gestire l'abilitazione/disabilitazione delle chede spb16ch
SPB16CH1_GPIO=17 # Physical 11 - wPi 0
SPB16CH2_GPIO=27 # Physical 13 - wPi 2
SPB16CH3_GPIO=22 # Physical 15 - wPi 3
SPB16CH4_GPIO=18 # Physical 12 - wPi 1
SPB16CH5_GPIO=23 # Physical 16 - wPi 4
SPB16CH6_GPIO=24 # Physical 18 - wPi 5
SPB16CH7_GPIO=4 # Physical 7 - wPi 7
SPB16CH8_GPIO=14 # Physical 8 - wPi 15

View File

@@ -0,0 +1,13 @@
# Driver for check wather condition with openweathermap online service
# Example of configuration in piGarden.conf
```bash
WEATHER_SERVICE="openweathermap"
OPENWEATHERMAP_KEY="d4d22ea805788420267971135563b4cc" # Set with your api key of openweathermap
OPENWEATHERMAP_LOCATION="q=Pieve%20a%20Nievole,it" # Set with location identify, see https://openweathermap.org/current
OPENWEATHERMAP_TZ="Europe/Rome" # Set with your time zone
```

View File

@@ -0,0 +1,123 @@
#
# Funzioni comuni utilizzate dal driver
#
#
# Recupera la descrizione della condizione meteo
#
# $1 condizione meteo recuperata dalle api
#
function drv_openweathermap_get_wather {
declare -A w
w["thunderstorm with light rain"]="Thunderstorms and Rain"
w["thunderstorm with rain"]="Thunderstorms and Rain"
w["thunderstorm with heavy rain"]="Thunderstorms and Rain"
w["light thunderstorm"]="Thunderstorm"
w["thunderstorm"]="Thunderstorm"
w["heavy thunderstorm"]="Thunderstorm"
w["ragged thunderstorm"]="Thunderstorm"
w["thunderstorm with light drizzle"]="Thunderstorms and Rain"
w["thunderstorm with drizzle"]="Thunderstorms and Rain"
w["thunderstorm with heavy drizzle"]="Thunderstorms and Rain"
w["light intensity drizzle"]="Drizzle"
w["drizzle"]="Drizzle"
w["heavy intensity drizzle"]="Drizzle"
w["light intensity drizzle rain"]="Drizzle"
w["drizzle rain"]="Drizzle"
w["heavy intensity drizzle rain"]="Drizzle"
w["shower rain and drizzle"]="Drizzle"
w["heavy shower rain and drizzle"]="Drizzle"
w["shower drizzle"]="Drizzle"
w["light rain"]="Rain Mist"
w["moderate rain"]="Rain"
w["heavy intensity rain"]="Rain"
w["very heavy rain"]="Rain"
w["extreme rain"]="Rain"
w["freezing rain"]="Freezing Rain"
w["light intensity shower rain"]="Rain"
w["shower rain"]="Rain"
w["heavy intensity shower rain"]="Rain"
w["ragged shower rain"]="Rain"
w["light snow"]="Snow"
w["snow"]="Snow"
w["heavy snow"]=""
w["sleet"]="Snow Grains"
w["shower sleet"]="Snow Grains"
w["light rain and snow"]="Snow"
w["rain and snow"]="Snow"
w["light shower snow"]="Snow"
w["shower snow"]="Snow"
w["heavy shower snow"]="Snow"
w["mist"]="Mist"
w["smoke"]="Smoke"
w["haze"]="Haze"
w["sand, dust whirls"]="Dust Whirls"
w["fog"]="Fog"
w["sand"]="Sand"
w["dust"]="Widespread Dust"
w["volcanic ash"]="Volcanic Ash"
w["squalls"]="Squalls"
w["tornado"]="Tornado"
w["clear sky"]="Clear"
w["few clouds"]="Partly Cloudy"
w["scattered clouds"]="Scattered Clouds"
w["broken clouds"]="Partly Cloudy"
w["overcast clouds"]="Mostly Cloudy"
local weather=${w[$1]}
if [ -z "$weather" ]; then
weather="$1"
fi
echo $weather
}
#
# Recupera la l'icona rappresentativa delle condizione meteo
#
# $1 nome dell'icona recuperato delle api weather.icon
#
function drv_openweathermap_get_ico {
declare -A w
w["01d"]="http://icons.wxug.com/i/c/k/clear.gif"
w["01n"]="http://icons.wxug.com/i/c/k/nt_clear.gif"
w["02d"]="http://icons.wxug.com/i/c/k/partlycloudy.gif"
w["02n"]="http://icons.wxug.com/i/c/k/nt_partlycloudy.gif"
w["03d"]="http://icons.wxug.com/i/c/k/cloudy.gif"
w["03n"]="http://icons.wxug.com/i/c/k/nt_cloudy.gif"
w["04d"]="http://icons.wxug.com/i/c/k/cloudy.gif"
w["04n"]="http://icons.wxug.com/i/c/k/nt_cloudy.gif"
w["09d"]="http://icons.wxug.com/i/c/k/sleet.gif"
w["09n"]="http://icons.wxug.com/i/c/k/nt_sleet.gif"
w["10d"]="http://icons.wxug.com/i/c/k/rain.gif"
w["10n"]="http://icons.wxug.com/i/c/k/nt_rain.gif"
w["11d"]="http://icons.wxug.com/i/c/k/tstorms.gif"
w["11n"]="http://icons.wxug.com/i/c/k/nt_tstorms.gif"
w["13d"]="http://icons.wxug.com/i/c/k/snow.gif"
w["13n"]="http://icons.wxug.com/i/c/k/nt_snow.gif"
w["50d"]="http://icons.wxug.com/i/c/k/fog.gif"
w["50n"]="http://icons.wxug.com/i/c/k/nt_fog.gif"
local ico=${w[$1]}
if [ -z "$ico" ]; then
ico="$1"
fi
echo $ico
}

View File

@@ -0,0 +1,74 @@
#
# Ritorna lo stato delle condizioni meteo interrogando il servizio online
#
# $i identificativo gpio del sensore di pioggia
#
# return output: 0 - errore durante il recupero delle condizioni meteo
# >0 - rilevato pioggia, timestamp del rilevamento
# <0 - rilevato nessuna pioggia, timestamp del rilevamento
function drv_openweathermap_rain_online_get {
# http://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary&MR=1
$CURL "http://api.openweathermap.org/data/2.5/weather?$OPENWEATHERMAP_LOCATION&units=metric&appid=$OPENWEATHERMAP_KEY" > $TMP_PATH/check_rain_online.openweathermap.json
local weather=`cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -M ".weather[0].main"`
local wind_deg=$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".wind.deg")
local wind_speed=$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".wind.speed")
if [ "$wind_speed" == "null" ]; then
#wind_speed=$($JQ -n $wind_speed*3600/1000)
wind_speed=0
fi
local weather="$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".weather[0].description")"
local ico=$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".weather[0].icon")
weather=$(drv_openweathermap_get_wather "$weather")
ico=$(drv_openweathermap_get_ico "$ico")
local current_observation=$(cat <<EOF
{
"display_location": {
"city": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".name")"
},
"observation_epoch": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".dt")",
"local_epoch": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".dt")",
"local_tz_long": "$OPENWEATHERMAP_TZ",
"weather": "$weather",
"temp_c": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.temp")",
"relative_humidity": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.humidity")%",
"wind_dir": "$(deg2dir $wind_deg)",
"wind_degrees": "$wind_deg",
"wind_kph": "$wind_speed",
"wind_gust_kph": "--",
"pressure_mb": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.pressure")",
"dewpoint_c": "--",
"feelslike_c": "--",
"icon_url": "$ico"
}
EOF
)
# "icon_url": "http://openweathermap.org/img/w/$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".weather[0].icon").png"
#local current_observation=`cat $TMP_PATH/check_rain_online.json | $JQ -M ".current_observation"`
if [ "$weather" = "null" ]; then
echo "0"
else
echo "$current_observation" > "$STATUS_DIR/last_weather_online"
local local_epoch=`cat $STATUS_DIR/last_weather_online | $JQ -M -r ".local_epoch"`
if [[ "$weather" == *"Rain"* ]] ||
[[ "$weather" == *"Snow"* ]] ||
[[ "$weather" == *"Hail"* ]] ||
[[ "$weather" == *"Ice"* ]] ||
[[ "$weather" == *"Thunderstorm"* ]] ||
[[ "$weather" == *"Drizzle"* ]];
then
echo $local_epoch
else
echo "-$local_epoch"
fi
fi
}

4
drv/rainsensorqty/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
.set_var
# Except this file
!.gitignore

124
drv/rainsensorqty/README.md Normal file
View File

@@ -0,0 +1,124 @@
#
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file README.md
# Version: 0.2.5
# Data: 07/Apr/2020
FILE DI CONFIGURAZIONE /etc/piGarden.conf:
-----------------------------------------
NOTA: vedere nella directory conf_example il file esempio piu' aggiornato!
per attivare il driver e' necessario inserire la seguente variabile nel file di configurazion
RAIN_GPIO="drv:rainsensorqty:25" # Physical 22 - wPi 6
la variabile seguente e' impiegata anche da drv_rainsensorqty per rilevare la chiusura del contatto magnetico che, in un circuito pull-up, e' lo stato 1.
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
RAIN_GPIO_STATE=1
le seguenti variabili controllano il driver come descritto:
RAINSENSORQTY_LOOPSFORSETRAINING=16 # dopo 16 impulsi, 16 vaschette riempite si considera pioggia
RAINSENSORQTY_SECSBETWEENRAINEVENT=10800 # =3h, significa che dopo 3 si resetta il numero di vaschette da riempire e solo dopo il riempimento del nuovo numero di vaschette si considera una nuova pioggia
infine la variabile seguente e' la quantita' di acqua espressa in mm di precipitazioni:
RAINSENSORQTY_MMEACH=0.33 # see RAINSENSORQTY driver readme for details
CALIBRAZIONE SENSORE PIOGGIA
----------------------------
secondo il seguente processo da me effettuato sul mio misuratore di pioggia:
Ho erogato 18 ml di acqua nel rain gauge che hanno prodotto 10 impulsi; pertanto il riempimento di 1.8 ml ha causato un impulso, 1 ml = 1000 mmc (mm cubici),
1.8 ml sono pari a 1800 mmc
la superficie della vaschetta in mmq e' pari a 110 mm x 55 mm = 5500 mmq
volume / superficie mi da' l'altezza, quindi 1800 mmc / 5500 mmq = 0.32727273 mm
se fossero stati 1.7 ml di acqua per ogni impulso/vaschetta riempita, la variabile sarebbe stata impostata a 0.30909091 mm
COMANDI SPECIALI
----------------
nella sottodirectory command sono presenti:
commands/rainsensorqty_CHECK.sh
chiama la funzione di verifica pioggia, la medesima chiamata da check_rain_sensor
commands/rainsensorqty_HISTORY.sh
visualizza lo storico della pioggia consultando il file $RAINSENSORQTY_HISTORY
puo' essere lanciato con l''opzione -force per ricostruire il file $RAINSENSORQTY_HISTORY dal $RAINSENSORQTY_HISTORYRAW
e con un argomento X, che permette di evidenziare solo gli ultimi X eventi
commands/rainsensorqty_HISTORYRAW.sh
visualizza lo storico della pioggia consultando il file $RAINSENSORQTY_HISTORYRAW
puo' essere lanciato senza argomenti per processare l'intero file, chiede conferma visto che i tempi sono potenzialmente lunghi
con un argomento X, che permette di evidenziare solo gli ultimi X eventi
commands/rainsensorqty_INIT.sh
inizializza il driver eseguendo lo script di monitoring - normalmente tale processo avviene da piGarden.sh
utile quando si vuole testare dei cambiamenti o se necessario riavviare dopo il kill del comando successivo
commands/rainsensorqty_KILL.sh
killa i processi di monitoring ed eventuali figli
commands/rainsensorqty_RAINNOW.sh
simula una pioggia registrandola in $RAINSENSORQTY_LASTRAIN $RAINSENSORQTY_HISTORY $RAINSENSORQTY_HISTORYRAW
puo' essere lanciato in 3 modi:
senza argomenti: genera una pioggia per un numero di loop pari al valore della variabile RAINSENSORQTY_LOOPSFORSETRAINING, quindi una pioggia completa
con un argomento: che indica quanti loop
con due argomenti: quanti loop e quanti secondi tra uno e l'altro
commands/rainsensorqty_REMOVELASTRAIN.sh
rimuove dai file $RAINSENSORQTY_LASTRAIN $RAINSENSORQTY_HISTORY $RAINSENSORQTY_HISTORYRAW l'ultima pioggia registrata
commands/rainsensorqty_RESET.sh
invia il SIGUSR1 al processo di monitor per resettare i cicli. Viene visualizzato il reset solo dopo il successivo PULSE, questo perche' non e' possibile per lo script ricevere il trap in quanto il processo $GPIO e' attivo in attesa del PULSE
questi i timestamps alla data del file:
-rwxr-xr-x 1 pi pi 1044 Sep 24 18:26 rainsensorqty_CHECK.sh
-rwxr-xr-x 1 pi pi 1139 Nov 28 00:17 rainsensorqty_HISTORYRAW.sh
-rwxr-xr-x 1 pi pi 1462 Nov 19 00:19 rainsensorqty_HISTORY.sh
-rwxr-xr-x 1 pi pi 596 Sep 24 18:26 rainsensorqty_INIT.sh
-rwxr-xr-x 1 pi pi 1300 Sep 24 18:26 rainsensorqty_KILL.sh
-rwxr-xr-x 1 pi pi 1111 Nov 27 00:05 rainsensorqty_RAINNOW.sh
-rwxr-xr-x 1 pi pi 1252 Nov 22 00:18 rainsensorqty_REMOVELASTRAIN.sh
-rwxr-xr-x 1 pi pi 897 Sep 24 18:26 rainsensorqty_RESET.sh
ULTERIORI VARIABILI in config.include.sh
----------------------------------------
esistono ulteriori variabili che potrebbe essere necessario variare
RAINSENSOR_DEBOUNCE=0.3 # 0.3 seconds for manage debounce of reed contact
serve per ritardare la lettura di un secondo impulso falso causato dal rimbalzo del contatto magnetico
RAINSENSORQTY_verbose="yes"
aumenta il livello di verbosita' nei file di log
RAINSENSORQTY_LASTRAIN="$STATUS_DIR/rainsensorqty_lastrain"
memorizza l'ultima pioggia
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
memorizza tutte le piogge permettendo di visualizzare lo storico (commands/rainsensorqty_HISTORY.sh)
RAINSENSORQTY_HISTORYRAW="$STATUS_DIR/rainsensorqty_history.raw"
memorizza in formato grezzo (raw) tutti gli impulsi registrati (formato: "secondi:impulsi" ) - consultabile il contenuto con commands/rainsensorqty_HISTORYRAW.sh
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
log dello script di monitoring, popolato solo se RAINSENSORQTY_verbose="yes"
RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
file che viene popolato con il pid dello script di monitoring
RAINSENSORQTY_DIR="$DIR_SCRIPT/drv/rainsensorqty"
home directory del driver
monitor_sh="$RAINSENSORQTY_DIR/drv_rainsensorqty_monitor.sh"
script di monitoring
lo script eredita le variabili di ambiente da $RAINSENSORQTY_VAR ($TMPDIR/.rainsensorqty_var)
NOTA: $TMPDIR e' /tmp e lo script visualizza un warning se non e' un tmpfs
# internal gpio resistor, 3 values: pull-up, pull-down, none
# pull-up/down if rain gauge is connected directly to raspberry
# none if connected through an optocoupler circuit
GPIO_RESISTOR="none" #pull-up|pull-down|none
enable pull-up or pull-down resistor: https://raspberry-projects.com/pi/pi-hardware/raspberry-pi-model-b-plus/model-b-plus-io-pins
Pull-up is 50K min - 65K max.
Pull-down is 50K min - 60K max.
#rising means waiting for 1 status (from 0)
#falling means waiting for 0 status (from 1)
#RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
#RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
(( RAIN_GPIO_STATE == 1 )) && RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
(( RAIN_GPIO_STATE == 0 )) && RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
lo script di monitoring ascolta il cambiamento di stato da quello di riposo allo stato di impulso (chiusura del contatto reed).
dipendentemente dal circuto implementato, se lo stato di riposo e' 0, lo script attende la variazione verso 1 (rising)
se lo stato di riposo e' 1, lo script attende la variazione verso 0 (falling)
la variabile RAINSENSORQTY_PULSE viene impostata secondo il valore di RAIN_GPIO_STATE presente in /etc/piGarden.conf
cioe' il valore che ci si aspetta per registrare il riempimento della vaschetta dello stato di pioggia

View File

View File

@@ -0,0 +1,35 @@
#!/bin/bash
#
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "rainsensorqty_CHECK.sh"
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
# Version: 0.2.0
# Data: 11/Aug/2019
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
SCRIPTNAME=${0##*/}
cd $SCRIPTDIR/.. # command is a subdirectory of driver
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
CONFIG_ETC="/etc/piGarden.conf"
LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
. $CONFIG_ETC
. ./common.include.sh
. ./config.include.sh
. ./init.include.sh
. ./rainsensor.include.sh
# restituisce 0 se piove, e nell'output di testo il valore di "$RAIN_GPIO_STATE"
# restituisce 99 se non piove, output "norain"
# esce con 1 se non c'e' il monitoring, output "ERROR"
drv_rainsensorqty_rain_sensor_get
case $? in
0) echo "NORMAL: it's raining" ;;
99) echo "NORMAL: it's not raining" ;;
1) echo "ERROR: monitor process $DIR_SCRIPT/drv/rainsensorqty/drv_rainsensorqty_monitor.sh is not running" ;;
esac

View File

@@ -0,0 +1,59 @@
#!/bin/bash
#
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "rainsensorqty_CHECK.sh"
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
# Version: 0.2.5
# Data: 08/Jan/2020
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
SCRIPTNAME=${0##*/}
cd $SCRIPTDIR/.. # command is a subdirectory of driver
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
CONFIG_ETC="/etc/piGarden.conf"
LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
. $CONFIG_ETC
. ./common.include.sh
. ./config.include.sh
. ./init.include.sh
. ./rainsensor.include.sh
if [[ $1 = "-force" ]] ; then
if [[ -s $RAINSENSORQTY_HISTORY ]] ; then
echo backup $RAINSENSORQTY_HISTORY to ${RAINSENSORQTY_HISTORY}.old$$
cp $RAINSENSORQTY_HISTORY ${RAINSENSORQTY_HISTORY}.old$$
fi
echo "generate all rain events to $RAINSENSORQTY_HISTORY"
if ! rainevents > ${RAINSENSORQTY_HISTORY} ; then
echo "WARNING: rainevents function had error"
fi
shift
fi
if ! rain_history tmp ; then # update rain history with last rain if not
echo "WARNING: rain_history function had error"
fi
cmd="cat"
if [[ $# > 0 ]] ; then
if (( $1 >= 1 )) ; then
echo "processing last $1 lines of $RAINSENSORQTY_HISTORYRAW file"
cmd="tail -$1"
else
echo "argument not recognized - exit"
exit 1
fi
fi
echo -e "\n\n"
if [[ -s $RAINSENSORQTY_HISTORY ]] ; then
echo "RAIN HISTORY"
cat $RAINSENSORQTY_HISTORY $RAINSENSORQTY_HISTORYTMP | $cmd | rain_when_amount
else
echo "WARNING: no \$RAINSENSORQTY_HISTORY file"
fi

View File

@@ -0,0 +1,50 @@
#!/bin/bash
#
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "rainsensorqty_CHECK.sh"
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
# Version: 0.2.5
# Data: 07/Apr/2020
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
SCRIPTNAME=${0##*/}
cd $SCRIPTDIR/.. # command is a subdirectory of driver
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
CONFIG_ETC="/etc/piGarden.conf"
LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
. $CONFIG_ETC
. ./common.include.sh
. ./config.include.sh
. ./init.include.sh
. ./rainsensor.include.sh
if [[ $# = 0 ]] ; then
cmd=cat
echo "processing all entire $RAINSENSORQTY_HISTORYRAW file, will go on? (y/n)"
read answer
echo $answer
[[ $answer = [yY] ]] || exit 1
else
if (( $1 >= 1 )) ; then
echo "processing $1 lines of $RAINSENSORQTY_HISTORYRAW file"
cmd="tail -$1"
else
echo "argument not recognized - exit"
exit 1
fi
fi
echo -e "\n\n"
$cmd $RAINSENSORQTY_HISTORYRAW | while read line
do
set -- ${line//:/ }
secs=$1
counter=$2
echo "$(sec2date $1):$counter"
done

View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "rainsensorqty_INIT.sh"
# test script for initialize driver and executing monitor process
# Version: 0.2.0
# Data: 11/Aug/2019
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
SCRIPTNAME=${0##*/}
cd $SCRIPTDIR/.. # command is a subdirectory of driver
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
CONFIG_ETC="/etc/piGarden.conf"
. $CONFIG_ETC
. ./config.include.sh
. ./common.include.sh
. ./init.include.sh
. ./rainsensor.include.sh
drv_rainsensorqty_rain_sensor_init
drv_rainsensorqty_init

View File

@@ -0,0 +1,52 @@
#!/bin/bash
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "rainsensorqty_KILL.sh"
# script for killing monitor process(es)
# Version: 0.2.0a
# Data: 29/Aug/2019
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
SCRIPTNAME=${0##*/}
cd $SCRIPTDIR/.. # command is a subdirectory of driver
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
CONFIG_ETC="/etc/piGarden.conf"
. $CONFIG_ETC
. ./config.include.sh
. ./common.include.sh
. ./init.include.sh
. ./rainsensor.include.sh
# check if rain monitor process is running...
if [[ -f "$RAINSENSORQTY_MONPID" ]] ; then
pid="$( < "$RAINSENSORQTY_MONPID" )"
if ps -fp $pid >/dev/null ; then
echo "process $pid pid and its child(ren)"
children_pid="$(ps -ef| awk "\$3==$pid {print \$2}")"
ps -fp $pid
ps -fp $children_pid | tail +2
echo -e "\nsending TERM signal to $pid and its child(ren)"
echo kill $children_pid
echo kill $pid
kill $children_pid
kill $pid
echo -e "\nchecking $pid pid and its child(ren) are still alive"
for process in $pid $children_pid
do
if ps -fp $process >/dev/null ; then
echo "$process is still alive"
else
echo "$process is dead"
fi
done
else
echo "no RAIN process alive"
fi
else
echo "no RAIN process alive"
fi

View File

@@ -0,0 +1,67 @@
#!/bin/bash
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "rainsensorqty_RAINNOW.sh"
# test script for simulate rain ... now!
# Version: 0.2.5
# Data: 07/Apr/2020
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
SCRIPTNAME=${0##*/}
cd $SCRIPTDIR/.. # command is a subdirectory of driver
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
CONFIG_ETC="/etc/piGarden.conf"
. $CONFIG_ETC
. ./config.include.sh
. ./common.include.sh
. ./init.include.sh
. ./rainsensor.include.sh
wait=0
timestart=$( date +%s)
if [[ $# -ne 0 ]] ; then
if [[ $# = 1 ]] ; then
howmany=$1
echo "one argument passed: rain event for $howmany loops"
(( time = timestart - howmany ))
elif [[ $# = 2 ]] ; then
howmany=$1
wait=$2
echo "two arguments passed: rain event for $howmany loops every $wait seconds"
(( time = timestart ))
else
echo "too many arguments... exit"
exit 1
fi
else
howmany=$RAINSENSORQTY_LOOPSFORSETRAINING
(( time = timestart - $RAINSENSORQTY_LOOPSFORSETRAINING ))
fi
echo "RAIN now! (for $howmany loops)"
for (( c=1; c<=$howmany; c++ ))
do
if (( wait > 0 )) ; then
time=$( date +%s)
else
(( time+= 1 ))
fi
linetoadd="$time:$c"
echo $linetoadd >> $RAINSENSORQTY_HISTORYRAW
sleep $wait
echo -e ".\c"
done
echo
if ! rain_history ; then # update rain history with last rain if not
echo "WARNING: rain_history function had error"
fi
echo $linetoadd > ${RAINSENSORQTY_LASTRAIN}
echo "file ${RAINSENSORQTY_LASTRAIN} updated."
echo "last 2 rain events:"
tail -2 $RAINSENSORQTY_HISTORY | rain_when_amount

View File

@@ -0,0 +1,44 @@
#!/bin/bash
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "test_rainsensorqty_CHECK.sh"
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
# Version: 0.2.5
# Data: 07/Apr/2020
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
SCRIPTNAME=${0##*/}
cd $SCRIPTDIR/.. # command is a subdirectory of driver
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
CONFIG_ETC="/etc/piGarden.conf"
LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
. $CONFIG_ETC
. ./common.include.sh
. ./config.include.sh
. ./init.include.sh
. ./rainsensor.include.sh
# two variables for store rain data
# RAINSENSORQTY_LASTRAIN
# RAINSENSORQTY_HISTORY
echo "RAIN HISTORY - last two events"
tail -2 $RAINSENSORQTY_HISTORY
tail -2 $RAINSENSORQTY_HISTORY | rain_when_amount
echo "...removing last event"
removelastrain
echo "...rebuilding ${RAINSENSORQTY_HISTORY} from ${RAINSENSORQTY_HISTORYRAW}"
if ! rainevents > ${RAINSENSORQTY_HISTORY} ; then
echo "WARNING: rainevents function had error"
fi
tail -1 ${RAINSENSORQTY_HISTORYRAW} > ${RAINSENSORQTY_LASTRAIN}
echo -e "\nnew RAIN HISTORY - last two events"
tail -2 $RAINSENSORQTY_HISTORY
tail -2 $RAINSENSORQTY_HISTORY | rain_when_amount

View File

@@ -0,0 +1,35 @@
#!/bin/bash
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "rainsensorqty_RESET.sh"
# script for reset counter in monitor script
# Version: 0.2.0a
# Data: 29/Aug/2019
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
SCRIPTNAME=${0##*/}
cd $SCRIPTDIR/.. # command is a subdirectory of driver
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
CONFIG_ETC="/etc/piGarden.conf"
. $CONFIG_ETC
. ./config.include.sh
. ./common.include.sh
. ./init.include.sh
. ./rainsensor.include.sh
# check if rain monitor process is running...
if [[ -f "$RAINSENSORQTY_MONPID" ]] ; then
pid="$( < "$RAINSENSORQTY_MONPID" )"
if ps -fp $pid >/dev/null ; then
echo "sending SIGUSR1 to $pid"
kill -SIGUSR1 $pid
echo -e "sent SIGUSR1 - reset will be shown after next cycle"
else
echo "no RAIN process alive"
fi
else
echo "no RAIN process alive"
fi

View File

@@ -0,0 +1,163 @@
#
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "common.include.sh"
# common functions used by driver
# Version: 0.2.5
# Data: 08/Jan/2020
#note:
#RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
#
sec2date()
{
date --date="@$1"
}
d() # short date & time
{
date '+%X-%x'
}
drv_rainsensorqty_writelog()
{
#2 variables - $1 function, $2 message
if [[ $2 =~ ERROR || $2 =~ WARNING || $2 =~ RAIN || $RAINSENSORQTY_verbose = yes ]] ; then
echo -e "$1 - `d`\t\t$2" >> "$LOG_OUTPUT_DRV_FILE"
# if [[ $($WC -c <"$LOG_OUTPUT_DRV_FILE") > $LOG_FILE_MAX_SIZE )) ; then
# $GZIP "$LOG_OUTPUT_DRV_FILE"
# $MV "${LOG_OUTPUT_DRV_FILE}.gz" "${LOG_OUTPUT_DRV_FILE}.$(date +%Y%m%d%H%M).gz"
# fi
fi
}
drv_rainsensorqty_check()
{
local f="drv_rainsensorqty_check"
if [[ -f "$RAINSENSORQTY_MONPID" ]] ; then
local pid=$( < "$RAINSENSORQTY_MONPID" )
drv_rainsensorqty_writelog $f "NORMAL: checking if $pid pid is running"
if ps -fp $pid >/dev/null ; then
drv_rainsensorqty_writelog $f "NORMAL: $pid pid is running"
return 0
else
drv_rainsensorqty_writelog $f "ERROR: $pid pid monitor process NOT running - $RAINSENSORQTY_MONPID file contains $pid"
return 1
fi
else
drv_rainsensorqty_writelog $f "ERROR: no raining monitor process file \$RAINSENSORQTY_MONPID"
return 1
fi
}
en_echo() # enhanched echo - check verbose variable
{
[[ $RAINSENSORQTY_verbose = yes ]] && echo "$(d) $*"
}
rain_history()
{
[[ ! -f $RAINSENSORQTY_HISTORYRAW ]] && return 1
[[ ! -f $RAINSENSORQTY_HISTORY ]] && touch $RAINSENSORQTY_HISTORY
> $RAINSENSORQTY_HISTORYTMP
if lastrainevent=$( rainevents 1 ) ; then
: # done ok
else
echo "WARNING: rainevents function had errors"
return 1
fi
#old #if grep -q ^$(<$RAINSENSORQTY_LASTRAIN)$ $RAINSENSORQTY_HISTORY ; then
if grep -q ^${lastrainevent}$ $RAINSENSORQTY_HISTORY ; then
: # already present
return 0
else
: # missing and fixed
if [[ $1 == tmp ]] ; then
echo $lastrainevent > $RAINSENSORQTY_HISTORYTMP
else
echo $lastrainevent >> $RAINSENSORQTY_HISTORY
fi
return 0
fi
}
rain_when_amount()
{
# from standard input
# format $time:$endtime:$endsequence
cat - | while read line
do
set -- ${line//:/ }
start=$1
stop=$2
howmuch=$3
printf "RAINED for %7.2f mm between %s and %s\n" $( $JQ -n "$howmuch * $RAINSENSORQTY_MMEACH" ) "$(date --date="@$start")" "$(date --date="@$stop")"
done
}
check_TMPDIR()
{
if [[ $(df | awk '$NF=="/tmp" {print $1}') != "tmpfs" ]] ; then
echo "WARNING: /tmp isn't a tmp file system"
echo -e "\tplease add to your /etc/fstab file:\n\ttmpfs /tmp tmpfs defaults,noatime,nosuid 0 0"
fi
}
rainevents()
{
if [[ ! -f $RAINSENSORQTY_HISTORYRAW ]] ; then
#echo "WARNING: no \$RAINSENSORQTY_HISTORYRAW file"# cannot echo, redirected output
return 1
fi
case $1 in
[0-9]|[0-9][0-9]) howmanyevent=$1 ;;
# -1) skiplast=true ;;
*) howmanyevent=-1 ;;
esac
newloop=yes
tac $RAINSENSORQTY_HISTORYRAW | while read line
do
set -- ${line//:/ }
time=$1
sequence=$2
if [[ $newloop == yes ]] ; then
endtime=$time
endsequence=$sequence
newloop=no
fi
if (( sequence == 1 )) ; then
# [[ $skiplast=true ]] && { skilast=false ; continue ; }
echo $time:$endtime:$endsequence
newloop=yes
(( event +=1 ))
fi
(( howmanyevent == event )) && break
done | sort -k1n
}
removelastrain()
{
if [[ ! -f $RAINSENSORQTY_HISTORYRAW ]] ; then
echo "WARNING: no \$RAINSENSORQTY_HISTORYRAW file"
return 1
fi
next=false
tac $RAINSENSORQTY_HISTORYRAW | while read line
do
set -- ${line//:/ }
time=$1
sequence=$2
[[ $next = true ]] && echo $line
(( sequence == 1 )) && next=true
done | tac > ${RAINSENSORQTY_HISTORYRAW}_$$
mv ${RAINSENSORQTY_HISTORYRAW}_$$ $RAINSENSORQTY_HISTORYRAW
}

View File

@@ -0,0 +1,66 @@
#
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "config.include.sh"
# specific driver config file
# Version: 0.2.5
# Data: 08/Jan/2020
export TMPDIR=/tmp
RAINSENSOR_DEBOUNCE=0.3 # 0.3 seconds for manage debounce of reed contact
RAINSENSORQTY_verbose="yes" # yes/no
RAINSENSORQTY_LASTRAIN="$STATUS_DIR/rainsensorqty_lastrain"
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
RAINSENSORQTY_HISTORYRAW="$STATUS_DIR/rainsensorqty_history.raw"
RAINSENSORQTY_HISTORYTMP="$TMPDIR/rainsensorqty_history.tmp"
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
RAINSENSORQTY_STATE="$TMPDIR/rainsensorqty_state"
RAINSENSORQTY_STATE_HIST="$TMPDIR/rainsensorqty_state.history"
RAINSENSORQTY_DIR="$DIR_SCRIPT/drv/rainsensorqty"
monitor_sh="$RAINSENSORQTY_DIR/drv_rainsensorqty_monitor.sh"
# internal gpio resistor, 3 values: pull-up, pull-down, none
# pull-up/down if rain gauge is connected directly to raspberry
# none if connected through an optocoupler circuit
GPIO_RESISTOR="pull-up" #pull-up|pull-down|none
#rising means waiting for 1 status (from 0)
#falling means waiting for 0 status (from 1)
#RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
#RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
(( RAIN_GPIO_STATE == 1 )) && RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
(( RAIN_GPIO_STATE == 0 )) && RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
config_check()
{
var2check="RAINSENSOR_DEBOUNCE RAINSENSORQTY_verbose RAINSENSORQTY_LASTRAIN RAINSENSORQTY_HISTORY RAINSENSORQTY_MONITORLOG RAINSENSORQTY_MONPID RAINSENSORQTY_DIR monitor_sh"
for var in $var2check
do
#${!a}
if [[ -z ${!var} ]] ; then
echo "ERROR: \$$var not set"
exit 1
fi
done
if [[ -z $RAINSENSORQTY_PULSE ]] ; then
echo "ERROR: RAIN_GPIO_STATE not set in piGarden.conf"
exit 1
fi
return 0
case $GPIO_RESISTOR in
pull-up|pull-down|none) return 0 ;;
*) echo "ERROR: GPIO_RESISTOR not set correctly - values are \"pull-up|pull-down|none\" "
exit 1
;;
esac
}

View File

@@ -0,0 +1,14 @@
# cfg file version 0.2.0
# Id del gpio usato per collegare il sensore di rilevamento pioggia
# attraverso il driver rainsensorqty
RAIN_GPIO="drv:rainsensorqty:25" # Physical 22 - wPi 6
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
# variabile usata anche da drv:rainsensorqty, se e' a 1, significa che il reed contact e' collegato ad un circuito pull-down, vuol dire che attende l'impulso a 1 per contare le vaschette, normalmente e' a 0.
# se e' a 0, significa che il reed contact e' collegato ad un circuito pull-up, vuol dire che attende l'impulso a 0 per contare le vaschette, normalmente e' a 0.
RAIN_GPIO_STATE=0
RAINSENSORQTY_LOOPSFORSETRAINING=16 # dopo 16 impulsi, 16 vaschette riempite si considera pioggia
RAINSENSORQTY_SECSBETWEENRAINEVENT=10800 # =3h, significa che dopo 3 ore si resetta il numero di vaschette riempire e solo dopo un nuovo ciclo di riempimento si considera una nuova pioggia
RAINSENSORQTY_MMEACH=0.33 # see RAINSENSORQTY driver readme for details

View File

@@ -0,0 +1,66 @@
#
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "config.include.sh"
# specific driver config file
# Version: 0.2.5
# Data: 08/Jan/2020
export TMPDIR=/tmp
RAINSENSOR_DEBOUNCE=0.3 # 0.3 seconds for manage debounce of reed contact
RAINSENSORQTY_verbose="yes" # yes/no
RAINSENSORQTY_LASTRAIN="$STATUS_DIR/rainsensorqty_lastrain"
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
RAINSENSORQTY_HISTORYRAW="$STATUS_DIR/rainsensorqty_history.raw"
RAINSENSORQTY_HISTORYTMP="$TMPDIR/rainsensorqty_history.tmp"
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
RAINSENSORQTY_STATE="$TMPDIR/rainsensorqty_state"
RAINSENSORQTY_STATE_HIST="$TMPDIR/rainsensorqty_state.history"
RAINSENSORQTY_DIR="$DIR_SCRIPT/drv/rainsensorqty"
monitor_sh="$RAINSENSORQTY_DIR/drv_rainsensorqty_monitor.sh"
# internal gpio resistor, 3 values: pull-up, pull-down, none
# pull-up/down if rain gauge is connected directly to raspberry
# none if connected through an optocoupler circuit
GPIO_RESISTOR="pull-up" #pull-up|pull-down|none
#rising means waiting for 1 status (from 0)
#falling means waiting for 0 status (from 1)
#RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
#RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
(( RAIN_GPIO_STATE == 1 )) && RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
(( RAIN_GPIO_STATE == 0 )) && RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
config_check()
{
var2check="RAINSENSOR_DEBOUNCE RAINSENSORQTY_verbose RAINSENSORQTY_LASTRAIN RAINSENSORQTY_HISTORY RAINSENSORQTY_MONITORLOG RAINSENSORQTY_MONPID RAINSENSORQTY_DIR monitor_sh"
for var in $var2check
do
#${!a}
if [[ -z ${!var} ]] ; then
echo "ERROR: \$$var not set"
exit 1
fi
done
if [[ -z $RAINSENSORQTY_PULSE ]] ; then
echo "ERROR: RAIN_GPIO_STATE not set in piGarden.conf"
exit 1
fi
return 0
case $GPIO_RESISTOR in
pull-up|pull-down|none) return 0 ;;
*) echo "ERROR: GPIO_RESISTOR not set correctly - values are \"pull-up|pull-down|none\" "
exit 1
;;
esac
}

View File

@@ -0,0 +1,88 @@
#!/bin/bash
#
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "drv_rainsensorqty_monitor.sh"
# monitor script
# Version: 0.2.5b
# Data: 12/May/2020
resetcounter()
{
(( counter = 0 ))
drv_rainsensorqty_writelog $f "SIGUSR1 received after last PULSE - counter resetted" &
echo "SIGUSR1 received after last PULSE - counter resetted"
}
###############
# MAIN #
###############
trap "resetcounter" SIGUSR1
DIRNAME="$( dirname $0 )"
f="$(basename $0)"
. $DIRNAME/common.include.sh
RAINSENSORQTY_VAR=$TMPDIR/.rainsensorqty_var
if [[ -f "$RAINSENSORQTY_VAR" ]] ; then
en_echo "NORMAL: file $RAINSENSORQTY_VAR found - getting variables"
. "$RAINSENSORQTY_VAR"
else
echo "ERROR: $RAINSENSORQTY_VAR not found"
exit 1
fi
#drvt="$( echo $RAIN_GPIO | $CUT -f 1 -d: )"
#drv="$( echo $RAIN_GPIO | $CUT -f 2 -d: )"
gpio_port="$( echo $RAIN_GPIO | $CUT -f 3 -d: )"
# check if no other rain monitor process running...
if [[ -f "$RAINSENSORQTY_MONPID" ]] ; then
pid="$( < "$RAINSENSORQTY_MONPID" )"
if ps -fp $pid >/dev/null ; then
drv_rainsensorqty_writelog $f "ERROR monitor process already running\n$( ps -fp $pid )"
exit 1
fi
fi
echo $$ > $RAINSENSORQTY_MONPID
drv_rainsensorqty_writelog $f "NORMAL - $$ pid monitor process started - see $RAINSENSORQTY_MONPID"
# init variables
MMEACH="$RAINSENSORQTY_MMEACH"
(( counter=0 ))
rain_history
echo ""
en_echo "---- NEW RUN ----"
en_echo "WAITING FOR $RAINSENSORQTY_PULSE PULSE"
# loop forever
while true
do
before=`date +%s`
sleep $RAINSENSOR_DEBOUNCE
$GPIO -g wfi $gpio_port $RAINSENSORQTY_PULSE
now=`date +%s`
(( elapsed = now - before ))
if (( elapsed >= RAINSENSORQTY_SECSBETWEENRAINEVENT )) ; then
(( counter=0 ))
drv_rainsensorqty_writelog $f "first drops after $elapsed seconds since last rain ( greater than $RAINSENSORQTY_SECSBETWEENRAINEVENT )- new cycle - waiting for $( $JQ -n "$RAINSENSORQTY_LOOPSFORSETRAINING * $MMEACH" ) mm of rain" &
en_echo "---- NEW CYCLE ----"
rain_history &
fi
(( counter+=1 ))
echo "$now:$counter" >> ${RAINSENSORQTY_HISTORYRAW} &
MMWATER=$( $JQ -n "$counter*$MMEACH" )
en_echo $( printf "%s PULSE #%d RECEIVED (%.2f mm)" $RAINSENSORQTY_PULSE $counter $MMWATER )
text=$(printf "%.2f mm height (#%d pulse)" $MMWATER $counter )
if (( counter >= RAINSENSORQTY_LOOPSFORSETRAINING )) ; then
drv_rainsensorqty_writelog $f "RAINING - $text" &
echo "$now:$counter" > ${RAINSENSORQTY_LASTRAIN}
else
drv_rainsensorqty_writelog $f "now is $text" &
fi
done

View File

@@ -0,0 +1,37 @@
#
# Driver rainsensorqty - driver for measure the rain volume
# Author: androtto
# file "init.include.sh"
# Inizializza il driver, viene richiamata nella funzione init di piGarden
# Version: 0.2.0
# Data: 11/Aug/2019
function drv_rainsensorqty_init {
local f="drv_rainsensorqty_init"
# format RAIN_GPIO="drv:rainsensorqty:25"
drv_rainsensorqty_writelog $f "NORMAL: executing $monitor_sh"
# esegue rainmonitor
if [ -x "$monitor_sh" ] ; then
nohup "$monitor_sh" >> $RAINSENSORQTY_MONITORLOG 2>&1 &
sleep 1
drv_rainsensorqty_writelog $f "NORMAL: $monitor_sh has pid $( < $RAINSENSORQTY_MONPID)"
else
drv_rainsensorqty_writelog $f "ERROR: cannot find \"\$monitor_sh \" "
fi
}
if ! config_check ; then
echo "ERROR in config_check function"
exit 1
else
: #echo "config_check ok"
fi
check_TMPDIR
RAINSENSORQTY_VAR=$TMPDIR/.rainsensorqty_var
set | $GREP -e ^GPIO -e ^LOG -e ^CUT -e ^JQ -e ^RAIN -e ^SCR -e ^TMP > $RAINSENSORQTY_VAR

View File

@@ -0,0 +1,104 @@
#
# Driver rainsensorqty - driver for measure the rain volume, for rain meter, for rain gauge
# Author: androtto
# file "rainsensor.include.sh"
# functions called by piGarden.sh
# Version: 0.1.2
# Data: 19/Mar/2019
# fixed output drv_rainsensorqty_rain_sensor_get
#
# Inizializza il sensore di rilevamento pioggia
#
# $1 identificativo gpio del sensore di pioggia
#
drv_rainsensorqty_rain_sensor_init()
{
local f=drv_rainsensorqty_rain_sensor_init
drv_rainsensorqty_writelog "launched: $f" $1
local drvt="$( echo $RAIN_GPIO | $CUT -f 1 -d: )"
local drv="$( echo $RAIN_GPIO | $CUT -f 2 -d: )"
local gpio_port="$( echo $RAIN_GPIO | $CUT -f 3 -d: )"
if $GPIO -g mode $gpio_port in ; then
drv_rainsensorqty_writelog $f "NORMAL: '$GPIO -g mode $gpio_port in' set correctly"
else
drv_rainsensorqty_writelog $f "ERROR: '$GPIO -g mode $gpio_port in' has an error"
exit 1
fi
case $GPIO_RESISTOR in
pull-up) gpio_arg=up
message="NORMAL: '$GPIO -g mode $gpio_port up' set internal pull-up resistor"
;;
pull-down) gpio_arg=down
message="NORMAL: '$GPIO -g mode $gpio_port down' set internal pull-down resistor"
;;
none) gpio_arg=tri
message="NORMAL: '$GPIO -g mode $gpio_port tri' set none to internal resistor"
;;
*) echo "ERROR: GPIO_RESISTOR not set correctly - values are \"pull-up|pull-down|none\" "
drv_rainsensorqty_writelog "drv_rainsensorqty_rain_sensor_init" "ERROR: GPIO_RESISTOR not set correctly - values are \"pull-up|pull-down|none\" "
exit 1
;;
esac
if $GPIO -g mode $gpio_port $gpio_arg ; then
drv_rainsensorqty_writelog $f "$message"
else
drv_rainsensorqty_writelog $f "ERROR: '$GPIO -g mode $gpio_port $gpio_arg' command"
exit 1
fi
}
#
# Ritorna in output lo stato del sensore di rilevamento pioggia
#
# $1 identificativo gpio del sensore di pioggia
#
# restituisce 0 se piove, e nell'output di testo il valore di "$RAIN_GPIO_STATE"
# restituisce 99 se non piove, output "norain"
# esce con 1 se non c'e' il monitoring, output "ERROR"
drv_rainsensorqty_rain_sensor_get()
{
local now=$(date +%s)
local interval=60 # because check_rain_sensor is scheduled once a minute ... to changed if schedule is modified, from crontab:
#* * * * * /home/pi/piGarden/piGarden.sh check_rain_sensor 2> /tmp/check_rain_sensor.err
local f="drv_rainsensorqty_check"
# script called with:
#drv_rainsensorqty_writelog $f $1
# ignora il parametro di $1, lo recupera dal file di configurazione
# verifica se lo script di monitoring e' attivo
if drv_rainsensorqty_check ; then
drv_rainsensorqty_writelog $f "NORMAL - drv_rainsensorqty_check ok, monitor process running"
if [ -f "$RAINSENSORQTY_LASTRAIN" ] ; then
local lastrain="$( cat "$RAINSENSORQTY_LASTRAIN" | $CUT -f 1 -d: )"
local counter="$( cat "$RAINSENSORQTY_LASTRAIN" | $CUT -f 2 -d: )"
LEVEL=$( $JQ -n "$counter/$RAINSENSORQTY_LOOPSFORSETRAINING" | $JQ 'floor' )
(( diff = now - lastrain ))
drv_rainsensorqty_writelog $f "NORMAL: last rain $( date --date="@$lastrain" ) - LEVEL $LEVEL rain"
drv_rainsensorqty_writelog $f "NORMAL: check rain $( date --date="@$now" ) "
if (( diff <= interval )) ; then
drv_rainsensorqty_writelog $f "RAIN - return \$RAIN_GPIO_STATE = $RAIN_GPIO_STATE as output"
drv_rainsensorqty_writelog $f "DEBUG : check rain - diff $diff < $interval - return $RAIN_GPIO_STATE"
msg="$RAIN_GPIO_STATE"
echo $msg
return 0
else
drv_rainsensorqty_writelog $f "NO_RAIN - return \"norain\" as output"
drv_rainsensorqty_writelog $f "DEBUG : check rain - diff $diff < $interval - return 99"
msg="norain"
echo $msg
return 99
fi
fi
else
drv_rainsensorqty_writelog $f "ERROR: drv_rainsensorqty_check failed, no monitor process running ($monitor_sh)"
msg="ERROR"
echo $msg
return 1
fi
}

14
drv/remote/README.md Normal file
View File

@@ -0,0 +1,14 @@
# Driver for controlling remote pigarden on the network from a pigarden master installation
For more information see https://www.lejubila.net/2018/03/pigardent-0-5-5-driver-master-per-implementare-un-architettura-master-slave/
# Example of zone configuration in piGarden.conf
```bash
EV1_ALIAS="Giarino_Posteriore_DX" #
EV1_GPIO="drv:remote:PIREMOTE1:Giardino_Posteriore_DX"
PIREMOTE1_IP="192.168.1.51"
PIREMOTE1_PORT="8084"
PIREMOTE1_USER=""
PIREMOTE1_PWD=""
```

View File

@@ -0,0 +1,38 @@
#
# Funzioni comuni utilizzate dal driver
#
#
# Esegue un comando su un pigarden remoto tramite socket
#
# $1 identificativo pigarden remoto
# $2 comando da eseguire
#
function drv_remote_command {
local remote="$1"
local command="$2"
local remote_ip_var=$remote"_IP"
local remote_port_var=$remote"_PORT"
local remote_user_var=$remote"_USER"
local remote_pwd_var=$remote"_PWD"
local remote_ip="${!remote_ip_var}"
local remote_port="${!remote_port_var}"
local remote_user="${!remote_user_var}"
local remote_pwd="${!remote_pwd_var}"
exec 5<>/dev/tcp/$remote_ip/$remote_port
if [[ ! -z $remote_user ]] && [[ ! -z $remote_pwd ]]; then
command="$remote_user\n$remote_pwd\n$command"
fi
echo -e "$command" >&5
cat <&5
}

View File

@@ -0,0 +1,7 @@
#
# File di configurazione del driver
#
# Dichiarazione variabile di esempio
#declare -g SAMPLE_FOO
#SAMPLE_FOO="bar"

View File

@@ -0,0 +1,9 @@
#
# Questa funzione viene inviocata dalla funzione "init" di piGarden se sono presenti elettrovalvole o sensori che utilizzano questo driver
#
function drv_remote_init {
local FOO=bar
}

View File

@@ -0,0 +1,23 @@
#
# Inizializza il sensore di rilevamento pioggia
#
# $i identificativo gpio del sensore di pioggia
#
function drv_remote_rain_sensor_init {
local FOO="bar"
}
#
# Ritorna lo stato del sensore di rilevamento pioggia
#
# $i identificativo gpio del sensore di pioggia
#
function drv_remote_rain_sensor_get {
local FOO="bar"
}

View File

@@ -0,0 +1,76 @@
#
# Inizializzazione rele
#
# $1 identificativo relè da inizializzare
#
function drv_remote_rele_init {
drv_remote_rele_open "$1"
}
#
# Apertura rele
#
# $1 identificativo relè da aprire (chiude l'elettrovalvola)
#
function drv_remote_rele_open {
local remote=`echo $1 | $CUT -d':' -f3,3`
local remote_alias=`echo $1 | $CUT -d':' -f4,4`
local command="close $remote_alias"
echo "remote=$remote"
echo "remote_alias=$remote_alias"
echo "command=$command"
local response=$(drv_remote_command "$remote" "$command")
echo "response=$response"
local result=$(echo $response|$JQ -M ".error.description")
echo "result=$result"
if [[ "$result" != "\"\"" ]]; then
local error=$result
error="${error%\"}"
error="${error#\"}"
echo "error=$error"
log_write "drv_remote" "error" "Remote rele open error: $error"
message_write "warning" "Remote rele open error: $error"
return 1
fi
}
#
# Chiusura rele
#
# $1 identificativo relè da chiudere (apre l'elettrovalvola)
#
function drv_remote_rele_close {
local remote=`echo $1 | $CUT -d':' -f3,3`
local remote_alias=`echo $1 | $CUT -d':' -f4,4`
local command="open $remote_alias force"
echo "remote=$remote"
echo "remote_alias=$remote_alias"
echo "command=$command"
local response=$(drv_remote_command "$remote" "$command")
echo "response=$response"
local result=`echo $response|$JQ -M ".error.description"`
echo "result=$result"
if [[ "$result" != "\"\"" ]]; then
local error=$result
error="${error%\"}"
error="${error#\"}"
echo "error=$error"
log_write "drv_remoter" "error" "Remote rele close error: $error"
message_write "warning" "Remote rele close error: $error"
return 1
fi
}

View File

@@ -0,0 +1,27 @@
#
# Questa funzione viene invocata dalla funzione "setup_drv" di piGarden ad ogni avvio dello script
# e serve per eseguire l'eventuale setup del driver se necessario
#
function drv_remote_setup {
local all_remote=0
# Imposta le zone come remote
for i in $(seq $EV_TOTAL)
do
local a=EV"$i"_GPIO
local gpio="${!a}"
if [[ "$gpio" == drv:remote:* ]]; then
local varname=EV"$i"_REMOTE
declare -g $varname=1
all_remote=$((all_remote+1))
fi
done
# Se tutte le zone sono remote disabilita la gestione dell'alimentazione bistabile
if [ $all_remote -eq $EV_TOTAL ]; then
EV_MONOSTABLE=1
fi
}

View File

@@ -0,0 +1,34 @@
#
# Inizializza i rele che gestiscono l'alimentazione per le valvole bistabili
#
# $1 identificativo relè
#
function drv_remote_supply_bistable_init {
local FOO="bar"
}
#
# Imposta l'alimentazione delle elettrovalvole con voltaggio positivo
#
# $1 identificativo relè
#
function drv_remote_supply_positive {
local FOO="bar"
}
#
# Imposta l'alimentazione delle elettrovalvole con voltaggio negativo
#
# $1 identificativo relè
#
function drv_remote_supply_negative {
local FOO="bar"
}

2
drv/sample/README.md Normal file
View File

@@ -0,0 +1,2 @@
# Fake driver for sample and testing

View File

@@ -0,0 +1,12 @@
#
# Funzioni comuni utilizzate dal driver
#
#
# Funzione di esempio
#
function drv_sample_foo {
echo "bar"
}

View File

@@ -0,0 +1,7 @@
#
# File di configurazione del driver
#
# Dichiarazione variabile di esempio
declare -g SAMPLE_FOO
SAMPLE_FOO="bar"

View File

@@ -0,0 +1,9 @@
#
# Questa funzione viene invocata dalla funzione "init" di piGarden se sono presenti elettrovalvole o sensori che utilizzano questo driver
#
function drv_sample_init {
local FOO="bar"
}

View File

@@ -0,0 +1,13 @@
#
# Ritorna lo stato delle condizioni meteo interrogando il servizio online
#
# return output: 0 - errore durante il recupero delle condizioni meteo
# >0 - rilevato pioggia, timestamp del rilevamento
# <0 - rilevato nessuna pioggia, timestamp del rilevamento
function drv_sample_rain_online_get {
local FOO="bar"
}

View File

@@ -0,0 +1,23 @@
#
# Inizializza il sensore di rilevamento pioggia
#
# $i identificativo gpio del sensore di pioggia
#
function drv_sample_rain_sensor_init {
local FOO="bar"
}
#
# Ritorna lo stato del sensore di rilevamento pioggia
#
# $i identificativo gpio del sensore di pioggia
#
function drv_sample_rain_sensor_get {
local FOO="bar"
}

View File

@@ -0,0 +1,33 @@
#
# Inizializzazione rele
#
# $1 identificativo relè da inizializzare
#
function drv_sample_rele_init {
local FOO="bar"
}
#
# Apertura rele
#
# $1 identificativo relè da aprire
#
function drv_sample_rele_open {
local FOO="bar"
}
#
# Chiusura rele
#
# $1 identificativo relè da chiudere
#
function drv_sample_rele_close {
local FOO="bar"
}

View File

@@ -0,0 +1,10 @@
#
# Questa funzione viene invocata dalla funzione "setup_drv" di piGarden ad ogni avvio dello script
# e serve per eseguire l'eventuale setup del driver se necessario
#
function drv_sample_setup {
local FOO="bar"
}

View File

@@ -0,0 +1,34 @@
#
# Inizializza i rele che gestiscono l'alimentazione per le valvole bistabili
#
# $1 identificativo relè
#
function drv_sample_supply_bistable_init {
local FOO="bar"
}
#
# Imposta l'alimentazione delle elettrovalvole con voltaggio positivo
#
# $1 identificativo relè
#
function drv_sample_supply_positive {
local FOO="bar"
}
#
# Imposta l'alimentazione delle elettrovalvole con voltaggio negativo
#
# $1 identificativo relè
#
function drv_sample_supply_negative {
local FOO="bar"
}

View File

@@ -0,0 +1,22 @@
# Driver for controlling Sonoff remote relays with Tasmota firmware via http protocol
More information on Sonoff Tasmota firmware: https://github.com/arendst/Sonoff-Tasmota
# Example of zone configuration in piGarden.conf
```bash
EV1_ALIAS="Giardino_Posteriore_DX"
EV1_GPIO="drv:sonoff_tasmota_http:SONOFF1:Power1"
EV1_MONOSTABLE=1
EV2_ALIAS="Giardino_Posteriore_CN"
EV2_GPIO="drv:sonoff_tasmota_http:SONOFF1:Power2"
EV2_MONOSTABLE=1
SONOFF1_IP="192.168.1.1"
SONOFF1_USER="user"
SONOFF1_PWD="pwd"
```
More information for configuration: https://www.lejubila.net/2018/06/pigarden-0-5-7-gestisci-le-tue-elettrovalvole-con-i-moduli-sonoff-grazie-al-nuovo-driver-sonoff_tasmota_http

View File

@@ -0,0 +1,50 @@
#
# Funzioni comuni utilizzate dal driver
#
#
# Invia un comando al modulo sonoff tramite http
#
# $1 identificativo modulo sonoff
# $2 comando da eseguire
#
function drv_sonoff_tasmota_http_command {
local remote="$1"
local command="$2"
local remote_ip_var=$remote"_IP"
local remote_user_var=$remote"_USER"
local remote_pwd_var=$remote"_PWD"
local remote_ip="${!remote_ip_var}"
local remote_user="${!remote_user_var}"
local remote_pwd="${!remote_pwd_var}"
local url="http://$remote_ip/cm"
local credentials=""
local response=""
if [[ ! -z $remote_user ]] && [[ ! -z $remote_pwd ]]; then
credentials="user=$remote_user&password=$remote_pwd&"
fi
url="$url?$credentials$command"
echo "url api sonoff: $url" >> "$LOG_OUTPUT_DRV_FILE"
$CURL --connect-timeout 5 -sb -H "$url"
local res=$?
echo "curl code response: $res" >> "$LOG_OUTPUT_DRV_FILE"
if [ "$res" != "0" ]; then
echo "The curl command failed with: $res - url: $url"
fi
#echo "{\"POWER1\":\"ON\"}"
}

View File

@@ -0,0 +1,7 @@
#
# File di configurazione del driver
#
# Dichiarazione variabile di esempio
#declare -g SAMPLE_FOO
#SAMPLE_FOO="bar"

View File

@@ -0,0 +1,9 @@
#
# Questa funzione viene inviocata dalla funzione "init" di piGarden se sono presenti elettrovalvole o sensori che utilizzano questo driver
#
function drv_sonoff_tasmota_http_init {
local FOO=bar
}

View File

@@ -0,0 +1,23 @@
#
# Inizializza il sensore di rilevamento pioggia
#
# $i identificativo gpio del sensore di pioggia
#
function drv_sonoff_tasmota_http_rain_sensor_init {
local FOO="bar"
}
#
# Ritorna lo stato del sensore di rilevamento pioggia
#
# $i identificativo gpio del sensore di pioggia
#
function drv_sonoff_tasmota_http_rain_sensor_get {
local FOO="bar"
}

View File

@@ -0,0 +1,78 @@
#
# Inizializzazione rele
#
# $1 identificativo relè da inizializzare
#
function drv_sonoff_tasmota_http_rele_init {
drv_sonoff_tasmota_http_rele_open "$1"
}
#
# Apertura rele
#
# $1 identificativo relè da aprire (chiude l'elettrovalvola)
#
function drv_sonoff_tasmota_http_rele_open {
local remote=`echo $1 | $CUT -d':' -f3,3`
local remote_alias=`echo $1 | $CUT -d':' -f4,4`
local command="cmnd=$remote_alias%20Off"
echo "remote=$remote"
echo "remote_alias=$remote_alias"
echo "command=$command"
local response=$(drv_sonoff_tasmota_http_command "$remote" "$command")
echo "response=$response"
local jskey=${remote_alias^^}
local result=$(echo $response|$JQ -M ".$jskey")
echo "result=$result"
if [[ "$result" != "\"OFF\"" ]]; then
local error="Command error: $response"
error="${error%\"}"
error="${error#\"}"
echo "error=$error"
log_write "drv_sonoff_tasmota_http" "error" "Remote rele open error: $error"
message_write "warning" "Remote rele open error: $error"
return 1
fi
}
#
# Chiusura rele
#
# $1 identificativo relè da chiudere (apre l'elettrovalvola)
#
function drv_sonoff_tasmota_http_rele_close {
local remote=`echo $1 | $CUT -d':' -f3,3`
local remote_alias=`echo $1 | $CUT -d':' -f4,4`
local command="cmnd=$remote_alias%20On"
echo "remote=$remote"
echo "remote_alias=$remote_alias"
echo "command=$command"
local response=$(drv_sonoff_tasmota_http_command "$remote" "$command")
echo "response=$response"
local jskey=${remote_alias^^}
local result=$(echo $response|$JQ -M ".$jskey")
echo "result=$result"
if [[ "$result" != "\"ON\"" ]]; then
local error="Command error: $response"
error="${error%\"}"
error="${error#\"}"
echo "error=$error"
log_write "drv_sonoff_tasmota_http" "error" "Remote rele close error: $error"
message_write "warning" "Remote rele close error: $error"
return 1
fi
}

View File

@@ -0,0 +1,10 @@
#
# Questa funzione viene invocata dalla funzione "setup_drv" di piGarden ad ogni avvio dello script
# e serve per eseguire l'eventuale setup del driver se necessario
#
function drv_sonoff_tasmota_http_setup {
local FOO="bar"
}

View File

@@ -0,0 +1,34 @@
#
# Inizializza i rele che gestiscono l'alimentazione per le valvole bistabili
#
# $1 identificativo relè
#
function drv_sonoff_tasmota_http_supply_bistable_init {
drv_sonoff_tasmota_http_supply_negative "$1"
}
#
# Imposta l'alimentazione delle elettrovalvole con voltaggio positivo
#
# $1 identificativo relè
#
function drv_sonoff_tasmota_http_supply_positive {
drv_sonoff_tasmota_http_rele_open "$1"
}
#
# Imposta l'alimentazione delle elettrovalvole con voltaggio negativo
#
# $1 identificativo relè
#
function drv_sonoff_tasmota_http_supply_negative {
drv_sonoff_tasmota_http_rele_close "$1"
}

12
drv/spb16ch/README.md Normal file
View File

@@ -0,0 +1,12 @@
# Driver per controllare la scheda "Smart Power Board 16 channel with RTC" (spb16ch)
Questo driver richiede l'interprete python e la libreria python-smbus. Inoltre l'utente pi deve fare parte del gruppo i2c
sudo apt-get install python python-smbus
sudo usermod -a -G i2c pi
Oltre a quanto sopra indicato, il raspberry deve avere caricato i moduli di gestione del bus i2c:
sudo raspi-config
Interfacing Options / I2C / Yes
Per maggiori informazioni consulta https://www.lejubila.net/2017/10/pigarden-spb16ch-gestiamo-fino-a-128-zone-nel-nostro-impianto-di-irrigazione/

View File

@@ -0,0 +1,80 @@
#
# Funzioni comuni per il driver spb16ch
#
#
# Abilita una scheda spb16ch in modo che possa esseregli impartito un comando successivamente
# $1 identificativo scheda da abilitare
#
function drv_spb16ch_board_enable {
local board_id=$1
local a=SPB16CH"$board_id"_GPIO
local gpio_n=${!a}
echo "** drv_spb16ch_board_enable() - Enable board: $board_id - gpio $gpio_n"
$GPIO -g write $gpio_n $SPB16CH_GPIO_ON
}
#
# Disabilita una scheda spb16ch
# $1 identificativo scheda da disabilitare
#
function drv_spb16ch_board_disable {
local board_id=$1
local a=SPB16CH"$board_id"_GPIO
local gpio_n=${!a}
echo "** drv_spb16ch_board_disable() - Disable board: $board_id - gpio $gpio_n"
$GPIO -g write $gpio_n $SPB16CH_GPIO_OFF
}
#
# Disabilita tutte le schede
#
function drv_spb16ch_board_disable_all {
echo "** drv_spb16ch_board_disable_all() - Boads id: ${SPB16CH_USED_ID[@]}"
local board_id
for board_id in ${SPB16CH_USED_ID[@]}
do
local a=SPB16CH"$board_id"_GPIO
local gpio_n=${!a}
echo "** drv_spb16ch_board_disable_all() - Disable board: $board_id - gpio $gpio_n"
$GPIO -g write $gpio_n $SPB16CH_GPIO_OFF
done
}
#
# Memorizza in un file di appoggio gli id delle schede spb16ch utilizzate
#
function drv_spb16ch_boards_id_store {
echo "${SPB16CH_USED_ID[@]}" > "$SPB16CH_BOARD_ID_STORE_FILE"
}
#
# Recupera gli di delle schede spb16ch utilizzate leggendoli dal file di appoggio
# $1 identificativi schede da salvare
#
function drv_spb16ch_boards_id_load {
if [ -f "$SPB16CH_BOARD_ID_STORE_FILE" ]; then
for board_id in $(cat "$SPB16CH_BOARD_ID_STORE_FILE")
do
SPB16CH_USED_ID+=("$board_id")
done
else
log_write "drv_spb16ch" "error" "spb16ch: file $SPB16CH_BOARD_ID_STORE_FILE not found: remember to run 'piGarden init' to generate the file"
fi
}

View File

@@ -0,0 +1,160 @@
#
# Mapping rele spb16ch: l'indice indica il relè, ogni elemento deve essere lungo 8 caratteri,
# 1-2: i primi due indicano l'indirizzo della scheda
# 3-3: separatore
# 4-4: il quarto carattere indica il mux channel
# 5-5: separatore
# 6-8: dal 6 all'ottavo carattere indicano il numero del rele sul canale
# 10-10: l'ultimo carattere indica il numero identificativo della scheda spb16ch
# Scheda 1 - address 70h - GS1:chiuso, GS2:chiuso, GS3:chiuso
SPB16CH_RELE_MAP[1]="70|0| 1|1"
SPB16CH_RELE_MAP[2]="70|0| 2|1"
SPB16CH_RELE_MAP[3]="70|0| 4|1"
SPB16CH_RELE_MAP[4]="70|0| 8|1"
SPB16CH_RELE_MAP[5]="70|0| 16|1"
SPB16CH_RELE_MAP[6]="70|0| 32|1"
SPB16CH_RELE_MAP[7]="70|0| 64|1"
SPB16CH_RELE_MAP[8]="70|0|128|1"
SPB16CH_RELE_MAP[9]="70|1| 1|1"
SPB16CH_RELE_MAP[10]="70|1| 2|1"
SPB16CH_RELE_MAP[11]="70|1| 4|1"
SPB16CH_RELE_MAP[12]="70|1| 8|1"
SPB16CH_RELE_MAP[13]="70|1| 16|1"
SPB16CH_RELE_MAP[14]="70|1| 32|1"
SPB16CH_RELE_MAP[15]="70|1| 64|1"
SPB16CH_RELE_MAP[16]="70|1|128|1"
# Scheda 2 - address 71h - GS1:aperto, GS2:chiuso, GS3:chiuso
SPB16CH_RELE_MAP[17]="71|0| 1|2"
SPB16CH_RELE_MAP[18]="71|0| 2|2"
SPB16CH_RELE_MAP[19]="71|0| 4|2"
SPB16CH_RELE_MAP[20]="71|0| 8|2"
SPB16CH_RELE_MAP[21]="71|0| 16|2"
SPB16CH_RELE_MAP[22]="71|0| 32|2"
SPB16CH_RELE_MAP[23]="71|0| 64|2"
SPB16CH_RELE_MAP[24]="71|0|128|2"
SPB16CH_RELE_MAP[25]="71|1| 1|2"
SPB16CH_RELE_MAP[26]="71|1| 2|2"
SPB16CH_RELE_MAP[27]="71|1| 4|2"
SPB16CH_RELE_MAP[28]="71|1| 8|2"
SPB16CH_RELE_MAP[29]="71|1| 16|2"
SPB16CH_RELE_MAP[30]="71|1| 32|2"
SPB16CH_RELE_MAP[31]="71|1| 64|2"
SPB16CH_RELE_MAP[32]="71|1|128|2"
# Scheda 3 - address 72h - GS1:chiuso, GS2:aperto, GS3:chiuso
SPB16CH_RELE_MAP[33]="72|0| 1|3"
SPB16CH_RELE_MAP[34]="72|0| 2|3"
SPB16CH_RELE_MAP[35]="72|0| 4|3"
SPB16CH_RELE_MAP[36]="72|0| 8|3"
SPB16CH_RELE_MAP[37]="72|0| 16|3"
SPB16CH_RELE_MAP[38]="72|0| 32|3"
SPB16CH_RELE_MAP[39]="72|0| 64|3"
SPB16CH_RELE_MAP[40]="72|0|128|3"
SPB16CH_RELE_MAP[41]="72|1| 1|3"
SPB16CH_RELE_MAP[42]="72|1| 2|3"
SPB16CH_RELE_MAP[43]="72|1| 4|3"
SPB16CH_RELE_MAP[44]="72|1| 8|3"
SPB16CH_RELE_MAP[45]="72|1| 16|3"
SPB16CH_RELE_MAP[46]="72|1| 32|3"
SPB16CH_RELE_MAP[47]="72|1| 64|3"
SPB16CH_RELE_MAP[48]="72|1|128|3"
# Scheda 4 - address 73h - GS1:aperto, GS2:aperto, GS3:chiuso
SPB16CH_RELE_MAP[49]="73|0| 1|4"
SPB16CH_RELE_MAP[50]="73|0| 2|4"
SPB16CH_RELE_MAP[51]="73|0| 4|4"
SPB16CH_RELE_MAP[52]="73|0| 8|4"
SPB16CH_RELE_MAP[53]="73|0| 16|4"
SPB16CH_RELE_MAP[54]="73|0| 32|4"
SPB16CH_RELE_MAP[55]="73|0| 64|4"
SPB16CH_RELE_MAP[56]="73|0|128|4"
SPB16CH_RELE_MAP[57]="73|1| 1|4"
SPB16CH_RELE_MAP[58]="73|1| 2|4"
SPB16CH_RELE_MAP[59]="73|1| 4|4"
SPB16CH_RELE_MAP[60]="73|1| 8|4"
SPB16CH_RELE_MAP[61]="73|1| 16|4"
SPB16CH_RELE_MAP[62]="73|1| 32|4"
SPB16CH_RELE_MAP[63]="73|1| 64|4"
SPB16CH_RELE_MAP[64]="73|1|128|4"
# Scheda 5 - address 74h - GS1:chiuso, GS2:chiuso, GS3:aperto
SPB16CH_RELE_MAP[65]="74|0| 1|5"
SPB16CH_RELE_MAP[66]="74|0| 2|5"
SPB16CH_RELE_MAP[67]="74|0| 4|5"
SPB16CH_RELE_MAP[68]="74|0| 8|5"
SPB16CH_RELE_MAP[69]="74|0| 16|5"
SPB16CH_RELE_MAP[70]="74|0| 32|5"
SPB16CH_RELE_MAP[71]="74|0| 64|5"
SPB16CH_RELE_MAP[72]="74|0|128|5"
SPB16CH_RELE_MAP[73]="74|1| 1|5"
SPB16CH_RELE_MAP[74]="74|1| 2|5"
SPB16CH_RELE_MAP[75]="74|1| 4|5"
SPB16CH_RELE_MAP[76]="74|1| 8|5"
SPB16CH_RELE_MAP[77]="74|1| 16|5"
SPB16CH_RELE_MAP[78]="74|1| 32|5"
SPB16CH_RELE_MAP[79]="74|1| 64|5"
SPB16CH_RELE_MAP[80]="74|1|128|5"
# Scheda 6 - address 75h - GS1:aperto, GS2:chiuso, GS3:aperto
SPB16CH_RELE_MAP[81]="75|0| 1|6"
SPB16CH_RELE_MAP[82]="75|0| 2|6"
SPB16CH_RELE_MAP[83]="75|0| 4|6"
SPB16CH_RELE_MAP[84]="75|0| 8|6"
SPB16CH_RELE_MAP[85]="75|0| 16|6"
SPB16CH_RELE_MAP[86]="75|0| 32|6"
SPB16CH_RELE_MAP[87]="75|0| 64|6"
SPB16CH_RELE_MAP[88]="75|0|128|6"
SPB16CH_RELE_MAP[89]="75|1| 1|6"
SPB16CH_RELE_MAP[90]="75|1| 2|6"
SPB16CH_RELE_MAP[91]="75|1| 4|6"
SPB16CH_RELE_MAP[92]="75|1| 8|6"
SPB16CH_RELE_MAP[93]="75|1| 16|6"
SPB16CH_RELE_MAP[94]="75|1| 32|6"
SPB16CH_RELE_MAP[95]="75|1| 64|6"
SPB16CH_RELE_MAP[96]="75|1|128|6"
# Scheda 7 - address 76h - GS1:chiuso, GS2:aperto, GS3:aperto
SPB16CH_RELE_MAP[97]="76|0| 1|7"
SPB16CH_RELE_MAP[98]="76|0| 2|7"
SPB16CH_RELE_MAP[99]="76|0| 4|7"
SPB16CH_RELE_MAP[100]="76|0| 8|7"
SPB16CH_RELE_MAP[101]="76|0| 16|7"
SPB16CH_RELE_MAP[102]="76|0| 32|7"
SPB16CH_RELE_MAP[103]="76|0| 64|7"
SPB16CH_RELE_MAP[104]="76|0|128|7"
SPB16CH_RELE_MAP[105]="76|1| 1|7"
SPB16CH_RELE_MAP[106]="76|1| 2|7"
SPB16CH_RELE_MAP[107]="76|1| 4|7"
SPB16CH_RELE_MAP[108]="76|1| 8|7"
SPB16CH_RELE_MAP[109]="76|1| 16|7"
SPB16CH_RELE_MAP[110]="76|1| 32|7"
SPB16CH_RELE_MAP[111]="76|1| 64|7"
SPB16CH_RELE_MAP[112]="76|1|128|7"
# Scheda 8 - address 77h - GS1:aperto, GS2:aperto, GS3:aperto
SPB16CH_RELE_MAP[113]="77|0| 1|8"
SPB16CH_RELE_MAP[114]="77|0| 2|8"
SPB16CH_RELE_MAP[115]="77|0| 4|8"
SPB16CH_RELE_MAP[116]="77|0| 8|8"
SPB16CH_RELE_MAP[117]="77|0| 16|8"
SPB16CH_RELE_MAP[118]="77|0| 32|8"
SPB16CH_RELE_MAP[119]="77|0| 64|8"
SPB16CH_RELE_MAP[120]="77|0|128|8"
SPB16CH_RELE_MAP[121]="77|1| 1|8"
SPB16CH_RELE_MAP[122]="77|1| 2|8"
SPB16CH_RELE_MAP[123]="77|1| 4|8"
SPB16CH_RELE_MAP[124]="77|1| 8|8"
SPB16CH_RELE_MAP[125]="77|1| 16|8"
SPB16CH_RELE_MAP[126]="77|1| 32|8"
SPB16CH_RELE_MAP[127]="77|1| 64|8"
SPB16CH_RELE_MAP[128]="77|1|128|8"
# Array contenente i gli identificativi delle schede usate
declare -g -a SPB16CH_USED_ID
SPB16CH_USED_ID=()
# Nome del file dove memorizzare gli id delle schede utilizzate
declare -g SPB16CH_BOARD_ID_STORE_FILE
SPB16CH_BOARD_ID_STORE_FILE="$STATUS_DIR/spb16ch_board_id_store"

View File

@@ -0,0 +1,84 @@
#
# Questa funzione viene inviocata dalla funzione "init" di piGarden se sono presenti elettrovalvole o sensori che utilizzano questo driver
#
function drv_spb16ch_init {
declare -a address_used
address_used=()
SPB16CH_USED_ID=()
local address=""
local board_id=""
# Cerca gli indirizzi delle schede spb16ch utilizzate per i rele utilizzati per le zone
for i in $(seq $EV_TOTAL)
do
local a=EV"$i"_GPIO
local gpio="${!a}"
if [[ "$gpio" == drv:spb16ch:* ]]; then
local rele_id=`echo $gpio | $CUT -d':' -f3,3`
local rele_data=${SPB16CH_RELE_MAP[$rele_id]}
if [[ ! -z $rele_data ]]; then
local address_num=${rele_data:0:2}
local board_id=${rele_data:9:1}
if [[ ! " ${address_used[@]} " =~ " ${address_num} " ]]; then
address_used+=("$address_num")
SPB16CH_USED_ID+=("$board_id")
fi
fi
fi
done
# Cerca gli indirizzi delle schede spb16ch utilizzate per i rele che gestiscono l'alimentazione delle elettrovalvole bistabili
for gpio in "$SUPPLY_GPIO_1" "$SUPPLY_GPIO_2"
do
if [[ "$gpio" == drv:spb16ch:* ]]; then
local rele_id=`echo $gpio | $CUT -d':' -f3,3`
local rele_data=${SPB16CH_RELE_MAP[$rele_id]}
if [[ ! -z $rele_data ]]; then
local address_num=${rele_data:0:2}
local board_id=${rele_data:9:1}
if [[ ! " ${address_used[@]} " =~ " ${address_num} " ]]; then
address_used+=("$address_num")
SPB16CH_USED_ID+=("$board_id")
fi
fi
fi
done
# Memorizza gli id delle schede usate
drv_spb16ch_boards_id_store
# Esegue l'inizializzazione dei gpio che gestiscono l'abilitazine/disabilitazione delle schede
local board_id
for board_id in ${SPB16CH_USED_ID[@]}
do
local a=SPB16CH"$board_id"_GPIO
local gpio_n=${!a}
echo "******** Number used board: $board_id - inizializzazione gpio $gpio_n"
$GPIO -g mode $gpio_n out
done
#drv_spb16ch_board_disable_all
# Esegue l'inizializzazione delle schede spb16ch trovate
local address_num=""
local board_num=""
for i in ${!address_used[@]}
do
address_num=${address_used[$i]}
board_num=${SPB16CH_USED_ID[$i]}
drv_spb16ch_board_enable $board_num # Porto alto il reset della scheda e lo mantengo sempre alto
echo "****** Inizializzazione address_num = $address_num - board_num = $board_num *******"
$DIR_SCRIPT/drv/spb16ch/scripts/mux_channel.py $address_num 0
$DIR_SCRIPT/drv/spb16ch/scripts/gpo_init.py 25 255 0
$DIR_SCRIPT/drv/spb16ch/scripts/mux_channel.py $address_num 1
$DIR_SCRIPT/drv/spb16ch/scripts/gpo_init.py 25 255 0
$DIR_SCRIPT/drv/spb16ch/scripts/mux_channel.py $address_num 0
# Disabilito il mux
$DIR_SCRIPT/drv/spb16ch/scripts/mux_disable.py $address_num
#drv_spb16ch_board_disable $board_id
done
}

View File

@@ -0,0 +1,23 @@
#
# Inizializza il sensore di rilevamento pioggia
#
# $i identificativo gpio del sensore di pioggia
#
function drv_spb16ch_rain_sensor_init {
local FOO="bar"
}
#
# Ritorna lo stato del sensore di rilevamento pioggia
#
# $i identificativo gpio del sensore di pioggia
#
function drv_spb16ch_rain_sensor_get {
local FOO="bar"
}

View File

@@ -0,0 +1,76 @@
#
# Inizializzazione rele
#
# $1 identificativo relè da inizializzare
#
function drv_spb16ch_rele_init {
drv_spb16ch_rele_open "$1"
}
#
# Apertura rele
#
# $1 identificativo relè da aprire
#
function drv_spb16ch_rele_open {
local rele_id=`echo $1 | $CUT -d':' -f3,3`
local rele_data=${SPB16CH_RELE_MAP[$rele_id]}
if [[ -z $rele_data ]]; then
local message="Error - Rele map not defined - rele_id=$rele_id - ($1)"
log_write "drv_spb16ch" "error" "$message"
message_write "warning" "$message"
fi
local address_num=${rele_data:0:2}
local channel_num=${rele_data:3:1}
local rele_num=${rele_data:5:3}
local board_id=${rele_data:9:1}
#drv_spb16ch_board_enable $board_id
echo address_num=$address_num
echo channel_num=$channel_num
echo rele_num=$rele_num
$DIR_SCRIPT/drv/spb16ch/scripts/mux_channel.py $address_num $channel_num
$DIR_SCRIPT/drv/spb16ch/scripts/gpo_init.py $address_num $rele_num 0
# Disabilito il mux
$DIR_SCRIPT/drv/spb16ch/scripts/mux_disable.py $address_num
#drv_spb16ch_board_disable $board_id
}
#
# Chiusura rele
#
# $1 identificativo relè da chiudere
#
function drv_spb16ch_rele_close {
local rele_id=`echo $1 | $CUT -d':' -f3,3`
local rele_data=${SPB16CH_RELE_MAP[$rele_id]}
if [[ -z $rele_data ]]; then
local message="Error - Rele map not defined - rele_id=$rele_id - ($1)"
log_write "drv_spb16ch" "error" "$message"
message_write "warning" "$message"
fi
local address_num=${rele_data:0:2}
local channel_num=${rele_data:3:1}
local rele_num=${rele_data:5:3}
local board_id=${rele_data:9:1}
#drv_spb16ch_board_enable $board_id
echo address_num=$address_num
echo channel_num=$channel_num
echo rele_num=$rele_num
$DIR_SCRIPT/drv/spb16ch/scripts/mux_channel.py $address_num $channel_num
$DIR_SCRIPT/drv/spb16ch/scripts/gpo_init.py $address_num $rele_num 1
# Disabilito il mux
$DIR_SCRIPT/drv/spb16ch/scripts/mux_disable.py $address_num
#drv_spb16ch_board_disable $board_id
}

37
drv/spb16ch/scripts/ee_read.py Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/python
# coding=utf-8
# Read the eeprom 24C16
# I2C Address: 0x50 (24C16)
# sudo ./ee_read.py 0x50 address
# Example: sudo ./ee_read.py 50 0
import time
import argparse
import RPi.GPIO as GPIO
import smbus
def I2C_setup(i2c_address, eeprom_address):
I2C_address = 0x50
if GPIO.RPI_REVISION in [2, 3]:
I2C_bus_number = 1
else:
I2C_bus_number = 0
bus = smbus.SMBus(I2C_bus_number)
#bus.read_byte_data(I2C_address, eeprom_address)
print("24C16 ADDRESS: {}".format(bin(eeprom_address)))
print("24C16 DATA: {}".format(bin(bus.read_byte_data(I2C_address, eeprom_address))))
print("24C16 DATA: {}".format(hex(bus.read_byte_data(I2C_address, eeprom_address))))
def menu():
parser = argparse.ArgumentParser(description='Select address to read data on eeprom 24C16 ')
parser.add_argument('i2c_address', type=int)
parser.add_argument('eeprom_address', type=int)
args = parser.parse_args()
I2C_setup(args.i2c_address, args.eeprom_address)
if __name__ == "__main__":
menu()

35
drv/spb16ch/scripts/ee_write.py Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/python
# coding=utf-8
# Write the eeprom 24C16
# I2C Address: 0x50 (24C16)
# sudo ./ee_write.py 0x50 address data
# Example: sudo ./ee_write.py 50 0 1
import time
import argparse
import RPi.GPIO as GPIO
import smbus
def I2C_setup(i2c_address, eeprom_address, eeprom_data):
I2C_address = 0x50
if GPIO.RPI_REVISION in [2, 3]:
I2C_bus_number = 1
else:
I2C_bus_number = 0
bus = smbus.SMBus(I2C_bus_number)
bus.write_byte_data(I2C_address, eeprom_address, eeprom_data)
def menu():
parser = argparse.ArgumentParser(description='Select address and data to write on eeprom 24C16 ')
parser.add_argument('i2c_address', type=int)
parser.add_argument('eeprom_address', type=int)
parser.add_argument('eeprom_data', type=int)
args = parser.parse_args()
I2C_setup(args.i2c_address, args.eeprom_address, args.eeprom_data)
if __name__ == "__main__":
menu()

View File

@@ -0,0 +1,44 @@
#!/usr/bin/python
# coding=utf-8
# Select address and channel of PCA9571 I2C general purpose outputs
# I2C Address: 0x25 Fixed
# sudo ./gpo_active.py CHANNEL
# Example: sudo ./gpo_active.py 25 255 1 #all relays activates
import time
import argparse
import RPi.GPIO as GPIO
import smbus
def I2C_setup(multiplexer_i2c_address, i2c_channel_setup, state):
I2C_address = 0x25
if GPIO.RPI_REVISION in [2, 3]:
I2C_bus_number = 1
else:
I2C_bus_number = 0
bus = smbus.SMBus(I2C_bus_number)
status_outputs=bus.read_byte(I2C_address)
if state == 1:
i2c_channel_setup=status_outputs|i2c_channel_setup
elif state == 0:
i2c_channel_setup=(-i2c_channel_setup-1)&status_outputs
elif state == -1:
i2c_channel_setup=0
bus.write_byte(I2C_address, i2c_channel_setup)
#time.sleep(0)
file = open("rl1", "r")
address=int(file.readline())
channel_outputs=int(file.readline())
state=int(file.readline())
def menu():
I2C_setup(address, channel_outputs, state)
if __name__ == "__main__":
menu()

44
drv/spb16ch/scripts/gpo_init.py Executable file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/python
# coding=utf-8
# Select address and channel of PCA9571 I2C general purpose outputs
# I2C Address: 0x25 Fixed
# sudo ./gpo_active.py CHANNEL
# Example: sudo ./gpo_active.py 25 255 1 #all relays activates
import time
import argparse
import RPi.GPIO as GPIO
import smbus
def I2C_setup(multiplexer_i2c_address, i2c_channel_setup, state):
I2C_address = 0x25
if GPIO.RPI_REVISION in [2, 3]:
I2C_bus_number = 1
else:
I2C_bus_number = 0
bus = smbus.SMBus(I2C_bus_number)
status_outputs=bus.read_byte(I2C_address)
if state == 1:
i2c_channel_setup=status_outputs|i2c_channel_setup
elif state == 0:
i2c_channel_setup=(-i2c_channel_setup-1)&status_outputs
elif state == -1:
i2c_channel_setup=0
bus.write_byte(I2C_address, i2c_channel_setup)
#time.sleep(0)
def menu():
parser = argparse.ArgumentParser(description='Select channel outputs of PCA9571')
parser.add_argument('address', type=int)
parser.add_argument('channel_outputs', type=int)
parser.add_argument('state', type=int)
args = parser.parse_args()
I2C_setup(args.address, args.channel_outputs, args.state)
if __name__ == "__main__":
menu()

33
drv/spb16ch/scripts/gpo_read.py Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/python
# coding=utf-8
# Select address and channel of PCA9571 I2C general purpose outputs
# I2C Address: 0x25 Fixed
# sudo ./gpo_read.py CHANNEL
# Example: sudo ./gpo_read.py 25
import time
import argparse
import RPi.GPIO as GPIO
import smbus
def I2C_read(multiplexer_i2c_address):
I2C_address = 0x25
if GPIO.RPI_REVISION in [2, 3]:
I2C_bus_number = 1
else:
I2C_bus_number = 0
bus = smbus.SMBus(I2C_bus_number)
status_outputs=bus.read_byte(I2C_address)
time.sleep(0)
# print("PCA9571 sts:{}".format(bin(bus.read_byte(I2C_address))))
print("PCA9571 GPO sts:{}".format(hex(bus.read_byte(I2C_address))))
def menu():
I2C_read(0x25)
if __name__ == "__main__":
menu()

3
drv/spb16ch/scripts/gpo_send Executable file
View File

@@ -0,0 +1,3 @@
25
100
1

1
drv/spb16ch/scripts/gpo_states Executable file
View File

@@ -0,0 +1 @@
PCA9571 GPO sts:0x64

5
drv/spb16ch/scripts/init.sh Executable file
View File

@@ -0,0 +1,5 @@
./mux_channel.py 72 0
./gpo_init.py 25 255 0
./mux_channel.py 72 1
./gpo_init.py 25 255 0
./mux_channel.py 72 0

View File

@@ -0,0 +1,38 @@
#!/usr/bin/python
# coding=utf-8
# Select address and channel of PCA9547 I2C multiplexer
# I2C Address: 0xYY, where YY can be 70 through 77
# Multiplexer Channel: 1 - 8
# sudo ./mux_channel.py ADDRESS CHANNEL
# Example: sudo ./mux_channel.py 70 1
import time
import argparse
import RPi.GPIO as GPIO
import smbus
def I2C_setup(multiplexer_i2c_address, i2c_channel_setup):
I2C_address = 0x70 + multiplexer_i2c_address % 10
if GPIO.RPI_REVISION in [2, 3]:
I2C_bus_number = 1
else:
I2C_bus_number = 0
bus = smbus.SMBus(I2C_bus_number)
i2c_channel_setup=i2c_channel_setup + 0x08
bus.write_byte(I2C_address, i2c_channel_setup)
#time.sleep(0.1)
def menu():
parser = argparse.ArgumentParser(description='Select channel of PCA9547 I2C multiplexer')
parser.add_argument('address', type=int)
parser.add_argument('channel', type=int)
args = parser.parse_args()
I2C_setup(args.address, args.channel)
if __name__ == "__main__":
menu()

View File

@@ -0,0 +1,37 @@
#!/usr/bin/python
# coding=utf-8
# Disable PCA9547 I2C multiplexer
# I2C Address: 0xYY, where YY can be 70 through 77
# sudo ./mux_channel.py ADDRESS CHANNEL
# Example: sudo ./mux_disable.py 70
import time
import argparse
import RPi.GPIO as GPIO
import smbus
def I2C_setup(multiplexer_i2c_address):
I2C_address = 0x70 + multiplexer_i2c_address % 10
if GPIO.RPI_REVISION in [2, 3]:
I2C_bus_number = 1
else:
I2C_bus_number = 0
bus = smbus.SMBus(I2C_bus_number)
i2c_channel_setup=0x00
#i2c_channel_setup=i2c_channel_setup + 0x08
bus.write_byte(I2C_address, i2c_channel_setup)
#time.sleep(0.1)
def menu():
parser = argparse.ArgumentParser(description='Select Address of Disable PCA9547 Multiplexer')
parser.add_argument('address', type=int)
args = parser.parse_args()
I2C_setup(args.address)
if __name__ == "__main__":
menu()

37
drv/spb16ch/scripts/mux_read.py Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/python
# coding=utf-8
# Select address and channel of PCA9547 I2C multiplexer
# I2C Address: 0xYY, where YY can be 70 through 77
# Multiplexer Channel: 1 - 8
# sudo ./mux_read.py ADDRESS
# Example: sudo ./mux_read.py 70
import time
import argparse
import RPi.GPIO as GPIO
import smbus
def I2C_setup(multiplexer_i2c_address):
I2C_address = 0x70 + multiplexer_i2c_address % 10
if GPIO.RPI_REVISION in [2, 3]:
I2C_bus_number = 1
else:
I2C_bus_number = 0
bus = smbus.SMBus(I2C_bus_number)
time.sleep(0.1)
# print("PCA9547 MUX sts:{}".format(bin(bus.read_byte(I2C_address))))
print("PCA9547 MUX sts:{}".format(hex(bus.read_byte(I2C_address))))
def menu():
parser = argparse.ArgumentParser(description='Select channel of PCA9547 I2C multiplexer')
parser.add_argument('address', type=int)
args = parser.parse_args()
I2C_setup(args.address)
if __name__ == "__main__":
menu()

1
drv/spb16ch/scripts/mux_states Executable file
View File

@@ -0,0 +1 @@
PCA9547 MUX sts:0x8

View File

@@ -0,0 +1,6 @@
#!/usr/bin/python
# coding=utf-8
file = open("mux", "r")
line1=file.readline()
print line1

33
drv/spb16ch/scripts/rele1_16 Executable file
View File

@@ -0,0 +1,33 @@
25
1
0
2
0
4
0
8
0
16
1
32
1
64
1
128
1
1
0
2
0
4
0
8
0
16
1
32
1
64
1
128
1

View File

@@ -0,0 +1,95 @@
#!/usr/bin/python
# coding=utf-8
# Select address and channel of PCA9571 I2C general purpose outputs
# I2C Address: 0x25 Fixed
# sudo ./gpo_active.py CHANNEL
# Example: sudo ./gpo_active.py 25 255 1 #all relays activates
import time
import argparse
import subprocess
import RPi.GPIO as GPIO
import smbus
def I2C_setup(multiplexer_i2c_address, i2c_channel_setup, state):
I2C_address = 0x25
if GPIO.RPI_REVISION in [2, 3]:
I2C_bus_number = 1
else:
I2C_bus_number = 0
bus = smbus.SMBus(I2C_bus_number)
status_outputs=bus.read_byte(I2C_address)
if state == 1:
i2c_channel_setup=status_outputs|i2c_channel_setup
elif state == 0:
i2c_channel_setup=(-i2c_channel_setup-1)&status_outputs
elif state == -1:
i2c_channel_setup=0
bus.write_byte(I2C_address, i2c_channel_setup)
#time.sleep(0)
def menu():
while 1==1:
subprocess.call('./mux_channel.py 72 0', shell=True)
#time.sleep(0.1)
file = open("rele1_16", "r")
address=int(file.readline())
channel_outputs1=int(file.readline())
state1=int(file.readline())
channel_outputs2=int(file.readline())
state2=int(file.readline())
channel_outputs3=int(file.readline())
state3=int(file.readline())
channel_outputs4=int(file.readline())
state4=int(file.readline())
channel_outputs5=int(file.readline())
state5=int(file.readline())
channel_outputs6=int(file.readline())
state6=int(file.readline())
channel_outputs7=int(file.readline())
state7=int(file.readline())
channel_outputs8=int(file.readline())
state8=int(file.readline())
channel_outputs9=int(file.readline())
state9=int(file.readline())
channel_outputs10=int(file.readline())
state10=int(file.readline())
channel_outputs11=int(file.readline())
state11=int(file.readline())
channel_outputs12=int(file.readline())
state12=int(file.readline())
channel_outputs13=int(file.readline())
state13=int(file.readline())
channel_outputs14=int(file.readline())
state14=int(file.readline())
channel_outputs15=int(file.readline())
state15=int(file.readline())
channel_outputs16=int(file.readline())
state16=int(file.readline())
I2C_setup(address, channel_outputs1, state1)
I2C_setup(address, channel_outputs2, state2)
I2C_setup(address, channel_outputs3, state3)
I2C_setup(address, channel_outputs4, state4)
I2C_setup(address, channel_outputs5, state5)
I2C_setup(address, channel_outputs6, state6)
I2C_setup(address, channel_outputs7, state7)
I2C_setup(address, channel_outputs8, state8)
subprocess.call('./mux_channel.py 72 1', shell=True)
#time.sleep(0.1)
I2C_setup(address, channel_outputs9, state9)
I2C_setup(address, channel_outputs10, state10)
I2C_setup(address, channel_outputs11, state11)
I2C_setup(address, channel_outputs12, state12)
I2C_setup(address, channel_outputs13, state13)
I2C_setup(address, channel_outputs14, state14)
I2C_setup(address, channel_outputs15, state15)
I2C_setup(address, channel_outputs16, state16)
subprocess.call('./mux_channel.py 72 0', shell=True)
if __name__ == "__main__":
menu()

View File

@@ -0,0 +1,12 @@
#
# Questa funzione viene inviocata dalla funzione "setup_drv" ad ogni avvio di piGarden
# esegue il setup del driver recuperando gli identificativi delle schede sbp16ch usati
#
function drv_spb16ch_setup {
drv_spb16ch_boards_id_load
echo "*********** drv_spb16ch_setup: identificativi schede caricati: ${SPB16CH_USED_ID[@]}"
}

View File

@@ -0,0 +1,34 @@
#
# Inizializza i rele che gestiscono l'alimentazione per le valvole bistabili
#
# $1 identificativo relè
#
function drv_spb16ch_supply_bistable_init {
drv_spb16ch_supply_negative "$1"
}
#
# Imposta l'alimentazione delle elettrovalvole con voltaggio positivo
#
# $1 identificativo relè
#
function drv_spb16ch_supply_positive {
drv_spb16ch_rele_open "$1"
}
#
# Imposta l'alimentazione delle elettrovalvole con voltaggio negativo
#
# $1 identificativo relè
#
function drv_spb16ch_supply_negative {
drv_spb16ch_rele_close "$1"
}

View File

@@ -0,0 +1,12 @@
# Driver for check wather condition with wunderground online service
# Example of configuration in piGarden.conf
```bash
WEATHER_SERVICE="wunderground"
WUNDERGROUND_KEY="" # Set with your api key of wunderground
WUNDERGROUND_LOCATION="IY/Monsummano" # Set with your location indentify, see http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching&MR=1
```

View File

@@ -0,0 +1,12 @@
#
# Funzioni comuni utilizzate dal driver
#
#
# Funzione di esempio
#
function sample_foo {
echo "bar"
}

View File

@@ -0,0 +1,36 @@
#
# Ritorna lo stato delle condizioni meteo interrogando il servizio online
#
# $i identificativo gpio del sensore di pioggia
#
# return output: 0 - errore durante il recupero delle condizioni meteo
# >0 - rilevato pioggia, timestamp del rilevamento
# <0 - rilevato nessuna pioggia, timestamp del rilevamento
function drv_wunderground_rain_online_get {
# http://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary&MR=1
$CURL http://api.wunderground.com/api/$WUNDERGROUND_KEY/conditions/q/$WUNDERGROUND_LOCATION.json > $TMP_PATH/check_rain_online.json
local weather=`cat $TMP_PATH/check_rain_online.json | $JQ -M ".current_observation.weather"`
local current_observation=`cat $TMP_PATH/check_rain_online.json | $JQ -M ".current_observation"`
local local_epoch=`cat $TMP_PATH/check_rain_online.json | $JQ -M -r ".current_observation.local_epoch"`
if [ "$weather" = "null" ]; then
echo "0"
else
if [[ "$weather" == *"Rain"* ]] ||
[[ "$weather" == *"Snow"* ]] ||
[[ "$weather" == *"Hail"* ]] ||
[[ "$weather" == *"Ice"* ]] ||
[[ "$weather" == *"Thunderstorm"* ]] ||
[[ "$weather" == *"Drizzle"* ]];
then
echo $local_epoch
else
echo "-$local_epoch"
fi
echo "$current_observation" > "$STATUS_DIR/last_weather_online"
fi
}

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/cron_add_after/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/cron_add_before/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/cron_del_after/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/cron_del_before/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/ev_close_after/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/ev_close_before/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/ev_open_after/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/ev_open_before/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/ev_open_in_after/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/ev_open_in_before/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

4
events/exec_poweroff_after/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

Some files were not shown because too many files have changed in this diff Show More