Mains failure backup and detection
Moderators: leecollings, remb0
-
Dave21w
- Posts: 399
- Joined: Sunday 29 November 2015 21:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: UK
- Contact:
Mains failure backup and detection
Hi Guys,
This is my first post here, currently only using LWRF kit with their WiFi Link but looking to change to a Pi and USB RFXCom, this got me thinking, I'm no programmer but electronics hardware is no problem for me so i'd be happy to share my ideas, if we power the Pi via a 9-20v in 5v out dc-dc switcher (eBay) we could then use a standard 12v lead acid battery which is being float charged to power it much as a house alarm does, if possible could Domoticz inlcude a mains failure option on one of the GPIO pins, it would be easy to detect a failure and return of the mains supply with a bit of hardware and maybe a delay in the software to ensure the mains was back to stay (say wait 5 mins to confim) the reason behind this is if Domoticz monitored what was turned on when the mains failed providing the off time for that item had not passed it could then resend the on commands so that from a security point of view any lights that should be on because its past dusk would be turned back on so your house would still look occupied.
Hope this isnt too much of an ask for my first post
Cheers
Dave
This is my first post here, currently only using LWRF kit with their WiFi Link but looking to change to a Pi and USB RFXCom, this got me thinking, I'm no programmer but electronics hardware is no problem for me so i'd be happy to share my ideas, if we power the Pi via a 9-20v in 5v out dc-dc switcher (eBay) we could then use a standard 12v lead acid battery which is being float charged to power it much as a house alarm does, if possible could Domoticz inlcude a mains failure option on one of the GPIO pins, it would be easy to detect a failure and return of the mains supply with a bit of hardware and maybe a delay in the software to ensure the mains was back to stay (say wait 5 mins to confim) the reason behind this is if Domoticz monitored what was turned on when the mains failed providing the off time for that item had not passed it could then resend the on commands so that from a security point of view any lights that should be on because its past dusk would be turned back on so your house would still look occupied.
Hope this isnt too much of an ask for my first post
Cheers
Dave
-
ThinkPad
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Mains failure backup and detection
Usecase for this is quite small, if you have Z-Wave this problem isn't even existing. Z-Wave is a two-way protocol so the switches will be synchronized to the demanded status in Domoticz.
For the powerloss issue i have my server (Intel NUC) that runs Domoticz (virtual machine) behind a UPS, together with all the electronics in my metercabinet (modem, router, switch etc.)
Stupid thing however, is that my UPS doesn't have a USB-connection. So my server still has no knowledge if the mains power is present. Maybe i will switch to a UPS with a USB-connection if i see something coming by for cheap (i bought this UPS for almost nothing, battery was broken, popped in a new battery myself).
As a workaround i thought of pinging a device in my home that is not protected by the UPS, but if i have problems with my router or so, this would lead to shutting down the server
For the powerloss issue i have my server (Intel NUC) that runs Domoticz (virtual machine) behind a UPS, together with all the electronics in my metercabinet (modem, router, switch etc.)
Stupid thing however, is that my UPS doesn't have a USB-connection. So my server still has no knowledge if the mains power is present. Maybe i will switch to a UPS with a USB-connection if i see something coming by for cheap (i bought this UPS for almost nothing, battery was broken, popped in a new battery myself).
As a workaround i thought of pinging a device in my home that is not protected by the UPS, but if i have problems with my router or so, this would lead to shutting down the server
I am not active on this forum anymore.
-
nigels0
- Posts: 221
- Joined: Thursday 23 January 2014 12:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8153
- Contact:
Re: Mains failure backup and detection
@Dave,
Good idea. I use this: http://www.piups.net which basically does the whole shutdown thing. Possibly not too difficult to add the startup function you suggest as the Python shutdown code is available.
Good idea. I use this: http://www.piups.net which basically does the whole shutdown thing. Possibly not too difficult to add the startup function you suggest as the Python shutdown code is available.
-
ThinkPad
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Mains failure backup and detection
Thanks, but i'm not using a Raspberry Pi but a full blown PC (Intel NUC) with a real UPS (MGE Ellipse). Works fine, but like i said: downside is that it doesn't have any USB/Serial signaling to let my PC know that the power is gone.nigels0 wrote:@Dave,
Good idea. I use this: http://www.piups.net which basically does the whole shutdown thing. Possibly not too difficult to add the startup function you suggest as the Python shutdown code is available.
I am not active on this forum anymore.
-
ThinkPad
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Mains failure backup and detection
I was thinking about building something with an Arduino.
Arduino connected (and powered!) through USB to my server. Then a mains adapter (not plugged into the UPS, but directly on mains) that puts 5V (or so) on a digital pin of the Arduino.
If pin is high (=mains available) = Serial.print("PWR:OK")
If pin is low (=mains is gone) = Serial.print("PWR:LOSS")
Then a script that reads the serial output every minute. If it counts "PWR:LOSS" ten times (=10 minutes) then shutdown ESXi, and thus, the server. And it also needs to send a shutdown command to my Synology NAS over SSH because that one is also behind the UPS.
How does that sound? Things that need improvement?
Arduino connected (and powered!) through USB to my server. Then a mains adapter (not plugged into the UPS, but directly on mains) that puts 5V (or so) on a digital pin of the Arduino.
If pin is high (=mains available) = Serial.print("PWR:OK")
If pin is low (=mains is gone) = Serial.print("PWR:LOSS")
Then a script that reads the serial output every minute. If it counts "PWR:LOSS" ten times (=10 minutes) then shutdown ESXi, and thus, the server. And it also needs to send a shutdown command to my Synology NAS over SSH because that one is also behind the UPS.
How does that sound? Things that need improvement?
I am not active on this forum anymore.
-
jannl
- Posts: 823
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2025.5.x
- Location: Geleen
- Contact:
Re: Mains failure backup and detection
You always can check the uptime and react accordingly
-
ThinkPad
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Mains failure backup and detection
Check the uptime of what?jannl wrote:You always can check the uptime and react accordingly
I am not active on this forum anymore.
-
jannl
- Posts: 823
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2025.5.x
- Location: Geleen
- Contact:
Re: Mains failure backup and detection
Uptime of the server, uptime of domoticz.....
-
ThinkPad
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Mains failure backup and detection
That is maybe useful for the topicstarter, i have my server and NAS behind a UPS to prevent powerloss.
But like i said, my UPS doesn't have a USB-connection so i don't know if the power is gone or not.
But like i said, my UPS doesn't have a USB-connection so i don't know if the power is gone or not.
I am not active on this forum anymore.
-
jannl
- Posts: 823
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2025.5.x
- Location: Geleen
- Contact:
Re: Mains failure backup and detection
Same here.
A script checks if the UPS is online, if not the pi shuts down after 5 minutes.
NAS shuts down after 10 minutes and switches of the UPS.
Only problem is when the power gets back after about 7 or 8 minutes. Nas will not shutdown and the Pi does not reboot automatically. The never happened and if it does a lot I might figure out a way to start the Pi via WOL or so from the NAS.
A script checks if the UPS is online, if not the pi shuts down after 5 minutes.
NAS shuts down after 10 minutes and switches of the UPS.
Only problem is when the power gets back after about 7 or 8 minutes. Nas will not shutdown and the Pi does not reboot automatically. The never happened and if it does a lot I might figure out a way to start the Pi via WOL or so from the NAS.
-
Dave21w
- Posts: 399
- Joined: Sunday 29 November 2015 21:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: UK
- Contact:
Re: Mains failure backup and detection
Thanks for all your replys and suggestions, I know alot of people here use a UPS and i suppose that is the easier option but the run time on those is usually 20 to 30 mins,the main reason behind doing it the way i was suggesting was that running from a standard alarm battery (12v 7Ah with suitable switching regulator) the battery powered run time for the Pi would be about 20hrs, no need shutdowns and having to wait till you get home to restart it again and once the mains is restored and detected then domoticz could resend on commands to stuff that should be on . I am also looking at powering some of my other network related devices the same way so hopefully my network switch and virgin media (not so super) super hub will not lose power, obviously if the cabinet in the street where my internet feed comes from is on the same phase as my house then the internet is down anyway !!
Once again thanks for all your feedback
Dave
Once again thanks for all your feedback
Dave
Who is online
Users browsing this forum: No registered users and 1 guest