I have recently updated the nadpwr.sh utility to provide more options, including NadHAT board status and a silent mode useful for use in a daemon. The exit code is also processed, making it possible to verify that the power on / off sequence went well if invoked in a program bash, python or other.


Deleting the local repository (on existing installation):

It is necessary to delete the contents of the repository so that you can re-clone (unless you have made any changes).

pi@Garatronic:~ $ cd ~/nadhat
pi@Garatronic:~/nadhat $ sudo rm -r -f *
pi@Garatronic:~/nadhat $ cd ..
pi@Garatronic:~ $

Warning: the 2nd command 'sudo rm -r -f *' is to unconditionally delete all the contents of the current folder. If we are not sure to be under the nadhat folder, you can check your location with the pwd command:

pi@Garatronic:~/nadhat $ pwd
pi@Garatronic:~/nadhat $


Download the complete repository (1st installation or empty nadhat directory):

pi@Garatronic:~ $ cd ~
pi@Garatronic:~ $ git clone https://github.com/garatronic/nadhat
Clonage dans 'nadhat'...
remote: Counting objects: 129, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 129 (delta 0), reused 1 (delta 0), pack-reused 125
Réception d'objets: 100% (129/129), 18.93 MiB | 1.24 MiB/s, fait.
Résolution des deltas: 100% (40/40), fait.
Vérification de la connectivité... fait.
pi@Garatronic:~ $


The nadpwd.sh utility is now installable:

pi@Garatronic:~ $ cd nadhat/software/
pi@Garatronic:~/nadhat/software $ ./nadpwr.sh install
nadpwr utility does not seens to be installed, do you want to install it ?
1) [y]es
2) [n]o
> y
nadpwr has been copied in /usr/local/sbin/
pi@Garatronic:~/nadhat/software $

L'utilitaire peut être maintenant invoqué de n'importe où, sans son extension '.sh'


Request the status of the NadHAT board:

pi@Garatronic:~ $ nadpwr
NadHAT board is off.
pi@Garatronic:~ $ 


Turning the NadHAT board on / off:

pi@Garatronic:~ $ nadpwr on
Pulse 1s on GPIO26 to power on SIM800C.
NadHAT is now on.
pi@Garatronic:~ $ nadpwr off
Pulse 1s on GPIO26 to power off SIM800C.
NadHAT is now off.
pi@Garatronic:~ $ 


Silent mode of the nadpwr.sh utility:

pi@Garatronic:~ $ nadpwr -q on
pi@Garatronic:~ $ nadpwr
NadHAT board is on.
pi@Garatronic:~ $


Version and help of the nadpwr.sh utility:

pi@Garatronic:~ $ nadpwr -v
/usr/local/sbin/nadpwr version 1.1 [2017-12-02]
pi@Garatronic:~ $ nadpwr -h
usage: nadpwr [-q] [-v] [-h] [on|off|install] 
 nadpwr on, nadpwr off, ./nadpwr.sh install
       [-q] quiet mode
       [-v] display version of software and exit
       [-h] display this help and exit
pi@Garatronic:~ $


See you soon.