MicWit
Posts: 91
Joined: Fri Nov 01, 2013 5:20 am

Native Power Management programming

Tue Feb 04, 2014 5:55 am

I was wanting to hook my raspberry pi up to my UPS via the USB cable, however, NUTS seems to not work. It is a power shield SafeGuard750, so I contacted the Australian head office, and they informed me that it is designed to function with anything that can support native battery power management. Is there anyone that could help me with some code (python if possible) to access the details needed from the USB interface? I would like to write some of my own software that would hook up to my online PHP servers.

MicWit
Posts: 91
Joined: Fri Nov 01, 2013 5:20 am

Re: Native Power Management programming

Sat Feb 08, 2014 2:21 am

So nobody knows how to interface with a ups??????

User avatar
duberry
Posts: 379
Joined: Mon Jan 28, 2013 10:44 pm
Location: standing on a planet that's evolving. And revolving at nine hundred miles an hour

Re: Native Power Management programming

Sat Feb 08, 2014 7:26 am

MicWit wrote:So nobody knows how to interface with a ups??????
A quick search of the string/phrase 'native battery power management' turns up mostly results with in them"windows"
Trying the same again with the string 'native battery power management -windows' (with out windows) shows no results with 'native battery power management' string .

This leads me to believe that 'native battery power management' is something MS created/made up .
Unless you can glean more solid info about this NBPM thing .
Then you are up feces creek with out a paddle so to speak .
lend me your arms, fast as thunderbolts, for a pillow on my journey.
If the environment was a bank, would it be too big to fail
so long; and thanks for all the pi

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27061
Joined: Sat Jul 30, 2011 7:41 pm

Re: Native Power Management programming

Sat Feb 08, 2014 9:51 am

MicWit wrote:So nobody knows how to interface with a ups??????
More likely no-one knows how to interface with the specific UPS you quoted. Have you Google'd for that model and Linux?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
DougieLawson
Posts: 39837
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Native Power Management programming

Sat Feb 08, 2014 1:03 pm

MicWit wrote:So nobody knows how to interface with a ups??????
How does it connect to your RPi? USB, rs232, bluetooth or something else?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

MicWit
Posts: 91
Joined: Fri Nov 01, 2013 5:20 am

Re: Native Power Management programming

Sat Feb 08, 2014 11:32 pm

It connects to the pi via usb. I can not find anything on google to do with the pi and this brand ups. However, I have been in talks with the company and they advised me that it has a native power management output. From what I understand, this means that it basically outputs raw data that can be read by anything (no drivers needed), then I just need to read that information in the program I make. In Ubuntu I believe it just turns up in a file, see http://stackoverflow.com/questions/1669 ... -in-ubuntu and http://mantoshkumar1.blogspot.in/2012/1 ... linux.html
The pi should support something basic like this I would think! For some reason bat0 doesn't show up though.

User avatar
DougieLawson
Posts: 39837
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Native Power Management programming

Sun Feb 09, 2014 4:47 pm

So if it connects with USB how does it appear? Is it a serial device or a HID (keyboard/mouse/rowing machine/etc.) or something proprietary that needs a driver?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Native Power Management programming

Sun Feb 09, 2014 9:42 pm

MicWit wrote:... In Ubuntu I believe it just turns up in a file, see http://stackoverflow.com/questions/1669 ... -in-ubuntu and http://mantoshkumar1.blogspot.in/2012/1 ... linux.html
I believe those threads are talking about the built-in batteries in laptops.
For some reason bat0 doesn't show up though.
That's because the Pi doesn't have a battery.
I think Window's native battery power management expects the UPS to present itself as a HID. Did you try nut with the usbhid-ups driver?

--
Ragnar

MicWit
Posts: 91
Joined: Fri Nov 01, 2013 5:20 am

Re: Native Power Management programming

Thu Feb 13, 2014 3:44 am

From what they guy at Power Shield said, if it has support for Native Power Management, it should be similar to a keyboard. It will show up and receive basic data as a generic UPS, just may not have certain functions without the driver installed. I just want to know when the mains goes down pretty much. And keep an eye on the battery level.

I know those threads are for laptops, but I think the batteries in laptops can run on the same standards as a UPS, so may even show up the same as a laptop battery (though I suspect it may show somewhere else).

I did not try nut with the usbhid-ups driver. Where would I get this? I will give it a go and see if I can see it then.

MicWit
Posts: 91
Joined: Fri Nov 01, 2013 5:20 am

Re: Native Power Management programming

Fri Feb 14, 2014 2:00 am

OK, tried nut with the usbhid-ups driver in this tutorial: http://abakalidis.blogspot.com.au/2013/ ... -with.html but get to the part "root@raspbx:~# upsdrvctl start" and it says "command not found". I got an email back from Power Shield that said I needed to add this to the conf file:
[ourups]
driver = blazer_usb
port=auto
subdriver = cypress
vendorid = 0665
productid = 5161

So I did, but still the same issue. Does anyone know of a better tutorial for setting up nut on the pi???

MicWit
Posts: 91
Joined: Fri Nov 01, 2013 5:20 am

Re: Native Power Management programming

Fri Feb 14, 2014 11:11 am

Seems nut servervis running fine now, the monitor seems to crash every time I open it since I rebooted. Now the main thing I need to do is send myself an email when the mains goes out. Any ideas? Im thinking I may even create a python program to receive the data from nut and use sockets to link it to my php server. If I can get the details in python I can do it. Any details on how to do this?

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Native Power Management programming

Fri Feb 14, 2014 1:38 pm

There are some tips in the NUT documentation.
http://www.networkupstools.org/docs/use ... 01s07.html

--
Ragnar

Return to “Interfacing (DSI, CSI, I2C, etc.)”