Help Sonoff - Tasmota 5.11.1e on HASS.io 0.63.2

My SONOFF config on Sonoff-Tasmota 5.11.1e

Howto add to HASS.io ?
My version Home Assistant 0.61.1

  • MY CONFIG -

    MQTT

    mqtt:
    - broker: 192.168.1.220
    port: 1883
    username: admin
    password: 12345

    switch:

    platform: mqtt
    name: “Sonoff 01”
    state_topic: “home/sonoff01/switch1”
    command_topic: “home/sonoff01/switch1/set”
    availability_topic: “home/sonoff01/switch1/available”
    payload_on: “ON”
    payload_off: “OFF”
    optimistic: false
    qos: 0
    retain: true

  • ERROR UI -
    hassio-error

Helpme!

Check your topic. Sonoff has sonoff02, but your switch config has sonoff01.

Note the indentation in the config file. It shoud be like:

  - platform: mqtt
    name: "Çalışma Odası Lambası"
    command_topic: "cmnd/sonoff/calisma_odasi_lambasi/power"
    state_topic: "stat/sonoff/calisma_odasi_lambasi/POWER"
    availability_topic: "tele/sonoff/calisma_odasi_lambasi/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    qos: 0
    payload_on: "ON"
    payload_off: "OFF"
    optimistic: false
    retain: true

Always use three back ticks around the configuration code to preserve spacing. Yaml is very picky about indentation, wrong spacing is the most common error.

Also, you have told your Sonoff that your MQTT broker is at 192.168.1.219, and HA that it is at 192.168.1.220

Now configure config yaml:

Result:

I suggest you put your mqtt broker definitions back in configuration.yaml until everything is working. Make sure that works first by doing a mosquitto_pub of a test topic/message and making sure you can see the result with a mosquitto_sub in a different window.

And then check your spacing in switch.yaml, which still appears to be wrong

Any particular reason you opened two identical threads?

in mqtt.yaml you have a dash in front of broker: , that’s wrong.
Initially keep it in the main config file like this:

mqtt:
  broker: 192.168.1.220
  port: 1883
  username: admin
  password: 12345

In Switch you have an odd number of spaces, and you are missing the platform name (mqtt). It should be like this:

- platform: mqtt
  name: "Sonoff 01"
  state_topic: "stat/sonoff01/POWER"
  command_topic: "cmnd/sonoff01/POWER"
  availability_topic: "tele/sonoff01/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"
  payload_on: "ON"
  payload_off: "OFF"
  retain: true

Keep in mind that in Yaml indentation is always two spaces, and lists are always “dash space”.

Also, as @PianSom suggested, in Sonoff you set the broker as 192.168.1.219 while in HA you set it as 192.168.1.220. Either one or the other is wrong.

Thanks for the info. I have corrected all the files and I’m proceeding to reboot the system. I await updates.

My config now:

Now: HASS.io… it is no longer visible from the browser. I rebooted from ssh

after reboot, system hass it is no longer visible from the browser: my log:

2018-01-29 08:34:50 ERROR (SyncWorker_0) [homeassistant.util.yaml] while parsing a block collection
  in "/config/switch.yaml", line 1, column 1
expected <block end>, but found '<block sequence start>'
  in "/config/switch.yaml", line 14, column 2
2018-01-29 08:34:50 ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: while parsing a block collection
  in "/config/switch.yaml", line 1, column 1
expected <block end>, but found '<block sequence start>'
  in "/config/switch.yaml", line 14, column 2

and now?!?!?

Both me and @namadori have made this suggestion - why not try that first?

Delete all reference to the switch until you have a working mqtt broker.

in mqtt.yaml i can see two errors:

  1. if you put mqtt: !include mqtt.yaml in your config you must not repeat mqtt:inside the file
  2. the following lines are indented only one space. Indentation is always two spaces.
  3. I never put dictionaries in external files, so I’m not sure if the lines Broker, port, username, password should be indented or not. In doubt keep them in the main file

The switch.yaml seems correct, sometimes an error in one configuration propagate to other config due to parsing problems. Try as @piansom suggested, make the broker work first, then switches.

config changed:

Reboot now…

I’ll try in italian… Piero, l’indentazione deve essere sempre due spazi!!! La “b” di broker deve essere incolonnata con la prima “t” di “mqtt” :grin:

mqtt:
  broker: 192.168.1.220
  port: 1883
  username: admin
  password: 12345
1 Like

:joy::joy::joy::joy:

thx!

image

Reboot now…
:joy::joy::joy::joy:

:disappointed_relieved::thinking:

image

  • LOG FILE -
2018-01-29 13:47:52 ERROR (MainThread) [homeassistant.setup] Error during setup of component mqtt
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 196, in _async_setup_component
    result = yield from component.async_setup(hass, processed_config)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 399, in async_setup
    success = yield from hass.data[DATA_MQTT].async_connect()
  File "/usr/lib/python3.6/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.6/asyncio/futures.py", line 332, in iter
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.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/paho/mqtt/client.py", line 768, in connect
    return self.reconnect()
  File "/usr/lib/python3.6/site-packages/paho/mqtt/client.py", line 895, in reconnect
    sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
2018-01-29 13:48:06 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=84 from 2018-01-29 12:46:14.253106)
2018-01-29 13:48:08 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of switch.mqtt. Setup failed for dependencies: mqtt
2018-01-29 13:48:09 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform switch.mqtt: Could not setup all dependencies.
2018-01-29 13:48:09 ERROR (MainThread) [homeassistant.components.device_tracker] Unable to load /config/known_devices.yaml: Config file not found: /config/known_devices.yaml

Do you have a standalone MQTT broker? Mosquitto? Managed to connect to it with a different client with same user and password? I use MQTT Spy (Downloads · eclipse/paho.mqtt-spy Wiki · GitHub).

Give up, he doesn’t listen and obviously thought he knew best right from the start by not using any of the dozens of easy to follow, cut and pasteable, tutorials that tell you how to do this!

Hi, I followed all the tutorials.
I am sorry that I take myself for an idiot.
in any case, I will start from scratch to understand what happens.
I will follow all the advice.
thank you