MQTT help - want to add a hacked Sonoff

Hi,

I configured MQTT to pass my Samsung SmartThings Things to my Home Assistant a few months ago but I didn’t complete it in HA, and haven’t yet managed to connect from HA to the MQTT.

I now have a hacked Sonoff and want to add it directly to Home Assistant but on the guide I used it mentioned adding the Sonoff to HA using MQTT.

Could someone help with firstly how I should edit Configuration.yaml to include my MQTT server, and secondly what the command would be to add the Sonoff to my Home Assistant please?

Just take a look at the documentation for mqtt brokers:

And perhaps the documentation for this github repo?

And if you have any specific questions, ask them here. :slight_smile:

and don’t forget the switch part:

Thanks. I set up an MQTT server in docker, added a “MQTT Broker” in my SmartThings API, and frankly I’ve no idea what I was doing.

Therefore when I’m trying to get Home Assistant to see the MQTT server in configuration.yaml, I’ve not really much of a clue what to do, I’ve tried

mqtt:
  broker: 192.168.0.99

but HA just reports “Invalid Config”.

Any idea? I realise that i’m not very far along in this process sorry!

Being as you are using docker I’m not much help anymore. I tried docker a few weeks ago and gave up because I just couldn’t wrap my head around all the requirements (bind volumes, ports, SSL, proxies, etc).

What is the full log in HA aside from invalid config?

1 Like

I am not sure if Docker is the issue or not, I have no idea what I set up inside the Docker container any more. From a combination of not understanding it at the time, and it being so long ago. Anyway I searched home-assistant.log and I found these references to MQTT:

2018-03-30 13:17:28 ERROR (MainThread) [homeassistant.setup] Error during setup of component mqtt
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py”, line 196, in _async_setup_component
result = yield from component.async_setup(hass, processed_config)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/init.py”, line 399, in async_setup
success = yield from hass.data[DATA_MQTT].async_connect()
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/init.py”, line 506, in async_connect
self._mqttc.connect, self.broker, self.port, self.keepalive)
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/lib/python3.5/site-packages/paho/mqtt/client.py”, line 768, in connect
return self.reconnect()
File “/srv/homeassistant/lib/python3.5/site-packages/paho/mqtt/client.py”, line 895, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))

If the broker is hosted on smartthings, I would use the ip address of the smartthings. But I have no idea if that’s right!