Adding X10 support

It run in console "x10cmd st | /bin/sed -n ‘s/.1=([0-1])./`/p’ " and do “x10cmd rf e1 on” in other console but still doesn’t show anything
I write this script below, but it shows “Switch On” in console, however when I integrate in HA never trigger. Any idea why?

Detect Remote Control HouseUnit E1

  • name: Status Utility
    platform: command_line
    command: x10cmd15 st | grep “House E” | grep “1=1” > nul && (echo “Switch On”) || (echo “Switch Off”)
    device_class: connectivity
    payload_on: “Switch On”
    payload_off: “Switch Off”

Sorry. I missed this. Could you post the output from your X10 controller after sending it a status command? Trigger the device first so it shows up in the output as on.

Hi folks, just started playing around with HA and since I have a lot of old X10 components lying around I decided to test if I could get them up and running with HA. I installed a fresh Rasbian light image on my PI2, then Home Assistant All In One. I then installed heyu and added one lamp module for testing. In the interface it shows up - I am able to switch on the component but after a second or two the button goes back to “OFF” state. It does not seem that the HA interface remembers the state of the component - is this a known issue?

I also wonder if dimming is possible through HA/heyu setup - any tips here would be appreciated.

Thanks!

Brgds
Christian

Have you got these in a group with a switch?

I’ve found HA doesn’t quite work well like that…

E.g. if the group is turned off, and you turn a member of the group on, it’ll flick on, turning the Lamp, or whatever on, and then flick off, leaving the lamp on.

I just removed the switch element of the group, I forget the option, it was hard to Google, so if this is your problem, and you want me to go check my config, do ask.

Steve

Hi Steve & thanks for the reply.

No I do not have the switch in a group, so I do not think this is a problem. I also have some Hue bulbs integrated and these work just fine. I suspect this is related to the X10 HA integration.

Brgds
Christian

If you look at https://github.com/home-assistant/home-assistant/blob/a4f1f6e724d61a6da51cce17729418e0dd12890c/homeassistant/components/light/x10.py#L38 you can see that HA uses “heyu onstate” to get the current state of the light. This might be failing for you? Try running it manually as the HA user on your HA system and see what results you get. Don’t forget to put in the correct house/unit code, e.g. A1.

This is also the file we’d need to enhance to get dimming working.

Hi an thx for the tip.

I will try to check logs (I assume they are somehwere) then to see if there is any more information available - I am new to both HA so I have a steep learning curve ahead of me :smiley:

I have been able to switch the lamp module successfully on and off calling the service manually: light - turn_on/turn_off/toggle.

Brgds
Christian

Here is the log - to me this means nothing, maybe someone see what the issue could be?

2017-05-18 18:14:41 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.hello_world fails
Traceback (most recent call last):
_ File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 225, in async_update_ha_state_
_ None, self.update)_
_ File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter_
_ yield self # This tells Task to wait for completion._
_ File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in wakeup
_ value = future.result()_
_ File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result_
_ raise self.exception
_ File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run_
_ result = self.fn(*self.args, **self.kwargs)_
_ File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/x10.py”, line 96, in update_
_ self.state = bool(get_unit_status(self.id))
_ File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/x10.py”, line 38, in get_unit_status

_ output = check_output('heyu onstate ’ + code, shell=True)_
_ File “/usr/lib/python3.4/subprocess.py”, line 620, in check_output_
_ raise CalledProcessError(retcode, process.args, output=output)_
subprocess.CalledProcessError: Command ‘heyu onstate a1’ returned non-zero exit status 1

Figured it out!! The Heyu state engine was not initiated. By typing command line ‘heyu engine’ everything works perfectly :slight_smile:

1 Like

This is very late…
But the switch bounce-back in the web interface of HA happens when “heyu engine” either hasn’t been started or is broken some how.
You can check it’s working by running as the user that HA is running as:
heyu onstate A1
(A1 being a valid house code)
If it’s not running it’ll tell you, run it using:
heyu engine
I’m using a systemd script I found/modified to automate this.

Has anyone tried this integration with Hass.io? I just started working on Hass.io and I’m struggling how to get HeyU installed to run my CM11A.

I gave up on X10. Although initially I thought it would be great with the older wiring of my home (used X10 years ago in a different house), I quickly ran into power line bridge issues and then had difficulties integrating into HASS. I moved everything to Zwave (usb controller) and Zigbee (via wink) and have had great success.

On the flipside, I have a box of X10 if anyone wants to make an offer and expand their use of it.

When I use HeyU, I get this error

2017-09-04 15:17:21 ERROR (Thread-6) [homeassistant.components.light.x10] b’Unable to find Heyu configuration file.\n’

And I believe it’s related to what you posted above. How do I edit the file above so it’s working in the right directory? HeyU works when I control it directly from the pi, but the lights don’t show up in Hassbian interface.

Check what user you’ve got HASS running as, then sudo to that user and attempt to run heyu. This should ensure it’s not a permissions problem.

HeyU operates from the

pi@homeassistant

example pi@homeassistant: heyu on O4

I know for homeassistant I’m launching from sudo systemctl start homeassistant so I believe they don’t operate in the same environment. How I get that to happen?

You need to find out what user homeassistant is running as.

Post the output of:
ps aux | grep home
And:
ls -alh /home
And:
ps aux | grep heyu

The solution ended up being when you install Heyu, there’s 4 options on where to put the config file. One limits HeyU specifically to the pi user, but option 3 lets all users view the config file. Once I did that, the whole thing started working.

Heyu is working. - modules are turning on / off as expected – however I am getting lots of the following errors in the error log. I have several of the older modules that may not be responding back …
<
2017-11-19 21:02:36 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.front_lights fails
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 199, in async_update_ha_state
yield from self.async_device_update()
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 306, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/components/light/x10.py”, line 96, in update
self._state = bool(get_unit_status(self._id))
File “/srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages/homeassistant/components/light/x10.py”, line 38, in get_unit_status
output = check_output('heyu onstate ’ + code, shell=True)
File “/usr/lib/python3.5/subprocess.py”, line 316, in check_output
**kwargs).stdout
File “/usr/lib/python3.5/subprocess.py”, line 398, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘heyu onstate H1’ returned non-zero exit status 1
/>

Do you have Heyu running in/under HASS.IO or with Hassbian?

Bumping.

I have 50+ X10 devices. Light switches, Wall Plugs, Motion sensors, Remotes, Appliance Modules, and Lamp Modules. I am running Hassio, and would like to incorporate X10 into it.
Is there anyone that has X10 working with their Hassio???