I’m very new in Hassio and I have everything up and running on a PI4 with version 0.108.1 (HassOS 3.12).
I’m trying to setup some old X10 stuff with mochad but I’m getting some errors after reboot and can’t get them to work.
My equipment (CM15PRO) is compatible with mochad, I’ve already tested with raspbian and I it works fine.
Error while setting up mochad platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/mochad/switch.py", line 34, in setup_platform
add_entities([MochadSwitch(hass, CONTROLLER.ctrl, dev) for dev in devs])
File "/usr/src/homeassistant/homeassistant/components/mochad/switch.py", line 34, in <listcomp>
add_entities([MochadSwitch(hass, CONTROLLER.ctrl, dev) for dev in devs])
AttributeError: 'NoneType' object has no attribute 'ctrl'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/mochad/switch.py", line 34, in setup_platform
add_entities([MochadSwitch(hass, CONTROLLER.ctrl, dev) for dev in devs])
File "/usr/src/homeassistant/homeassistant/components/mochad/switch.py", line 34, in <listcomp>
add_entities([MochadSwitch(hass, CONTROLLER.ctrl, dev) for dev in devs])
File "/usr/src/homeassistant/homeassistant/components/mochad/switch.py", line 52, in __init__
self._state = self._get_device_status()
File "/usr/src/homeassistant/homeassistant/components/mochad/switch.py", line 96, in _get_device_status
status = self.switch.get_status().rstrip()
File "/usr/local/lib/python3.7/site-packages/pymochad/device.py", line 55, in get_status
return self.controller.read_data().lower()
File "/usr/local/lib/python3.7/site-packages/pymochad/controller.py", line 83, in read_data
data = self.socket.recv(4096)
ConnectionRefusedError: [Errno 111] Connection refused
With ´nc localhost 1099´ it just returns to the bash without any output so it seems that mochad isn’t running.
I’ve searched the web and some say that “Updating pymochad to 0.2.0 fixes the issue”.
Does anyone knows how I can do that?
Is the mochad daemon running? If mochad was setup correctly the daemon should auto start when the cm-15pro in plugged in to the usb.
I run some x-10 stuff but I’m using heyu with a cm-11a for powerline and a wgl w800usb for wireless. I do have a cm-15pro and tried mochad but had better results with the heyu method. I do slightly remember when I attempted the mochad route that I had to install mochad myself. I believe HA just integrates with mochad. You still have to set it up so HA has something to connect to.
I’m running HA core on ubuntu in a venv. I’m not sure how to get mochad installed on hassio, sorry.
If you are running home assistant on hassos, it probably is not running, and now way to install. You will need to run home assistant supervised ( previously known as hassio on generic Linux) on raspbian to install mochad.
That it is on the integration list does not imply it is installed on hassos. There are many ways to run home assistant, home assistant on hassos (previously know as hassio) is just one of them. Eg MQTT is on the integration list, but mosquitto is not installed on hassos. If you want to use MQTT on hassos, you have to install the mosquitto add-on.
There are 2 ways to do what you need :
1/ install the portainer add-on, and see if you can use it to install a container containing mochad
2/ take a snapshot of your current home assistant, copy it to your PC, install raspbian, install mochad, install home assistant supervised on raspbian, restore your snapshot.
Hi @francisp, thanks a lot for your help, I guess i’m almost there.
I’ve followed your advice and installed a container with mochad using portainer add-on(https://github.com/jshridha/docker-mochad) and in that container console I can not send X10 commands like: echo "pl a1 off" | nc localhost 1099
I can also send these commands in the terminal (normal ssh to port 22), specifying the container IP.
What I can’t do for now is configure in configuration.yaml. Added the configuration as mentioned on https://www.home-assistant.io/integrations/mochad/ using the IP of the container, but I still get the same error of my first post.
Do I need a different configuration?
Your second suggestion will be my plan B if I give up on this aproach.
So finally it’s working!
With the docker-mochad container running (needed to add it to the correct network and set a static ip) I can finally use mochad on hassio.
Also in the configuration I use the container IP instead of localhost.
In fact, due to some issues in the configuration.yaml I’ve had in the beginning I also tried the switch.command_line and it also works that way, useful to use the covers with the cover template.
It’s the custom of this community to mark the post containing the solution, or key information leading to the solution, with the Solution tag. In other words, it was the post made by francisp that provided the solution and should be marked accordingly. Give credit where credit is due.
What you’ve done is marked your own post as the Solution (when all it does is confirm the suggested solution works).
Sure no problem, already corrected.
I marked mine because i’m validating and providing more detailed info on how to implement one of Francis suggested solutions.
I’m having intermittent failures of Mochad Integration. I’m running Mochad outside of HASS on another machine (RPI). It has worked for the last 2 years without a problem. This has only become a problem since v108.0. After repeated restarts of HA it will function flawlessly until HA is restarted again. It looks like a timeout during initialization. Is there any way to increase the timeout parameter? The error logs I’m seeing are:
Logger: homeassistant.components.switch
Source: components/mochad/switch.py:34
Integration: Switch ([documentation](https://www.home-assistant.io/integrations/switch), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+switch%22))
First occurred: 8:26:06 PM (1 occurrences)
Last logged: 8:26:06 PM
Error while setting up mochad platform for switch
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/mochad/switch.py", line 34, in setup_platform add_entities([MochadSwitch(hass, CONTROLLER.ctrl, dev) for dev in devs]) File "/usr/src/homeassistant/homeassistant/components/mochad/switch.py", line 34, in <listcomp> add_entities([MochadSwitch(hass, CONTROLLER.ctrl, dev) for dev in devs]) AttributeError: 'NoneType' object has no attribute 'ctrl'