X10 CM11A Plugin 2014

I’m adding a new plugin to handle X10 devices and the CM11A power line interface. This is based on the work by yocesar in this thread:
[url=http://forum.micasaverde.com/index.php/topic,10817.0.html]http://forum.micasaverde.com/index.php/topic,10817.0.html[/url]

As I pointed out in another thread, when I started with Vera, I was disappointed in the X10 support provided by the Insteon PLM. I found yocesar’s thread and started using his CM11 plugin. This worked fairly well, but I noticed a few things I wanted to correct.

  1. There was only support for dimming using standard X10 dimming. No support for extended dimming or preset dim switches.
  2. The plugin didn’t really look too much at responses from the CM11 when sending commands. It would mainly just send a command, sleep for awhile, then send the next command, whereas there should be a two way communication involving checksums, etc.
  3. If I wanted to add a new device, I had to hard code all the details of that device into the plugin. That seemed wrong in that the CM11 should just be an interface to the powerline and shouldn’t have to worry about what devices are talking to it.

So, I’ve rewritten the plugin with a different architecture. The CM11 part is just a PLI and sends X10 commands and sends status to devices when it receives it. It becomes more just like a dumb terminal. The devices are all separate and all the logic to handle that device is contained in those device files. They all talk to the CM11 through the same UPNP calls.

This new architecture will make it easy for people to develop plugins for other X10 PLI units such as the CM17, CM19, etc. and as long as they implement the same UPNP interface, then the device files do not need to change in any way.

I’ve created devices for standard on/off devices (appliance modules, on/off light switches, etc.), Standard X10 dimmers, Extended code dimmers (Some Leviton switches, etc.), Preset Dim dimmers (SmartLinc), and security sensors (really just on/off devices, but they implement the sensor UPNP interface).

I code in many other languages, but this was my first experience with Lua. Thanks to yocesar who said he wasn’t very proficient at coding, but his code gave me a good head start in my learning process.

I’ve uploaded all the files as an attached zip as there are many. I will outline the files below so you can determine which ones you need for your setup. You only need to upload the required files and the ones for devices you want to control.

Required Files:
D_X10CM11a.xml
I_X10CM11a.xml
S_X10PLInterface1.xml
S_X10Device1.xml

Device Files (as needed):

Binary Switches
D_X10BinarySwitch1.xml
I_X10BinarySwitch1.xml
S_X10BinarySwich1.xml

Standard X10 Dimmers
D_X10DimmableLight1.xml
I_X10DimmableLight1.xml
S_X10DimmableLight1.xml

Extended Code Dimmers
D_X10ExtDimmableLight1.xml
I_X10ExtDimmableLight1.xml
S_X10ExtDimmableLight1.xml

Preset Dim Dimmers
D_X10SmartLincLight1.xml
I_X10SmartLincLight1.xml
S_X10SmartLincLight1.xml

Security Sensors
D_X10SecuritySensor1.xml
I_X10SecuritySensor1.xml

Installation instructions:
These instructions are based on UI5. I have no access to UI4, or UI6, so I cannot speak to installing there.

  1. Upload the files above as needed via Apps->Develop Apps->Luup Files. If you don’t have SmartLinc/Preset Dim switches, then don’t bother to upload those files. Same with the other non-required files. No need to take up the extra memory if you don’t need them.

  2. Go to Apps->Develop Apps->Create Device.
    In the “Description” field, type whatever you want to call the CM11 PLI. Something like “X10 CM11A PLI” or whatever you like.
    In the “UPNP Device Filename” field, type D_X10CM11a.xml.
    In the “UPNP Implementation Filename” field, type I_X10CM11a.xml
    Put in a room if you like (not required)
    Press the “Create Device” button. You should get a message about the device being created. Make a note of the device number is specifies. You will need this later. You can always find this in the dashboard by going to the settings->advanced tab for that device and look at the “id” field.

  3. Plug your CM11 a into vera via a USB to serial adapter and reboot Vera. If you need help getting Vera to recognize your USB to serial adapter, see this thread:
    [url=http://forum.micasaverde.com/index.php/topic,1471.0.html]http://forum.micasaverde.com/index.php/topic,1471.0.html[/url]

When you see your USB to serial device in the configuration screen, set the following parameters:
Baud Rate: 4800
Parity: None
Data Bits: 8
Stop Bits: 1
In the “Used By Device” dropdown, find the X10 PLI device you created in step 2 and select that.

  1. You are now ready to create devices for the CM11 to interact with. The best way to describe this is probably with an example scenario.

Lets say you have an appliance module at C5 controlling a light in the family room. Use these steps to create the device for that module.
Go to Apps->Develop Apps->Create Device.
In the “Internal Id” field, type the X10 house code, unit code. In this case “C5”
In the “Description” field, type “Family Room Light” (or whatever you like).
In the “UPNP Device Filename”, type D_X10BinarySwitch1.xml. (Use the appropriate file for the type of device)
In the “UPNP Implementation Filename” field, type I_X10BinarySwitch1.xml (Same as above, use the appropriate file)
Select the room if you like.
Press the “Create Device” button.

Vera will reload luup. You will see in the dashboard your new device complains about an error. This is because you need to input the device number of your CM11A. You may need to do a couple more reloads until when you go to the settings->advanced for the new device you see the “ControllerDeviceNum” field. Fill out the device number of the CM11A that you wrote down in step 2. After you close the setting box, press the red “Save” button at the top of the screen. Vera will reload and your device should now be active without errors.

Repeat this for your other X10 devices as needed.

All the devices you create should show up in remote control apps as they use the same category/sub-category as standard devices.

That’s all I can think of to say right now. Give it a try if you have a CM11 and X10 devices you want to control.

Enjoy,
Bruce

Couple concerns. Not all remote apps rely on the device category / sub-category now. Most rely on the device type or service type of the device. So this will be an issue with remote apps. Also what is your reasoning for creating new devices that mimic the binary, dimmer, security sensors devices? Would it not have been easier to use the standard ones already provided which is the recommended way?

  • Garrett

[quote=“garrettwp, post:2, topic:179911”]Couple concerns. Not all remote apps rely on the device category / sub-category now. Most rely on the device type or service type of the device. So this will be an issue with remote apps. Also what is your reasoning for creating new devices that mimic the binary, dimmer, security sensors devices? Would it not have been easier to use the standard ones already provided which is the recommended way?

  • Garrett[/quote]

Hi Garrett,

Thanks for your comments. When you say the device type/service type, what exactly do you mean? These devices implement the same service types as the normal switches, etc. So are you saying that if it is using a different device UPNP file (such as D_X10BinarySwitch1.xml) then the remote app may not recognize it?

As far as not using the standard files, I was thinking due to my custom implementation and additional service files needed, I would need to have separate device files. If I could specify a standard device file but with my custom implementation and it wouldn’t affect other devices, then I could do that as well. That could save some memory space. But since the S_* files are specified in the device file, I’m not sure how I could implement those without the custom device file.

So far, Vera Mobile, AutHomation HD (whoever’s program that is ;D ), HomeBuddy, and Imperihome see these devices with no problems.

Keep the feedback coming. Whatever I can do to improve and make this better will be helpful.

Bruce

Bruce,

Here is the issue. Since you are using the same device type for example as urn:schemas-upnp-org:device:BinaryLight:1, but defining a different file D_X10BinarySwitch.xml. This will clash with D_BinaryLight1.xml. Vera will load and use the first file in which defines that device type. So it may pick D_BinaryLight1.xml or it may pick D_X10BinarySwitch.xml and you will see some very weird results. You can define to use D_BinaryLight1.xml and use your custom I_xxx.xml file for that device and that should not be an issue.

  • Garrett

[quote=“garrettwp, post:4, topic:179911”]Bruce,

Here is the issue. Since you are using the same device type for example as urn:schemas-upnp-org:device:BinaryLight:1, but defining a different file D_X10BinarySwitch.xml. This will clash with D_BinaryLight1.xml. Vera will load and use the first file in which defines that device type. So it may pick D_BinaryLight1.xml or it may pick D_X10BinarySwitch.xml and you will see some very weird results. You can define to use D_BinaryLight1.xml and use your custom I_xxx.xml file for that device and that should not be an issue.

  • Garrett[/quote]

Hi Garrett,

Ok, I can understand about the device files. But what about the custom service files I need? For example, the X10 devices all need to use the S_X10Device1.xml and most have their own S_*.xml file for state variables, etc. So how can I make sure those service files are implemented if I’m using the standard device files? Is there a way programatically to let Vera know about my custom actions. I think state variables that are local to a device can just be added in the init function without needing the service file, but I’m not sure if actions can be implemented that way.

Bruce

I wonder if anyone can help me out. I have a veralite.

My USB-Serial is being recognized but I’m afraid I’m stuck on step #3.

I can’t see the USB-Serial device in the UI?

usb 2-1: new full speed USB device using rt3883-ohci and address 3
pl2303 2-1:1.0: pl2303 converter detected
usb 2-1: pl2303 converter now attached to ttyUSB0

Under DEVICES I see: _Appliance Modules _Dimmable Light and X10 PLI Interface. That’s it.

Any help appreciated

[quote=“kidjake28, post:6, topic:179911”]I wonder if anyone can help me out. I have a veralite.

My USB-Serial is being recognized but I’m afraid I’m stuck on step #3.

I can’t see the USB-Serial device in the UI?

usb 2-1: new full speed USB device using rt3883-ohci and address 3
pl2303 2-1:1.0: pl2303 converter detected
usb 2-1: pl2303 converter now attached to ttyUSB0

Under DEVICES I see: _Appliance Modules _Dimmable Light and X10 PLI Interface. That’s it.

Any help appreciated[/quote]

Sorry for the late reply. I thought I would be notified of replies to this thread.

Where step 3 is talking about is under Apps->Develop Apps->Serial Port Configuration. You won’t see the USB to Serial converter under devices.

Bruce

Hi,

I have a Vera Lite running UI5 and my brother has a Vera Lite running UI6.
On UI5 everything is working okay after following the instructions in the first post, including the devices showing up in HomeWave.

On UI6 it is working for the most part. I can control my X10 devices from the GUI, but the devices are not showing up in HomeWave!
Needless to say this is a pitty!

So it seems Garrett was right :slight_smile:

Could this have something to do with the clashing device descriptions. Because I don’t fully understand that post…
Is there a solution? Should I use the default BinarySwitch1.xml in stead of X10BinarySwitch.xml.
I could just try but I’m also trying to understand.

Thanks!

Jean

[quote=“jmidwat, post:8, topic:179911”]Hi,

I have a Vera Lite running UI5 and my brother has a Vera Lite running UI6.
On UI5 everything is working okay after following the instructions in the first post, including the devices showing up in HomeWave.

On UI6 it is working for the most part. I can control my X10 devices from the GUI, but the devices are not showing up in HomeWave!
Needless to say this is a pitty!

So it seems Garrett was right :slight_smile:

Could this have something to do with the clashing device descriptions. Because I don’t fully understand that post…
Is there a solution? Should I use the default BinarySwitch1.xml in stead of X10BinarySwitch.xml.
I could just try but I’m also trying to understand.

Thanks!

Jean[/quote]

Hi Jean,

Well, I don’t run UI6, so I can’t say for sure what the problem is. As far as the clashing device files, I have been running this for quite some time now both locally and through remote apps (vera mobile, authomationhd, imperihome) and haven’t seemed to have any issues. I would like to resolve that if there is an issue, but I never got an answer on how to implement my custom services if I don’t use my custom device files.

So, to restate the question to the others here, if I’m implementing custom services which require me to load my custom S_.xml files, then how can I do that if I don’t have a custom device file to specify those files in? Is there another way to specify those S_.xml files without using the D_*.xml file?

Bruce

And what about CM15? I’ve not investigated it in detail yet, but will it work as a CM11 with USB Serial, or is it completely different?..

Got it running with my old CM11A… It’s slow, but it does work… Still trying to find out more details about the Vera and the plugin, but so far so good…

Now I need to figure out how/if it supports X10 events, and how the security devices part works… :wink:

Take a look at an updated CM11 controller for X10 at this thread.

http://forum.micasaverde.com/index.php/topic,32747.0.html