Hassio with mochad Installation

Hi I am new to Hass.io running on RPi3 and the latest HA 0.77 and I am trying to setup mochad using CM19 USB adapter that is connected to the RPi. I added the mochad interface and added a couple of switches to the configuration file. Here is the snippet below

# X10 Controller
mochad:
  host: 127.0.0.1
  port: 1099

X10 switches

switch:

platform: mochad
devices:
    address: a1
    name: light
    comm_type: rf
    address: a2
    name: fan
    comm_type: rf

Where I run this configuration in Hass.io, I don’t the LED on CM19 flashing when I send the commands. For debugging I created a Hassbian version and installed the mochad manually and then ran the same configuration and it ran fine, I was able to control the devices.

I prefer the to use hass.io so I was wondering, what do I need to do to get mochad working on Hass,io.

Do I need to install mochad and if so how>

Thanks

Johnny

Your indentation is incorrect. The first 3 lines should be

mochad:
  host: 127.0.0.1
  port: 1099

The indentation is correct in the configuration file but I messed when I pasted it in the post. The issue is not the configuration file, because when I run Hassbian with the same configuration file it works fine.

Did you get mochad working on hassio.

For me it is not working it looks like the mochad deamon is missing. I did setup another PI with raspbian home assistant setup and installed the mochad deamon.

From the hassio PI I did then point to this new setup. Now I can create X10 lights and control them in Hassio.

Inshort the setup looks like :
172.16.0.1 PI with hassio
in configuration.yaml
mochad:
host: 172.16.0.2
port: 1099

17.16.0.2 Pi with raspbian home assistant and Mochad deamon.

This is not the setup I would like to have, however I don’t know how to get mochad running on the hassio PI.

I could not get mochad running with hassio, I ended running everything on Raspbian with docker container for each component so I have a docker container for HomeAssistant, one for mochad, one for mosquitto. I used the recommendation from this reddit link https://www.reddit.com/r/homeassistant/comments/895iw6/my_home_assistant_setup_rpi_3b_docker_compose/ and mochad is working as expected. One of the drawback for this setup is that you don’t get the convenience of all the add-ons. My setup is still in beta, I have not fully deployed it. I am still debating if I want to put it on the internet using duckdns.

I do have another pi and if I need the add-ons I might switch back to hassio and have a similar setup as you have with my other pi since I am slowly phasing out my x10 devices and might not need mochad eventually.

Hope this helps.

Same for me, I will keep the current setup and use hassio for the learning of Home Assistant and get used to its configuration files

For the time being I will use the 2 PI setup and phase out the x10 components to stay at Hassio

hi guys

I’m running 2PIs setup as well one with fresh new install of HA, the other with dietpi + mochad running on it.
right after install , no issues.
only config mochad:
host: IP
port: 1099
and some lights

Some ‘days?’ later, clicking on a light switch in HA, gets me a
service error “light/turn_off”. [Errno 32] Broken pipe

while echo “pl c13 off” | nc IP 1099 from the HA console works

Logger: homeassistant.components.websocket_api.http.connection
Source: components/mochad/light.py:126
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 19:40:45 (10 occurrences)
Last logged: 19:59:38

[2897073392] [Errno 32] Broken pipe
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1451, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1486, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 499, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 536, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 699, in async_turn_off
    await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs))
  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/mochad/light.py", line 126, in turn_off
    self.light.send_cmd("off")
  File "/usr/local/lib/python3.8/site-packages/pymochad/device.py", line 45, in send_cmd
    self.controller.send_cmd(cmd_str + '\n')
  File "/usr/local/lib/python3.8/site-packages/pymochad/controller.py", line 71, in send_cmd
    self.socket.sendall(six.binary_type(cmd.encode('utf8')))
BrokenPipeError: [Errno 32] Broken pipe

any ideas?
sometimes kicking out something (don’t remember what) or reboot, makes it work again…

opened bug report…