News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

Extending MCE with custom protocols

Started by ekirin, August 26, 2009, 03:39:21 PM

Previous topic - Next topic

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.

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
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses [url="http://forum.linuxmce.org/index.php?topic=14026.0"]http://forum.linuxmce.org/index.php?topic=14026.0[/url]

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: [url="http://wp.me/P4KgIc-5P"]http://wp.me/P4KgIc-5P[/url]

Facebook: [url="https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465"]https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465[/url]

[url="http://www.dianemo.co.uk"]http://www.dianemo.co.uk[/url]

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

ekirin

Quote from: tschak909 on August 27, 2009, 12:06:22 PM
You will also need to contact Pluto for a license, because you intend to bundle the software with hardware for customer sales.

Uhmm, yes, thanks for pointing this out. I haven't read licence yet.


hari

depends, many parts are available as GPL..
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

zylko

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.

Ekirin, have you managed to start working on MODBUS TCP for LinuxMCE? Any beta version is available?

greetings,
Andrzej

falcorn

Hi guys,
News about modbus rtu on linuxmce?

Marie.O

If I helped you, feel free to buy me a coffee: [url="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES"]https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES[/url]

totallymaxed

Quote from: falcorn on February 26, 2015, 02:40:46 PM
Hi guys,
News about modbus rtu on linuxmce?

We've added support for modbus indirectly to Dianemo by adding a device template/driver for the Centraline HAWK Controller - http://products.centraline.com/en/ecatdata/pg_clhawk.html. The HAWK support numerous protocols such as modbus, bacnet and we can send data and get data from bus addresses on those bus's using abstracted devices in Web Admin ie we can address whatever bus is interfaced to via HAWK using the same abstracted child devices etc.

We took the route of placing the HAWK in the middle acting as a gateway because many HVAC engineers and commercial installers are comfortable using HAWKS and it allows us to build interfaces to several bus protocols in one hit. However the HAWK is not a low-cost piece of hardware so our approach may not make much sense if cost is an issue.

However there is no doubt modbus support could be added directly by creating a specific device template/driver for it in LinuxMCE but you would need a physical interface to modbus too.

All the best

Andy
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses [url="http://forum.linuxmce.org/index.php?topic=14026.0"]http://forum.linuxmce.org/index.php?topic=14026.0[/url]

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: [url="http://wp.me/P4KgIc-5P"]http://wp.me/P4KgIc-5P[/url]

Facebook: [url="https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465"]https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465[/url]

[url="http://www.dianemo.co.uk"]http://www.dianemo.co.uk[/url]