Sonoff S20 tasmota device config help

I am a newbie and have flashed my first sonoff.
Installed MQTT and config a device.
But I am stuck here, I don’t see the device.

I am searching for a few days now but no luck.
I am out off options.
That’s why my question for help here.

I have the sonoff active and when I stop and start mqtt I see this in the log:

[INFO] Setup mosquitto configuration
[WARN] SSL not enabled - No valid certs found!
[INFO] No local user available
[INFO] Initialize Hass.io Add-on services
[INFO] Initialize Home Assistant discovery
[INFO] Start Mosquitto daemon
1549804693: mosquitto version 1.4.15 (build date 2018-03-04 15:35:59+0000) starting
1549804693: Config loaded from /etc/mosquitto.conf.
1549804693: *** auth-plug: startup
1549804693: ** Configured order: http
1549804693: Opening ipv4 listen socket on port 1883.
1549804693: Opening ipv6 listen socket on port 1883.
1549804693: Opening websockets listen socket on port 1884.
1549804693: Warning: Mosquitto should not be run as root/administrator.
1549804701: New connection from “ip sonoff” on port 1883.
[INFO] found wimpie on Home Assistant
1549804702: New client connected from “ip sonoff” as Schreibtischlampe_4AEAA3 (c1, k10, u’wimpie’).

This I got in my configurator.yaml:
mqtt:
discovery: true
broker: 192.168…“ip PI”

This I got in my switches.yaml:

  • platform: mqtt
    name: “Schreibtischlampe”
    state_topic: “stat/sonoffDEV/POWER”
    command_topic: “cmnd/sonoffDEV/POWER”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

This I got in my sonoff s20:

Sonoff S2X Module

Sonoff

Program Version 6.4.1(sonoff)
Build Date & Time 2018-12-24T14:41:00
Core/SDK Version 2_4_2/2.2.1(cfd48f3)
Uptime 0T03:18:43
Flash write Count 90 at 0xFA000
Boot Count 39
Restart Reason Power on
Friendly Name 1 Sonoff
AP1 SSId (RSSI) “ISP” (82%)
Hostname sonoffDEV-2723.local
IP Address 192.168… “ip sonoff”
Gateway 192.168…
Subnet Mask 255.255.255.0
DNS Server 89.101.251.229
MAC Address 84:F3:EB:4A:EA:A3
MQTT Host 192.168…“ip from PI”
MQTT Port 1883
MQTT User wimpie
MQTT Client Schreibtischlampe_4AEAA3
MQTT Topic sonoffDEV
MQTT Group Topic sonoffs
MQTT Full Topic cmnd/sonoffDEV/
MQTT Fallback Topic cmnd/Schreibtischlampe_4AEAA3_fb/

I use HA 0.87
Mosquito broker integrations “This integration has no devices”

This is the mqtt config:
{
“logins”: [],
“anonymous”: true,
“customize”: {
“active”: false,
“folder”: “mosquitto”
},
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”
}
I only change anonymous from false to true.

But this is what I get from the HA log:
019-02-10 14:31:38 WARNING (MainThread) [homeassistant.components.mqtt] Data in your config entry is going to override your configuration.yaml: {‘broker’: ‘core-mosquitto’, ‘discovery’: True, ‘password’: ‘O_29G6HtZNp4Hl0uXyEIPK__gGqZOzqW’, ‘port’: 1883, ‘protocol’: ‘3.1.1’, ‘username’: ‘homeassistant’}
2019-02-10 14:31:39 ERROR (Thread-2) [homeassistant.components.mqtt] Unable to connect to the MQTT broker: Connection Refused: not authorised.
2019-02-10 14:31:39 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Mosquitto broker for mqtt
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/config_entries.py”, line 258, in async_setup
result = await component.async_setup_entry(hass, self)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/init.py”, line 568, in async_setup_entry
hass, conf, hass.data[DATA_MQTT_HASS_CONFIG], entry)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/init.py”, line 380, in _async_setup_discovery
config_entry) # type: bool
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/discovery.py”, line 284, in async_start
hass, discovery_topic + ‘/#’, async_device_message_received, 0)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/init.py”, line 320, in async_subscribe
qos, encoding)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/init.py”, line 702, in async_subscribe
await self._async_perform_subscription(topic, qos)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/init.py”, line 737, in _async_perform_subscription
_raise_on_error(result)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/init.py”, line 822, in _raise_on_error
‘Error talking to MQTT: {}’.format(mqtt.error_string(result_code)))
homeassistant.exceptions.HomeAssistantError: Error talking to MQTT: The client is not currently connected.

Go to the webinterface of your sonoff, and type:

SetOption19 1

This will set mqtt autodiscovery for Home Assistant. And set the module type in the config to the right device (your case a Sonoff S20).

Basically all the settings you’d need to change are the following:

Module type: Sonoff S20
Mqtt broker: if mqtt server has no user/pass, then only IP address and topic name need to be set up.
Then in console type: SetOption19 1

This should be the minimum for it to work. Though I am not sure how the embedde mqtt broker works as I have a separate one. Hope this helps though.

Thank you for your answer.
I had put this in my automations.yaml:

  • alias: “Enable MQTT discovery for all devices”
    trigger:
    platform: homeassistant
    event: start
    action:
    • service: mqtt.publish
      data:
      topic: “sonoffs/cmnd/SetOption19”
      payload: “1”

But I put SetOptio19 1 in the console and this was in the log:
15:05:14 CMD: SetOption19 1
15:05:14 MQT: homeassistant/light/4AEAA3_LI_1/config = (retained)
15:05:14 MQT: homeassistant/switch/4AEAA3_RL_1/config = {“name”:“Sonoff”,“cmd_t”:"~cmnd/POWER",“stat_t”:"~tele/STATE",“val_tpl”:"{{value_json.POWER}}",“pl_off”:“OFF”,“pl_on”:“ON”,“avty_t”:"~tele/LWT",“pl_avail”:“Online”,“pl_not_avail”:“Offline”,“uniq_id”:“4AEAA3_RL_1”,“device”:{“identifiers”:[“4AEAA3”],“name”:“Sonoff”,“model”:“Sonoff S2X”,“sw_version”:“6.4.1(sonoff)”,“manufacturer”:“Tasmota”}, “~”:“sonoffDEV/”} (retained)
15:05:14 MQT: homeassistant/light/4AEAA3_LI_2/config = (retained)
15:05:14 MQT: homeassistant/switch/4AEAA3_RL_2/config = (retained)
15:05:14 MQT: homeassistant/light/4AEAA3_LI_3/config = (retained)
15:05:14 MQT: homeassistant/switch/4AEAA3_RL_3/config = (retained)
15:05:14 MQT: homeassistant/light/4AEAA3_LI_4/config = (retained)
15:05:14 MQT: homeassistant/switch/4AEAA3_RL_4/config = (retained)
15:05:14 MQT: homeassistant/light/4AEAA3_LI_5/config = (retained)
15:05:14 MQT: homeassistant/switch/4AEAA3_RL_5/config = (retained)
15:05:14 MQT: homeassistant/light/4AEAA3_LI_6/config = (retained)
15:05:14 MQT: homeassistant/switch/4AEAA3_RL_6/config = (retained)
15:05:14 MQT: homeassistant/light/4AEAA3_LI_7/config = (retained)
15:05:14 MQT: homeassistant/switch/4AEAA3_RL_7/config = (retained)
15:05:14 MQT: homeassistant/light/4AEAA3_LI_8/config = (retained)
15:05:14 MQT: homeassistant/switch/4AEAA3_RL_8/config = (retained)

With current entities I see this:

automation.enable_mqtt_discovery_for_all_devices on last_triggered: 2019-02-10T14:09:27.426458+00:00 friendly_name: Enable MQTT discovery for all devices
automation.set_theme_at_startup on last_triggered: 2019-02-10T14:09:27.424269+00:00 friendly_name: Set theme at startup
group.all_automations on entity_id: automation.enable_mqtt_discovery_for_all_devices,automation.set_theme_at_startup order: 9 auto: true friendly_name: all automations hidden: true
group.all_switches unknown entity_id: switch.schreibtischlampe order: 10 auto: true friendly_name: schreibtischlampe hidden: true

unfortunately nothing. It has to be something simple, but I don’t see it.

You should type the setoption command in the web interface of the sonoff. Go to it’s IP address in your favorite browser and click the console button. It’s basically a configuration command which is not configurable using the buttons in the web interface.

Thank you for the help.
I did this, for the log see my post.
I typed in the console the SetOptio19 1

OK, I thought you created a automation which sends it. I have 4 S20’s in my HA but none of them uses the autodiscovery option.
But when I looked again at what you posted it looks as if HA is not able to connect to the MQTT broker.
So either HA is using some username/password or the MQTT broker is still not allowing access anyhow.
You could install MQTT FX to check if you are able to connect to the MQTT broker from your pc. Just as a test to validate the MQTT configuration.

To get in the HA I use a username/password.
I use in the sonoff module in the host the ip from my PI.
User and password in the sonoff module is the same as to get in HA.
I tried mqtt fx where I select Broker status and used my PI --> IP and port.
But I got unrecognized packet.

When I in HA look in configuration under states the only thing from the switch and mqtt I see is:

group.all_automations on entity_id: automation.enable_mqtt_discovery_for_all_devices,automation.set_theme_at_startup order: 9 auto: true friendly_name: all automations hidden: true
group.all_switches unknown entity_id: switch.schreibtischlampe order: 10 auto: true friendly_name: schreibtischlampe hidden: true

In the logs in your initial post I saw user ‘wimpie’ has previously successfully logged in onto the mqtt broker. Have you tried logging in as user wimpie on the mqtt broker from the mqtt fx application?

In mqtt fx I typed the ip from my PI.
And the port from my mqtt broker 1883.
No user and password because I said in the mqtt config:
“anonymous”: true,

And I got this in the log from ha mqtt:

1549819295: New connection from 192.168.178.17 on port 1883.
1549819295: New client connected from 192.168.178.17 as 6847e398a33c47d68ed23f5fefdb4da0 (c1, k60).

And this I got in the log from the console mqtt Fx:

2019-02-10 18:21:40,284 INFO — MqttFX ClientModel : MqttClient with ID 6847e398a33c47d68ed23f5fefdb4da0 assigned.
2019-02-10 18:21:40,304 INFO — MqttFX ClientModel : session present: false
:

If I put in a password and username in the matt fx I got this:
In the log from ha mqtt:
1549819526: New connection from 192.168.178.17 on port 1883.
[INFO] found wimpie on Home Assistant
1549819527: New client connected from 192.168.178.17 as 6847e398a33c47d68ed23f5fefdb4da0 (c1, k60, u’wimpie’).

In the og from console mqtt FX:
2019-02-10 18:25:30,780 INFO — MqttFX ClientModel : MqttClient with ID 6847e398a33c47d68ed23f5fefdb4da0 assigned.
2019-02-10 18:25:31,821 INFO — MqttFX ClientModel : session present: false

So mqtt looks good I only don’t know what session present: false means

The problem is then perhaps in the configuration from the switch.
Perhaps I have to start over again. Format the sd and put a new HA on it.

I cannot get my head around how you can succesfully connect both anonymously and while authenticating with a username.But if you are able to connect to the mqtt then HA should be able to do so as well.

fyi: my mqttfx client also says session present: false.

Thank you for you help, but the only that is left is start over.

If that works for you, that’s fine to me. But I don’t think the issue isn’t recoverable without a reinstall. Nevertheless I hope things work out for you after the reinstallation. Good luck.