General > Users

Extending MCE with custom protocols

(1/3) > >>

ekirin:
Hi there,

I would like to extend MCE with couple of custom protocols to support additional hardware for home automation. One of those protocols would be Modbus TCP. I need some documentation, guide or tutuorial how to extend MCE with new protocols.

Thanks in advance.

totallymaxed:

--- Quote from: ekirin on August 26, 2009, 03:39:21 pm ---Hi there,

I would like to extend MCE with couple of custom protocols to support additional hardware for home automation. One of those protocols would be Modbus TCP. I need some documentation, guide or tutuorial how to extend MCE with new protocols.

Thanks in advance.

--- End quote ---

Search the wiki... there is plenty of information there on this. Then go to the linuxmce-devel irc channel and ask some questions ;-)

Welcome!

Andrew

colinjones:
In short you have two main options - GSD or C++

LMCE implements a protocol called DCE (Data, Commands, Events) that all software "devices" within LMCE communicate with each other through. Each core, hybrid and MD has a number of these DCE devices running on them, each responsible for a portion of the functionality (eg playing media - Xine_Player DCE device). LMCE implements a large range of DCE Commands through this protocol.. they are general commands to do stuff. When you implement a new DCE Device, you choose which commands you are going to implement based on what is appropriate for the device in question. So for Home Automation devices you will probably not implement the DCE commands for manipulating media, but you probably will implement commands that turn lights on and off.

A new HA protocol will be implemented as a new DCE device ... then LMCE doesn't need to know anything about that protocol (or any other HA protocol) it just sends its own DCE commands for manipulating lights, blinds, whatever, and your new device handles converting those commands into the specific actions required to achieve the desired result. This makes the system a "framework product" and mantains modularity. This way, any one subsystem can interact and control any other subsystem without needing to know anything about how it works.

The simplest way of implementing such a device is using the Generic Serial Device. This is effectively a "blank" DCE device that already handles all the DCE protocol stuff, and you just have to tell it through the web interface which commands you wish to implement (ie no coding required at this point), and it will present you with little text boxes for each command you list. Then you simply fill in each text box with a little snippet of Ruby code. Every time this GSD receives a DCE command from the LMCE system, if you have implemented that DCE command it will then execute the Ruby snippet that you have specified.

There are plenty of simple examples of GSDs being used that you can look at the Ruby code for. From that Ruby code you can easily send text strings out serial ports, to ethernet devices or IR transceivers. So if you already have the protocol specification for this HA hardware, and you can control it using a serial port, ethernet port or IR, then you can probably throw together a simple GSD to implement this protocol, very quickly and easily with no/almost-no programming at all!

If you have more complex requirements and GSD isn't appropriate, then you will need to create a new DCE device from the ground up in C++. There are tools to help you, such as creating a "stub" device with all the necessary methods defined based on the DCE commands you listed, so you can just insert the code necessary into those methods. (called DCEGen)

ekirin:
Thank you guys for detailed reply. Actually, I need to evaluate the whole system for implementing it as the part of building automation system for our customers. Most important part of the system is interfacing to existing building automation hardware. Existing protocols (EIB, PLCBUS...) are not enough for us. We will need Modbus TCP/serial and couple of other protocols.

So, if the system meets our needs, I'll be glad to develop and contribute couple of communication drivers.

tschak909:
You will also need to contact Pluto for a license, because you intend to bundle the software with hardware for customer sales.

-Thom

Navigation

[0] Message Index

[#] Next page

Sitemap 
Go to full version