Home Assistant Add-On: X10 (CM11) to MQTT Gateway

Tags: #<Tag:0x00007fc418b62608> #<Tag:0x00007fc418b624c8>

Home Assistant Add-on: X10 to MQTT Gateway

This add-on allows for on and off control of X10 via a CM11a (serial) interface using MQTT.

I’m not sure how many of us still have X10 in our smart homes (I don’t), but I wrote this for a friend who has a handful of them still left and was stuck in a venv environment because of the need for the ‘heyu’ executable.

Note that this supports and was tested with the CM11a, which is a RS232 serial device and uses the legacy ‘heyu’ for control under the covers. You can easily connect this using a USB-to-serial cable. It may work with the CM17 “Firecracker”, but that has not been tested as I don’t own one.

It does NOT support direct USB interfaces like the CM15 or others.

If there is interest in CM15 support (which is usually handled by ‘mochad’), I would be willing to package that up as an add-on as well, although I have no way to test as I don’t have a CM15. Let me know if you’re interested and would be willing to help test.

Installation

This is currently in my own repository. Within Home Assistant, select Supervisor -> Add-On Store -> … (upper right) -> Repositories. Add the following URL:

https://github.com/mmotley999/hassos-addons

The “X10 to MQTT Gateway” add-on should appear at the bottom of the Add-On list.

Installation is just like any other Add-On and supports all the typical platforms with pre-built Docker Hub containers using the Home Assistant add-on build script: armhf, armv7, aarch64, amd64, and i386. It was tested on aarch64 (Rpi 4).

Configuration

There are a few items to configure that are outlined in the documentation, specifically the serial port that is connected to the CM11a and MQTT details like hostname, authentication, and topics for commands and status.

If using the Mosquitto add-on, you can leave the host at the default (‘core-mosquitto’). MQTT username and password is technically optional, but the Mosquitto Add-On requires authentication by default.

Operation

Add either switch or light MQTT components in Home Assistant. Only ON and OFF are supported. Sorry, no support for dimming.

Example for house code G7 using the default command and state topics:

switch:
  - platform: mqtt
    name: "X10 Switch"
    state_topic: "x10/stat/g7"
    command_topic: "x10/cmd/g7"
    payload_on: "ON"
    payload_off: "OFF"
    retain: false

The Add-On will also continually monitor for X10 commands that happen outside of Home Assistant (for example, from X10 remote control devices) and update the status of the Home Assistant entity accordingly via the MQTT state topic. NOTE: The state topic is published with the Retain flag so that the entity status is correct when Home Assistant restarts.

Support

Feel free to use this community topic for comments or suggestions, or if you found it useful in your setup!

This is my very first Add-On, and frankly my first real Python script (which is the main process that runs), so be easy on me.

1 Like

Was able to add your repository to my Supervisor Add-on Store, but no entry or entries are added to my available add-ons (neither Official nor Community).

I appreciate your efforts very much as I have been frustrated trying to add X10 capability to my HA installation. I have done the heyu installation on a Raspberry Pi running Raspian several years ago to emulate a Hue bridge to that Alexa can access my X10 devices.

Had no success integrating heyu into my Home Assistant because I guess it runs in a docker container - and four weeks into my configuration I have no desire to sttart over again.