Mochad interface not working for me

Hello,
I am a new user. I am running Hassbian on a PI3. I have mochad built and installed. It is connected to a CM19A and works fine from netcat. So that part of the interface is OK. I have the following lines in my configuration.yaml file.

Configure mochad for X10

mochad:
host: 127.0.0.1
port: 1099

switch:
platform: mochad
devices:
- address: G4
name: XMAS Lights
comm_type: rf

The syntax seems to check out OK. I restarted the PI several times since changing the yaml file.
The switch XMAS Lights appears in the GUI interface and the GUI thinks that I am toggling them off and on. It shows no errors and the log file has no entries about mochad at all. However, as you can guess, mochad actually never changes the lights.
If I SSH to the PI and then run “nc localhost 1099”. Then nothing appears to be sent to that port when I change the switch in the Home Assistant GUI. I believe netcat should show any message sent. I verified that with yet another SSH session that I used to set “echo “rf G4 on” | nc localhost 1099” . That command both turned on the XMAS lights and showed a message in the SSH that was monitoring the port. (Perhaps, the listening netcat port is really only seeing the rf being picked up by the receive side,)

Is there a log that would actually show me what was sent out to the port? The home-assistant.log file does not grow or get any extra lines regardless of the number of times I toggle the switch.

I am running 0.83.3 version.

Thanks.

I ran one more test:
I commented out the three lines for mochad in the configuration.yaml

#mochad:

host: 127.0.0.1

port: 1099

Rebooted and the log file contains:

File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mochad.py”, line 39, in setup
conf = config[DOMAIN]
KeyError: ‘mochad’
2018-12-10 02:54:36 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of switch.mochad. Setup failed for dependencies: mochad
2018-12-10 02:54:36 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform switch.mochad: Could not set up all dependencies.

Therefore, it seems that with the original configuration of the yaml file, it was understanding my mochad interface, as that generated nothing in the log file.

OK, Fixed it. I did not have pymochad. Looking at the mochad.py, it seems to be calling that file. From an SSH console window, I ran:

pip3 install pymochad

After a reboot, the XMAS lights go on and off with the GUI interface. As a side note: nothing appears in the log now either. So, as a newbie, I guess just errors go there?

I am guessing that mochad.py is part on the Home Assistant install, but pymochad is not? Anyway, it seems odd to me that I was missing a component, yet nothing was being logged as a warning or error.

dependencies should be downloaded and installed when you add a component such as mochad.

https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/mochad.py#L17 should pull pymochad-0.2.0, which is the latest on pypi https://pypi.org/project/pymochad/#history

Quite why that didn’t happen I don’t know, but you might like to put an issue on github so the devs can investigate.