Author Topic: How hard would it be to integrate a UPS system into LinuxMCE  (Read 12538 times)

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #15 on: June 08, 2010, 03:18:31 am »
Thank you Thom for the help.
So far i have looked through the list of manufactures and devices and i see nothing for RocketFish so i created it and added my model for the device 1025AV.
now i have looked an the NUT website http://www.networkupstools.org/ for drivers thinking it could help me write the code, I did find the source code and downloaded it, I dont know the lang it is in but i can read it thats a start lol, i think i have fount the drivers.
i guess what I'm trying to do you would call it porting
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #16 on: June 09, 2010, 04:25:54 pm »
Well i am getting no were fast.
there is no information out there on how to create these sort of drivers its all about AV TV etc, I have fount what i think is the drivers nut uses but I don't know where to start.
I dont even know how the to get the core to know what device i want to talk to and where to find it just to send a simple battery test command or waht i think is a battery test from looking at what i think is the drivers.
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #17 on: June 09, 2010, 04:29:03 pm »
the first step, is figuring out what exactly what commands you can send to the UPS to do things... (On, Off, etc.)

The second step, is figuring out what information the UPS can send back to turn into events. (Battery Level, Overvoltage, Undervoltage, etc.)

-Thom

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #18 on: June 09, 2010, 04:47:35 pm »
I have attached one of the driver files i'm looking at for reference could you tell if i'm heading in the right direction, if i'm looking at the right thing for starts
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #19 on: June 09, 2010, 04:58:56 pm »
I would probably study and wrap NUT, making what is essentially a bridge to translate NUT messages to DCE messages.

This would be a device that could handle whatever drivers NUT supports.

It would do whatever it needed to do, to get messages from NUT, and act upon them using DCE stuff...

This is a pattern used by many parts of LinuxMCE, for example, for MythTV, they expose a telnet port that our DCE device MythTV_Player connects a socket to. The MythTV_Player has code that talks to this socket, and sends commands. It also listens on the socket, and when messages are recieved, it emits events (such as when a screen has changed.) that it reacts to.

How this is implemented is an exercise for the reader, it's open ended.

Devices can have child devices. Mostly these child devices do not have device drivers themselves, they are merely end points, where the router can send a message to. You would have a child device for each UPS, which would probably at the very least, contain device data for which driver to use, and what information the driver would need to connect. There is a method in C++ and GSD drivers called "Received Command for Child" so that the big parent device can get the command and act upon it.

This is the pattern, LinuxMCE is a messaging system.

-Thom

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #20 on: June 09, 2010, 05:06:56 pm »
OK i think that may sound more easier I know that NUT can communicate Over the network, I'm guessing that the core could receive that.
so step one would be to install NUT
2. would be to find out how it communicates
3. create a device to receive the communication

Is there any sample devices in DCE i can reference
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #21 on: June 09, 2010, 05:11:59 pm »
yes,

for GSD, look at the Panasonic IP Camera device template. It uses a single TCP port to send web requests and receive a single jpeg buffer in response to a Get Video Frame command.

for C++, there are many examples in the SVN tree:

http://svn.linuxmce.org/svn/branches/LinuxMCE-0810/src/

a good example, would be the VistaICM2 driver that Adam and I did for the VistaICM security panel.

Once you have a working driver, then the next step is to work on making it plug and play (LinuxMCE can for example fire detection scripts for RS232 devices, while USB and TCP/IP devices can be detected by vendor:model pairs or MAC addresses respectively.) If NUT has its own facility for detecting devices (not likely), then it could send Device Detected events to the system.

-Thom

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #22 on: June 10, 2010, 12:55:31 am »
In NUT you have 5 config files
1. /etc/default/nut (this is just to get nut to start, changing two no's to two yes's
2. /etc/nut/ups.conf (this is to tell not what driver to use and port)
3. /etc/nut/upsd.conf (this is to allow network connections to NUT to monitor status and issue commands)
4. /etc/nut/upsd.users (this is to setup usernames and passwords, ie admin and monitor user)
5. /etc/nut/upsmon.conf (this i guess tell Nut what to do on an event)

I you was to issue the command "upsc ups1@localhost" it would print out the complete status of the ups.
Nut will also alert you on a terminal if the status changes ie on battery or battery low, back on ac.
i'm still reading through stuff.
my big problem is it is not easy to understand webadmin in respect of creating a new device like this.
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #24 on: June 10, 2010, 02:00:02 am »
OK i get the DCE part and i think it is a great way to handle commands and events i can see how easy it can be to do almost anything.
its like you have a word in your head but you cant say it for some reason that is how i feel i see DCE i see how it works and what it can do in my head but then i look at webadmin and I can configure it, there are so many options and things to configure but no real documentation, if you was to step out of your shoes and step into another persons you would see where i am coming from.

It is excellent piece of software programming, I just need to understand it, I'm not gonna give up
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #25 on: June 10, 2010, 02:14:18 am »
this is just a basic idea just so i can see some thing working and learn to improve it
If i got Nut to output events to a text file how would i get DCE to receive it, if you do deside to explain it, try a go here click there reproach, (but only if you have the time) i will then see about putting it on the wiki as well.

and yes i can see that i am being a pain in the a*&.

I tried to setup a event in webadmin so at 2300 it would execute a command to ssh over to a PC and shut it down but it never worked, i know to you this would be an easy 30 second task but to others like me its not, yes i looked it up http://wiki.linuxmce.org/index.php/Common_Events_Examples but the screen i look is not like what it shows here and it doesn't even give directions as to hows it is done
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: How hard would it be to integrate a UPS system into LinuxMCE
« Reply #26 on: June 10, 2010, 03:19:55 am »
You can use the App Server device on the core or a media director to launch applications. There is one for each media director, and one for the core.

-Thom