Page 1 of 2

(Smart) UPS support

Posted: Tuesday 21 July 2015 15:40
by jadijkstra2000
I was thinking, because in my vacation my internet modem 'crashed' I could not reset it.
Now was I thinking about using a switch i.e. Fibaro wall plug to remotely reset my modem.
How then I hear you all thinking...well my asus rt68u has the ability to have a 3g usb modem attached whenever the normal internet commection fails. When this happens it should be possible to reset the modem through the fibaro wall plug through the 3g modem.

Another option is to let a script check if internet is 'live' and when not, do a reset of the fibaro wall plug..

To come back to a UPS, power failures are not cool, however this does not happen too often, so this is a more nice to have option. But I was thinking, why not add a (Cheap) smart UPS from APC for example to intercept power failures for modem/router and even domoticz, domoticz then with additional ups because I would like to shutdown / restart the UPS through domoticz when the internet connections gets corrupted/crash etc... And not having domoticz to be shutdown through the ups...

This all makes it a little fail safe I guess

Is this a nice idea? And...can there be support for these upsses? :)

Re: (Smart) UPS support

Posted: Tuesday 21 July 2015 16:06
by ThinkPad
Powercycling the modem is something i also do, because when Ziggo performs maintenaince (luckily most of the time in the night) it often requires a reboot of the modem.
I have now automated this with a script, which can be found here: http://domoticz.com/forum/viewtopic.php?f=23&t=6819 (last post)
If you can get into your modem with telnet/SSH you could even do it without a 433Mhz / Z-Wave plug. But that depends on if it really crashes, or you don't have an internet connection (but the modem still responds on LAN).

I also have my whole IT stuff (modem, router, NAS, switch etc) behind a UPS (MGE). Bought it second hand for 10 euros, and popped in a new battery. Unfortunately i didn't pay enough attention, because it has no USB port. So i don't know if the power is gone. But most of the time it is back very quick. Maybe i will buy an other UPS (with USB) if i can get one cheap :mrgreen:
I have Domoticz running on my NAS (Synology) and the NAS has built-in support for a UPS. So i don't need support in Domoticz for a UPS. I also think this is the same for other platforms, your host OS should communicate with the UPS, not Domoticz.

Have you seen this topic: http://domoticz.com/forum/viewtopic.php ... 73&p=31672 ? It's about a script to monitor a APC UPS.

Re: (Smart) UPS support

Posted: Tuesday 21 July 2015 16:23
by jadijkstra2000
Cool! Then I will buy a ups :) i think my smartups 2200VA will be a little bit to oversized for this purpose haha.

Re: (Smart) UPS support

Posted: Tuesday 21 July 2015 16:30
by ThinkPad
Pay attention to the standby (idle) power usage of the UPS'es being sold. Some of them take quite some Watts when doing nothing (but waiting for a powersurge). A waste of your energybill and thus: your money ;)
The MGE i have does about 4W-5W when battery is fully charged and it is 'waiting' for the power to disappear.
Back in the days i had a antique 1250VA model that ate 40W when doing... nothing.... It was a nice heated footbench in the winter, but ofcourse such energy usage is crazy.... 40W for 24/7 is 80 euros a year :shock: Almost the amount a new UPS costs.

An UPS like this one uses very little energy and is compact and not too expensive: http://tweakers.net/productreview/60203 ... a-din.html (not my review).

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 5:57
by mongoose
Thinkpad, does your ups beep? or has an LED that indicates a power failure, as you could add the mysensors 'secret knock' http://www.mysensors.org/build/knock build so you know the power has failed, or an LED Light sensor :) Just some ideas :)

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 8:47
by ThinkPad
Good idea thanks. The LED's on the UPS are quite dim, so i never paid much attention to it. But it will probably have a LED that will turn on to indicate the UPS is running on battery.
But i like to have it as low-level as possible. Doing it through MySensors and Domoticz is quite prone to failures :? (too many links in the chain that could fail) But it's an idea :)

Another workaround would be pinging a device that is connected to mains and is reachable 24/7, but is not connected to the UPS. That way it would not respond when the mains voltage is absent. But also prone to failure if my router has crashed, then the NAS will shutdown :lol:

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 9:05
by Siewert308SW
Anyone who uses a rups2000 protocol UPS?
Have a spare UPS (Eminent 3890) Rups2000 UPS lying around.
Tried to hook it up to my domoticz without any luck.
Someone who has it running?

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 9:18
by Siewert308SW
p.s

hmmmm... Maybe this is a cheap sollution for us/me.
I do have spare and cheap BatteryBank from a a dutch shop called (HEMA).
It's a 2400mha so it should be able to run for 5hr if the power has been cut.
Enough time to do some tasks.

http://raspi-ups.appspot.com/en/index.jsp

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 9:20
by ThinkPad
Two things to check to see if you can use your powerbank as a UPS:
  1. First have a try if it can power a load while being charged
  2. Then try if the load keeps being powered without interruption while you remove the charger from the powerbank
I have a Xiaomi powerbank (great device btw) that can power a load while being charged, but as soon as i remove the charger from the powerbank, the output is disconnected for 1-2 seconds and then turned back on again. So not useable as a UPS (because the Pi will lose power and reboot).

There are powerbanks who can do both the above two points, but you have to test it, because most of them don't support it.

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 9:24
by Siewert308SW
ThinkPad wrote:Two things to check to see if you can use your powerbank as a UPS:
  1. First have a try if it can power a load while being charged
  2. Then try if the load keeps being powered without interruption while you remove the charger from the powerbank
I have a Xiaomi powerbank (great device btw) that can power a load while being charged, but as soon as i remove the charger from the powerbank, the output is disconnected for 1-2 seconds. So not useable as a UPS (because the Pi while lose power and reboot).

There are powerbanks who can do both the above two points, but you have to test it, because most of them don't support it.
Good one...
Going to hook it up and test ;-)

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 9:28
by ThinkPad
See also this page: http://www.enigma14.eu/wiki/5V_UPS_for_Raspberry_Pi

But if you need to buy stuff (The SLA battery, 12V UPS powersupply) i would recommend getting a normal UPS, as you can also put your NAS, modem, switch etc behind it, instead of only the Pi :mrgreen:

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 9:33
by Siewert308SW
ThinkPad wrote:See also this page: http://www.enigma14.eu/wiki/5V_UPS_for_Raspberry_Pi

But if you need to buy stuff (The SLA battery, 12V UPS powersupply) i would recommend getting a normal UPS, as you can also but your NAS, modem, switch etc behind it, instead of only the Pi :mrgreen:
thx...
The UPS is got is a RUPS2000 protocol UPS.
Been trying to hook it up for the last couple of weeks and just gave up.
Some how the protocol isn't supported.
If this powerbank does the job then i'm happy ;-)


pi@raspberrypi ~ $ upsd -i
IS_RUNNING=YES
PID=2744
LAST_UPDATED=2015-07-22 09:30:28
POWER_OUTAGE=NO
BATTERY_CHARGE_LEVEL=100
BATTERY_REMAIN_TIME=02:48:00
BATTERY_LOW=NO

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 11:13
by Siewert308SW
Seems like the little bastard does the job.
Charging till full while underload.
And when disconecting the powersupply it runs continues and the raspi stays online.
It only cost me a 7.50 euro powerbank #lol it saved my day

pi@raspberrypi ~ $ upsd -i
IS_RUNNING=YES
PID=4739
LAST_UPDATED=2015-07-22 11:10:48
POWER_OUTAGE=NO
BATTERY_CHARGE_LEVEL=100
BATTERY_REMAIN_TIME=03:06:40
BATTERY_LOW=NO

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 11:17
by ThinkPad
Nice, do you have a link to it on the HEMA webshop? Or don't they sell them anymore?

P.S. What's up with that upsd output? Has nothing to do with the powerbank because the powerbank doesn't have any communication with the Pi?

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 11:21
by Siewert308SW
ThinkPad wrote:Nice, do you have a link to it on the HEMA webshop? Or don't they sell them anymore?

P.S. What's up with that upsd output? Has nothing to do with the powerbank because the powerbank doesn't have any communication with the Pi?
the output is comming from the powerbank.
the required software does communicate and calculate the power from the powerbank

Seems they are sold out and seems they have lowerd the price

HEMA - Link (powerbank)
http://bit.ly/1HIxpF5

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 11:27
by ThinkPad
But how can the software calculate this when the Pi only receives 5V from a battery??? I don't understand :mrgreen:

Edit: Nevermind, i found this: http://raspi-ups.appspot.com/en/faq.jsp
How can the Raspberry Pi know the current charge level of the power bank?
The charge level of the power bank is determined by the power bank's capacity and the system power consumption. This works quite accurately.
Cool, didn't know that was possible!

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 11:31
by Siewert308SW
ThinkPad wrote:But how can the software calculate this when the Pi only receives 5V from a battery??? I don't understand :mrgreen:

Edit: Nevermind, i found this: http://raspi-ups.appspot.com/en/faq.jsp
How can the Raspberry Pi know the current charge level of the power bank?
The charge level of the power bank is determined by the power bank's capacity and the system power consumption. This works quite accurately.
Cool, didn't know that was possible!
Seems like Hema doesn't like direct linking ;-)

Code: Select all

http://www.hema.nl/winkel?fh_location=%2F%2Fnlhema%2Fnl_NL%2Fpnl_product_type%3E%7Bshop%7D%2F%24s%3Dpowerbank&fh_secondid=pnl_39609106
edit:
i now only have to find a way (as it seems to be supported now) to hibernate the Raspi when the ups kicks in.
As i have some modules which when powered on seeks for a signal automaticly.
So it is possble when the power gets back on those modules will recieve a second code and switch on/off while they do not supposed to do that.
Or is it possible to suspend lua scripts like in the settings panel but then with a json code

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 11:43
by Siewert308SW
pulled the network cable while it was running on the powerbank...
it switched over continuously and without interruption.

Code: Select all

Jul 22 11:39:05 raspberrypi upsd[12521]: There is a power outage right now.
Jul 22 11:39:05 raspberrypi upsd[12521]: The estimated current battery charge level is 100 %.
Jul 22 11:39:05 raspberrypi upsd[12521]: There are 03:06:40 hours remaining before the battery will be empty.
Jul 22 11:39:05 raspberrypi upsd[12521]: If the battery should actually run empty, appropiate action will be taken.
Jul 22 11:39:32 raspberrypi upsd[12521]: The power outage is over now. It could be successfully bridged over by using the battery.
Jul 22 11:39:32 raspberrypi upsd[12521]: The outage lasted for 00:00:27 hours.
Jul 22 11:39:32 raspberrypi upsd[12521]: The estimated battery charge level decreased from 100 to 99 % during the outage.
Jul 22 11:39:32 raspberrypi upsd[12521]: The system could have run for 03:06:12 more hours before the battery would have been empty.

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 12:06
by ThinkPad
Nice.

Maybe that could be a workaround for my standalone UPS: Just let my Synology watch it's networkinterface. If it is down longer than 10 minutes: turn NAS off.
But i still don't see that as a very failsafe option, because of too many external variables that can go wrong.

Re: (Smart) UPS support

Posted: Wednesday 22 July 2015 12:17
by Siewert308SW
ThinkPad wrote:Nice.

Maybe that could be a workaround for my standalone UPS: Just let my Synology watch it's networkinterface. If it is down longer than 10 minutes: turn NAS off.
But i still don't see that as a very failsafe option, because of too many external variables that can go wrong.
true, and eth0 not available doesn't mean there is a poweroutage.
But as i don't have or got a network issue for over a year i think this will fit my needs.
As for my earlier question.
I didn't look any further, i just configured the UPSD to stop domoticz service when there is a possible outage and start when the power is back on.
So domoticz can't when it sent out sign new codes to some modules i own which seek for codes when the get power...