Using a switch to shutdown domoticz GPIO

Moderator: leecollings

Post Reply
palmerfarmer
Posts: 11
Joined: Friday 06 February 2015 19:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: UK
Contact:

Using a switch to shutdown domoticz GPIO

Post by palmerfarmer »

I was wondering if there is a way to use a switch command or rather an input (GPIO contact) to shutdown the system.

I have an arduino that monitors a maintained battery supply which my domoticz pi is fed from (and the arduino).
When the mains fails and and the battery discharges i would like to shutdown domoticz cleanly when the battery volts falls below a set value. The arduino would send a contact closure low when this happens.

Has this been done before?

Thanks
Ian
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Using a switch to shutdown domoticz GPIO

Post by nayr »

I use this application to shut down my Dispatch/NAS/VM servers when the batteries start running low, does not use Domoticz but I can script domo to be aware of the status.. http://www.apcupsd.org/

I dont think this is something you want to do via Domoticz, what if you accidentally click the button and kill your server.. it wont start back up because power wont actually be removed.. there is only 1 instance where you want to shut down so its not any good reason to bring the event into domoticz IMHO.

the simplest way: just run a shell script as root checking the battery status every few mins and have it power down without the help of domoticz.. you want to be sure that power is really about to be lost or the machine is unlikely to recover without physical intervention.. my automation server holds on the longest because its actually less likely to be corrupted if power is suddenly lost, and takes longer to re-sync after an outage.. whereas my NAS shuts down as soon as its running on battery (WOL to bring it back).. and my network equipment will try to ride it til the end.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
palmerfarmer
Posts: 11
Joined: Friday 06 February 2015 19:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: UK
Contact:

Re: Using a switch to shutdown domoticz GPIO

Post by palmerfarmer »

Thanks for the reply, I think you are correct. The repowering of the pi would be done by the arduino and monitoring on the pi itself would be a better move. Thanks for the info I will check out the link
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest