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

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

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.

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.

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 NUT2. would be to find out how it communicates 3. create a device to receive the communication

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.

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's2. /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.

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

this is just a basic idea just so i can see some thing working and learn to improve itIf 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