[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Making UPS smart with Pygame and Joystick input socket



1) I am sure my UPS is neither being read as a Joystick nor any other device. It is because it has only 2 connections: AC-input and AC-output. 
2) This UPS is made by "Ever" type "MP300".
3) It is connected to the computer by AC-output socket on the UPS and AC-input of the PSU in my PC. It has no data connections that "smart UPS" usually have that connect to the COM port of a computer and can be monitored by special software.
That is the point.
I would like to make use of existing gameport (that is not used by the server at this moment) and perform basic communication, like this:
Button_1 OFF , Buton_2 OFF -> state A
Button_1 ON , Buton_2 OFF -> state B
Button_1 ON , Buton_2 ON -> state C
The other actions described already before.
For this task some piece of software is needed that reads the Joystick port.
Therefore my interest in Pygame's Joystick module.
The necessary hardware upgrade to the UPS is very simple and requires just 2 additional relays an some cabling. It will electrically be equivalent to a joystick hardware that simply connect 2 pairs of wires by the button. In this application the human finger and the button switch is replaced by a relay.


SlawKo

UÅytkownik "James Paige" <Bob@xxxxxxxxxxxxxxxxxxx> napisaÅ(a): 
> Temat: Re: [pygame] Making UPS smart with Pygame and Joystick input socket
> Data: 2011-04-13 1:16
> Nadawca: "James Paige" <Bob@xxxxxxxxxxxxxxxxxxx>
> Adresat: pygame-users@xxxxxxxx; 
> 
> Are you sure your UPS device is actually being read as a Joystick? 
> Exactly what kind of UPS do you have, and how is it connected to the 
> computer?
> 
> There are probably better tools for doing what you want to do than 
> pygame.
> 
> ---
> James Paige
> 
> On Wed, Apr 13, 2011 at 12:42:18AM +0200, SlawKo.skrzynka@xxxxxxxxx wrote:
> > Hello,
> > 
> > I would like to get some information whether it would be possible to use Pygame's Joystick package to process simple signal from UPS to trigger clean shutdown of the Linux machine.
> > 
> > I would like to use 2 buttons from Joystick interface to sense 3 states from UPS:
> > A) AC power OK
> > B) no AC power - using battery
> > C) battery low - shutdown now
> > 
> > The program should run as a demon and check every 10 second if the UPS entered B state. Then would monitor every second if UPS reached C state. At this moment daemon should copy files stored in RAMdisk onto HDD and request runging programs to close and finally invoke system shutdown.
> > 
> > This architecture would improve my Linux net_router/web_proxy/home_automation/etc. server with simple solution using existing gameport, 2 relays and some cabling, upgrading it to a "smart system".  :)
> > 
> > 
> > Is it difficult to create this piece of software ?
> > 
> > 
> > Kind Regards,
> > 
> > SlawKo
> > 
> > ----------------------------------------------------------------
> > Najlepsze oferty na domy i mieszkania w Polsce!
> > Szutkaj tutaj >> http://linkint.pl/f2974
> > 
> > 
> 

---------------------------------------------
Ksiegowa radzi: Jak zaÅozyc firme w 15 minut?
http://linkint.pl/f2968