Author Topic: Extending MCE with custom protocols  (Read 7617 times)

ekirin

  • Making baby steps
  • Posts: 3
    • View Profile
Extending MCE with custom protocols
« 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.

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Extending MCE with custom protocols
« Reply #1 on: August 26, 2009, 03:56:07 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 http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Extending MCE with custom protocols
« Reply #2 on: August 26, 2009, 10:30:08 pm »
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

  • Making baby steps
  • Posts: 3
    • View Profile
Re: Extending MCE with custom protocols
« Reply #3 on: August 27, 2009, 10:15:58 am »
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

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Extending MCE with custom protocols
« Reply #4 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.

-Thom

ekirin

  • Making baby steps
  • Posts: 3
    • View Profile
Re: Extending MCE with custom protocols
« Reply #5 on: August 27, 2009, 12:30:07 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

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Extending MCE with custom protocols
« Reply #6 on: August 27, 2009, 01:34:30 pm »
depends, many parts are available as GPL..
rock your home - http://www.agocontrol.com home automation

zylko

  • Guest
Re: Extending MCE with custom protocols
« Reply #7 on: December 16, 2009, 11:06:28 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

  • Regular Poster
  • **
  • Posts: 19
    • View Profile
Re: Extending MCE with custom protocols
« Reply #8 on: February 26, 2015, 02:40:46 pm »
Hi guys,
News about modbus rtu on linuxmce?

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Extending MCE with custom protocols
« Reply #9 on: February 26, 2015, 03:18:09 pm »
Nope.

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Extending MCE with custom protocols
« Reply #10 on: March 05, 2015, 02:28:43 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 http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk