X10 automation?

Hello,

I have a old but reliable home X10 automation setup, I have just added a pi2 and successfully downloaded and installed HA and is up and running

My Pi has a usb to serial adaptor attached to a X10 CM11 interface and hardware info shows its successfully detected as “/dev/ttyUSB0”

I was going to setup using the following links…

https://sigmdel.ca/michel/ha/x10/domoticz_install_04_en.html#heyu

and

But I dont have SSH access, so I tried installing the “SSH & Web Terminal” addon but everytime I start it, it just stops with the following message “502: Bad Gateway”

Any ideas how to resolve please, is there an easier way of setting up my X10 devices?

Thanks

Harry

I’m using x10 with mochad (https://sourceforge.net/projects/mochad/files/) which interfaces with the X10 CM11. Mochad takes all CM11 info and routes it to MQTT (which also has to be installed). Then communication uses Home Assistant MQTT integration. There should be some threads here that go into the detail.

I assume you installed Home Assistant OS. This is the installation method that comes with its own operating system. This operating system, frequently abbreviated to HassOS, is equipped with just enough functionality to support the Home Assistant infrastructure … and no more.

It’s based on buildroot. That means you might encounter challenges when attempting to install HeyU which is pre-compiled for just a few popular Linux distros. For everything else, you have to compile it from source code and I very much doubt HassOS includes a C compiler.

In addition, the SSH & Web Terminal Add-On allows SSH access to a docker container, where you can execute commands related to Home Assistant, but it not the same as direct SSH access to HassOS. To access a command prompt for HassOS, there’s a specific way to do that documented here: SSH access to the host.

There’s a topic in this forum where a user created a HeyU Add-On. That might be the best way to use HeyU with Home Assistant OS.

1 Like

Installed HA in a Python virtual environment a while back. On the same Pi I installed Heyu and ran it as a service daemon. Once that was working I just added this platform https://www.home-assistant.io/integrations/x10/ and with a bit of basic configuration everything was working fine.

Why does Mochad’s description overlook to mention support for the CM11? It states this:

mochad is a Linux TCP gateway daemon for the X10 CM15A RF (radio frequency) and
PL (power line) controller and the CM19A RF controller

Hi , thanks for the info

As a result I’m going to reinstall following these instructions … https://www.home-assistant.io/docs/installation/raspberry-pi/

Just one question really, as it is a dedicated Pi just for homeasisstant I didnt want to use a “virtual enviroment” (keep it as simple as possible) , any ideas how to amend the instructions without installing in a virtual enviroment please?

Thanks

I’ve only installed it in a virtual environment (venv). I imagine if you didn’t want to use a venv you would only need to skip the steps that involve creating the venv. However, I can’t be sure because I’ve never tried it.

I’m using the CM15A … sorry.

OK, I thought I had missed some important detail somewhere because the last time I looked at mochad I found no evidence of support for the CM11A (and that continues to be true).

1 Like

Tried installing by ignoring the virtual enviroment steps, got loads of PATH errors during startup, successfully installed up and running under virtual enviroment now :slight_smile:

I followed heyu installation , and its successfuly working now under teminal (eg… heyu off A1)

I then added the x10 entries to yaml file and restarted HA, and can see the light controls now, but when I toggle the x10 device I get the following error come up…

“Command ‘[‘heyu’, ‘fon’, ‘a4’]’ returned non-zero exit status 1.”

Any ideas please?

PS detailed log error…
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py”, line 130, in handle_call_service
connection.context(msg),
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py”, line 1260, in async_call
task.result()
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py”, line 1295, in _execute_service
await handler.func(service_call)
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py”, line 209, in handle_service
self._platforms.values(), func, call, required_features
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 454, in entity_service_call
future.result() # pop exception if have
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py”, line 595, in async_request_call
await coro
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 485, in _handle_entity_call
await result
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/light/init.py”, line 242, in async_handle_light_on_service
await light.async_turn_on(**params)
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py”, line 621, in async_turn_on
await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
File “/usr/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/x10/light.py”, line 89, in turn_on
x10_command(f"fon {self._id}")
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/x10/light.py”, line 32, in x10_command
return check_output([“heyu”] + command.split(" "), stderr=STDOUT)
File “/usr/lib/python3.7/subprocess.py”, line 395, in check_output
**kwargs).stdout
File “/usr/lib/python3.7/subprocess.py”, line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘[‘heyu’, ‘fon’, ‘a4’]’ returned non-zero exit status 1

Sorry, I don’t use the HeyU integration so someone else will have to provide you with assistance. I plan to use it so I’ll be monitoring this topic to see what explanations and suggestions are offered.

further update… I took a different tack…

  1. installed armbian on Pi … https://www.armbian.com/

  2. used the built in armbian installer to install hassio, it did everything and hassio is up and running (within a docker container)

  3. I then connected my cm11a to usb port via a usb/serial adaptor, ssh’d in and setup heyu and confirmed I could control my X10 devices from the terminal prompt using these excellent instructions… https://sigmdel.ca/michel/ha/x10/domoticz_install_04_en.html#heyu

  4. I then edited my configuration.yaml file so that it looked like this…


Configure a default setup of Home Assistant (frontend, api, etc)

default_config:

Text to speech

tts:

  • platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

light:

  • platform: x10
    devices:
    • id: a3
      name: Bedroom Desk Lamp
    • id: a4
      name: Bedside Lamps
    • id: a5
      name: Lamp by TV
    • id: a6
      name: Lounge Lamps
    • id: a7
      name: Fish Tank Lamp
    • id: a8
      name: Garden Floodlight
    • id: a9
      name: Verandha Light
    • id: a11
      name: Kitchen Lamp
    • id: a12
      name: Porch Light

Problem is after restarting hassio can’t see any x10 devices in my default dashboard… wondering what I am missing?

Thanks

It’s no longer named hass.io. Several months ago it was renamed to Home Assistant OS.

Which ssh? The one supplied as an Add-on or this one described in the Developer Docs (via port 22222)? Or did you connect to the console of the homeassistant container?
Please excuse my poor reading skills. I see your installation method is Home Assistant Supervised which means you used ssh to connect to the underlying armbian operating system (where you had installed Heyu).

The problem might be due to:

  • Heyu executes within armbian OS.
  • Home Assistant executes within a docker container.
  • The X10/Heyu integration assumes Home Assistant and Heyu execute in the same environment.

I looked at the integration’s source code and the relevant line is here:

All it does is issue a shell command like heyu on a3. It’s my understanding that the integration assumes the heyu program is accessible to Home Assistant within its docker container (but that’s not where heyu is installed).

thanks for this detailed analysis, very helpful, any idea how I go about getting ssh access to the container the armbian software wizard installed the docker/HA into?

Also would this be the reason that when I updated my configuratiom.yaml file with the x10 devices that they dont appear on my dashboard, I’d assumed they would independent of the heyu problem?

PS just noticed following in my logs…


2020-09-13 10:06:20 ERROR (MainThread) [homeassistant.components.light] Error while setting up x10 platform for light
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 184, in _async_setup_platform
await asyncio.shield(task)
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/x10/light.py”, line 45, in setup_platform
x10_command(“info”)
File “/usr/src/homeassistant/homeassistant/components/x10/light.py”, line 32, in x10_command
return check_output([“heyu”] + command.split(" "), stderr=STDOUT)
File “/usr/local/lib/python3.8/subprocess.py”, line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “/usr/local/lib/python3.8/subprocess.py”, line 489, in run
with Popen(*popenargs, **kwargs) as process:
File “/usr/local/lib/python3.8/subprocess.py”, line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “/usr/local/lib/python3.8/subprocess.py”, line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ‘heyu’


It won’t help because the heyu installation script uses the make command and (as far as I know) it doesn’t exist in the homeassistant container.

I suspect the X10 integration was designed to work with a version of Home Assistant that is not a docker container (i.e. Home Assistant Core installed in a python virtual environment).

oh ok, I’ll think I’ll reinstall armbian but this time install via…

curl -sL https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh | bash -s

thanks

How do you foresee re-installation will help?

i assume above script wont be in a docker container so after installation restore my HA config from backup, and then install heyu again via ssh… hopefully then HA will see my heyu…

???

That script installs Home Assistant Supervised which is what you are currently using. Home Assistant Supervised runs Home Assistant in a docker container.

The only installation method that doesn’t run Home Assistant in a docker container is Home Assistant Core.

I actually installed it via armbian’s own “softy wizard” which installed it automatically for me (including auto docker setup)…

https://docs.armbian.com/User-Guide_Armbian-Config/