Home Assistant Community

Mochad configuration

#1

Hi, I am trying to configure the mochad platform, using the instruction on the web page I added to configuration.yaml:

mochad:
 host: localhost

switch:
 platform: mochad
 devices:
   - address: a13
     name: Tuinverlichting

Unfortunately the log file shows the following result:

2018-03-29 20:14:27 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform mochad
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/switch/mochad.py", line 36, in setup_platform
    hass, mochad.CONTROLLER.ctrl, dev) for dev in devs])
  File "/usr/lib/python3.6/site-packages/homeassistant/components/switch/mochad.py", line 36, in <listcomp>
    hass, mochad.CONTROLLER.ctrl, dev) for dev in devs])
  File "/usr/lib/python3.6/site-packages/homeassistant/components/switch/mochad.py", line 56, in __init__
    self._state = self._get_device_status()
  File "/usr/lib/python3.6/site-packages/homeassistant/components/switch/mochad.py", line 102, in _get_device_status
    status = self.device.get_status().rstrip()
  File "/usr/lib/python3.6/site-packages/pymochad/device.py", line 55, in get_status
    return self.controller.read_data().lower()
  File "/usr/lib/python3.6/site-packages/pymochad/controller.py", line 83, in read_data
    data = self.socket.recv(4096)
ConnectionRefusedError: [Errno 111] Connection refused

Looks like either the port is not the default 1099 or it’s not running. Any help would be appreciated.

#2

For me it helped to change the line host: localhost to host: 127.0.0.1
It forces the module to use ipv4

#3

Thanks for the anwer, tried it, still getting the connection refused error message in the log.

#4

Changing host to my ip worked but localhost did not. Weird. Thanks for posting this fix.

#5

I just started setting up HA. My setup consists X10 switches and appliance plugins that are controller using hardwired X10 remote.

Here is a snippets of my configuration file.

X10 Controller

mochad:
host: 127.0.0.1
port: 1099

X10 devices

switch:

  • platform: mochad
    devices:
    • address: a1
      name: sabine_light
      comm_type: rf
    • address: a2
      name: sabine_fan
      comm_type: rf

Initially I had issues running the mochad component, I was getting the error listed above so I went ahead and tried the CM19A on my Linux box and it worked fine. After that I reconnected the CM19A to the HA and now it comes up and sees my devices but I can’t control them. I send the command out but the LED on CM19A does not illuminate. How can I debug to figure out what is going on.

Thanks for the help