Mqtt "this integration has no devices" with tasmota connected to add-on broker

I’m running Hass.io 0.9.6.2 trying to get a sonoff basic with tasmota 6.5.0 switch to integrate. It looks like the broker is working, and it looks like the sonoff connects to the broker. There are no devices in the integrations, and the Switch.Sonoff is “Unavailable” on the UI.

Broker config is:

{
  "logins": [],
  "anonymous": false,
  "customize": {
    "active": true,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

The Broker log looks like:

[12:05:44] INFO: Setup mosquitto configuration
[12:05:44] WARNING: SSL not enabled - No valid certs found!
[12:05:44] INFO: No local user available
[12:05:45] INFO: Initialize Hass.io Add-on services
[12:05:45] INFO: Initialize Home Assistant discovery
[12:05:45] INFO: Start Mosquitto daemon
1563732345: Loading config file /share/mosquitto/acl.conf
1563732345: mosquitto version 1.6.3 starting
1563732345: Config loaded from /etc/mosquitto.conf.
1563732345: Loading plugin: /usr/share/mosquitto/auth-plug.so
1563732345:  ├── Username/password checking enabled.
1563732345:  ├── TLS-PSK checking enabled.
1563732345: |-- *** auth-plug: startup
1563732345:  └── Extended authentication not enabled.
1563732345: Opening ipv4 listen socket on port 1883.
1563732345: Opening ipv6 listen socket on port 1883.
1563732345: Opening websockets listen socket on port 1884.
1563732345: Warning: Mosquitto should not be run as root/administrator.
1563732346: New connection from 192.168.1.6 on port 1883.
[INFO] found merlin on Home Assistant
1563732348: New client connected from 192.168.1.6 as auto-DEDC01E3-A51B-597E-284286BD68CC (p2, c1, k60, u'merlin').
1563732348: New connection from 192.168.1.6 on port 1883.
1563732348: New connection from 192.168.1.6 on port 1883.
1563732348: Socket error on client <unknown>, disconnecting.
1563732348: New client connected from 192.168.1.6 as auto-61E81DB7-8CC0-420E-661B-EB2C30EE5F0A (p2, c1, k60, u'merlin').
1563732348: New connection from 192.168.1.14 on port 1883.
[INFO] found mosquito on Home Assistant
1563732350: New client connected from 192.168.1.14 as DVES_C7BFF8 (p2, c1, k10, u'mosquito').
1563734145: Saving in-memory database to /data/mosquitto.db.
1563735946: Saving in-memory database to /data/mosquitto.db.

192.168,1.14 is the tasmota.
192.168,1.6 is Home Assistant.

The Integration for MQTT was added using discovery, so there aren’t many options there.

Configuration.yaml for the switch is:


switch:

    platform: mqtt
    name: “Sonoff”
    state_topic: “stat/DVES_C7BFF8/POWER”
    command_topic: “cmnd/DVES_C7BFF8/POWER”
    availability_topic: “tele/DVES_C7BFF8/LWT”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    payload_available: “Online”
    payload_not_available: “Offline”
    state_on: ON
    state_off: OFF
    retain: true

Did you create an access control list?

Read the big yellow warning at the top of the page:

Yes I did create the ACL, just as indicated in the document you linked.

Well you are specifying the switch manually so there wont be.

If you want discovery you have to setoption19 = 1 in the tasmota console on the device and remove your manual config (switch yaml).

I am specifying it manually, but it doesn’t work by not specifying it either. Option19 is set on the tasmota console.

What get when I remove the yaml is no switch on the UI (understandable), no integrations listed, no discovery notifications, yet the broker and Tasmota logs show everything is connected.

Something I don’t quite understand is the topic of MQTT. Is there no topic setup needed on HA or the broker ad-in?

MQTT Host	192.168.1.6
MQTT Port	1883
MQTT User	mosquito
MQTT Client	DVES_xxxxx
MQTT Topic	sonoff
MQTT Group Topic	sonoffs
MQTT Full Topic	sonoff/cmnd/
MQTT Fallback Topic	cmnd/DVES_xxxxxx_fb/

None if you use discovery.

If you do it manually then you specify the topic in the switch configuration yaml - double check that, it is case sensitive.

The broker just records the topics and messages sent to it and publishes to clients (like HA) that subscribe to the topics, so no, no configuration for the topic required there.

Yeah, I had trouble with this too but as I had a working manual config I didn’t look too closely into why. Many others have it working fine though.

It does look like you are using fancy double quotes in your config. This ” as opposed to this " which is what should be used. Could just be a copy paste formatting thing though. Check it in your yaml.

There are also two versions of the switch config depending on which Tasmota version you are using. The config you have above is for Tasmota development version built 2018-12-13 or later. Is that what you are using? More here: GitHub - arendst/Tasmota: Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at

You can use a client on your PC like “mqtt explorer” to see what the actual topics on the broker are and
a) make sure they are there
b) make sure what you have in your switch config is correct.

Thanks Tom!

I don’t know how to use any other quote key. I tried retyping the yaml quotes, changing the topic to use the fallback (DVES_C7BFF8_fb), copying the yaml from the link you sent and changing the topics around a few times, but doesn’t work after a restart: Still shows the entity state as Unavailable.

Hmmm, with MQTT Explorer I connect to my broker, and only one thing pops up: tele/sonoff/LWT = Offline. Does that mean I have the explorer configured wrong, or is there a tasmota problem?

Sounds like the sonoff is not correctly communicating with the broker.

Every time you manually press the button on the device to toggle the relay state it should publish to the broker.

Open the Tasmota web console on the device then try pressing the device button, what do you see in the console?

At the same time what is in the MQTT log (bottom of the Hassio Mosquitto addon page).

14:59:35 MQT: sonoff/stat/RESULT = {"POWER":"OFF"}
14:59:35 MQT: sonoff/stat/POWER = OFF
15:00:20 MQT: sonoff/tele/HASS_STATE = {"Version":"6.6.0(release-sonoff)","BuildDateTime":"2019-07-06T13:10:20","Core":"2_3_0","SDK":"1.5.3(aec24ac9)","Module":"Sonoff Basic","RestartReason":"Software/System restart","Uptime":"0T00:05:02","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:04","MqttCount":1,"BootCount":23,"SaveCount":50,"IPAddress":"192.168.1.14","RSSI":"78","LoadAvg":19}
15:00:32 MQT: sonoff/tele/STATE = {"Time":"2019-07-22T15:00:32","Uptime":"0T00:05:14","Heap":14,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"MyCharterWiFib0-2G","BSSId":"50:6A:03:C6:12:B0","Channel":1,"RSSI":78,"LinkCount":1,"Downtime":"0T00:00:04"}}
1563803672: Socket error on client DVES_C7BFF8, disconnecting.
1563803698: New connection from 192.168.1.14 on port 1883.
[INFO] found mosquito on Home Assistant
1563803699: New client connected from 192.168.1.14 as DVES_C7BFF8 (p2, c1, k30, u'mosquito').
1563803702: Client DVES_C7BFF8 disconnected.
1563803723: New connection from 192.168.1.14 on port 1883.
1563803723: New client connected from 192.168.1.14 as DVES_C7BFF8 (p2, c1, k30, u'mosquito').


Try configuring your switch like this:

    platform: mqtt
    name: "Sonoff"
    state_topic: "sonoff/stat/RESULT"
    value_template: "{{ value_json.POWER }}"
    command_topic: "sonoff/cmnd/POWER"
    availability_topic: "sonoff/tele/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

For some reason your topics all look back to front. Possibly an option you’ve set somewhere while debugging.

In the device’s MQTT set up page what is in the Full Topic text box. This?

%prefix%/%topic%/

or this:

%topic%/%prefix%/

I’ll try that when I get back home tonight. I made no changes like this to the default configs.

I did try updating Tasmota this morning to 6.6.0, but doesn’t seem to have made an improvement.

Tom, It does looks like the topic and prefix are backwards. I swear I haven’t chaged this from default because I have no idea what it means. However, looking at the default tasmota and the default configuration from the HA setup page, they match. Why do you think its backwards?

See here: https://github.com/arendst/Sonoff-Tasmota/wiki/Home-Assistant-‐-Manual-Config#configure-switches

For example, it says: state_topic: "stat/sonoff/RESULT"

Where as your console is saying: state_topic: "sonoff/stat/RESULT"

The stat and sonoff sub topics are swapped.

This is configured in the device in the MQTT set up page in the Full Topic text box.

If you use MQTT Discovery, SetOption19 On then the topic reverses. This is expected behaviour.
sonoff/stat instead of stat/sonoff etc.

You should check all switches as I will almost bet you have the same topic, sonoff for ALL of them and they need to be unique.

See here (using MQTT Explorer)
image

Huh. Well there you go. I did not know that.

So the problem is that he has setoption19 still set and is trying to manually configure the device (because discovery is not working for some reason).

Yeah. It’s incompatible according to the Tasmota Wiki… I have no idea why but I think it was only after v6.4(?)

I only have one sonoff at this point and nothing else on MQTT either. Trying to get one to work before I get any others muddying the waters.

I don’t understand which way it needs to be now. I turned off option 19.

With option19 off it should be like this:

    platform: mqtt
    name: "Sonoff"
    state_topic: "stat/sonoff/RESULT"
    value_template: "{{ value_json.POWER }}"
    command_topic: "cmnd/sonoff/POWER"
    availability_topic: "tele/sonoff/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

then you need cmnd/sonoff for example. You will need to manually change it. (In Tasmota manually change it)

Thanks for your help guys. It’s still not working though. Now the broker is not reporting a connection to the Sonoff IP. I need to just start over again.

image

image