MQTT device rename causing it's no longer recognize

I’ve been using several Tuya devices converted to Tasmota firmware for years. I’m also using several Zigbee devices as well using ZHA integration. But problem I faced today is beyond any imagination.

So today I moved Tuya Tasmota WIFI wall switch from one place to another (to different room). That’s why I wanted to change it’s name to reflect the room it is on. First of I logged on to device itself via it’s Tasmota build-in web interface to change it’s WIFI name, MQTT name and so on.

After I did that in HA device became offline which is reasonable to me. So I deleted this device in HA. However I was expecting this device to be re-discovered by MQTT integration on new name (which I just changed). That never happened. I can see in MQTT browser app for Windows that it reports it’s state in MQTT itself under new name however in MQTT integration in HA it doesn’t show up at all.

I tried to remove MQTT integration from HA → restart HA → add MQTT integration again but still while all my several devices show up - this one doesn’t. I also logged on to this device web page and made console command SetOption19 1 but these also didn’t fixed the problem. I can see in MQTT Windows app browser that this device is reporting it’s state to MQTT but still not visible to MQTT integration in HA at all.

What the hell I’m doing wrong or what the hell is wrong with HA in that case?

Just to repeat - It was working with MQTT and HA before. All I did was changing it’s WIFI name, MQTT name, etc.

Do you still have retained messages under

tasmota/discovery/macaddress/config
tasmota/discovery/macaddress/sensors

The name change might be causing the problem against the retained messages.

I’m not sure what you are talking about. If you’re talking about MQTT browser app for Windows / Linux / Android / Whatever then under tamota/discovery I don’t have such thing as macaddress. Under tasmota/discovery I have only some random string of characters (reflecting to some devices I guess) like this:

image

they are all MAC addresses. It is how tasmota creates the unique ID needed for each device. Look for the macaddress that matches your device and delete the retained messages.

But I get what you mean. The main problem is that once you launch this app it doesn’t actually show you the whole database of MQTT database. It shows you only the entries which changed from the time you launched that app.

I don’t get it why it works that way. In example if I launch this app it won’t show me my light bulb activity at all until it will make any activity while the app is running. So it doesn’t work like database browser but more like active monitor from the moment it was launched. This is STUPID!!!

Capture
thats from tasmota device info.

mqtt messages have two styles.
Retained messages that are saved to the server(broker).
Normal messages that are not stored when you leave MQTT explorer etc.

When you log on mqtt explorer etc, only the Retained messages are there. Then as new normal messages come in they will be displayed. That is how MQTT works.

1 Like

OK - I get it that it reflects MAC address of device. Problem is that once I click it on MQTT browser there’s no option to delete it. To show you on example - this is another device where THERE IS delete button:

But once I click to this device I’m concerned about by checking it’s MAC address via arp -a 192.168.0.179 and looking for it MQTT browser I DON’T HAVE DELETE BUTTON AT ALL:

Capture

Click down onto config below. You should have the yellow retained. hit the the X
You will probably need to restart HA too, to flush the old message.

Would be nice but since I closed MQTT Explorer and fired it up again I cannot see no longer this device MAC address under tasmota/discovery. I even tried to change this device state to show up in MQTT browser but without luck. I don’t see it here anymore under tasmota/discovery.

EDIT: I mean I see it under device name in the tree in MQTT Explorer but I don’t see it anymore under tasmota/discovery since it didn’t “wrote” any entry there from that time.

And as we know you can only see entries which showed up in MQTT from time you made them change since you launched MQTT browser app - which is stupid.

SetOption19 0 is what you want.

There is also this note on that page.

Warning

Do not change the FullTopic in order to use this feature. Leave it as default.

Just name your devices abit more generically in tasmota(Don’t change the ones you have) and use Home Assistant to do the renaming. Home assistant doesn’t like having the unique devices renamed, as you found out. It messes up the database entries and device registry

I’ve noticed one thing in MQTT. I have identical second device as this which I have problem with. So in case of this working device I can see something like this:

However in case of this non-working device there’s whole section missing:

There’s information missing under cmnd

Does it ring any bell to anyone? As said - both devices and their Tasmota config, Tasmota version, etc. are identical.

SetOption19 1 looks set on the top image. On both actually by the looks.

cmnd is an incoming message topic.
So it would only be show available messages if you had sent a command to that device since you logged into the broker to check. Either from Home assistant or however you usually send the command.

Unless it was a retained message (which is not usually used for power, it will cause the device to use that command whenever it checks the broker).

So in other words there’s no chance to be anything under cmnd since it’s not connected to HA so HA can’t send any command to it. Clear.

Anyone else can help why this device is visible in MQTT browser but not in HA itself? I tried everything so far. Been resetting this device million times.

I’ve found the core of the problem. It had nothing to do with device renaming itself or MQTT issues. It was about Tasmota version. Let me explain:

I’ve completelly deleted mosquitto.db database file of MQTT. Then restarted HA to allow it re-discover all Tasmota devices. I have several of them and from all of them only ONE has been discovered. The only difference between this device and other ones was that this working device was on Tasmota 7.2.0 while others on Tasmota 12.

You may ask here - Hold on, so how those devices were working before deleting MQTT database?

Well - answer is this. If you connect device to MQTT while being on older version of Tasmota and then upgrade to Tasmota 12 it will still work (however HA claims device has Tasmota version 11). However then - if you try to connect “brand new” device already on Tasmota 12 it will fail.

So I downgraded all my devices to Tasmota 7.2.0 and they were all discovered by HA.

At this moment I recommend not to use newest Tasmota version. As for now (September 2022) the best working version is 7.2.0. Go any higher only if your device doesn’t work on older version of Tasmota and never go directly to newest one. Try version-by-version upgrade until it works and leave it as it is.

That’s using setoption19 1 and homeassistant discovery and not the tasmota integration correct?
Around tasmota 9.2 was when it switched to the tasmota integration and setoption 19 0

On Tasmota 12 it doesn’t matter if I set SetOption19 to 0 or 1. It’s not discovered eitherway. Even on SetOption19 0 it’s still not discovered.

Current Release
Tasmota 12.1.1 Patricia

Breaking Changes :warning: :warning: :warning:~

  • Removed dedicated MQTT Home Assistant discovery in favour of Tasmota Discovery and hatasmota

7 devices
7 devices

8 devices
8 devices

version
12.1 tas

the device just needed a restart after removal and upgrade to 12.1.1 to send out discovery info.

Wait a second - does that mean that with Tasmota 12 we don’t need MQTT anymore but we can use Tasmota integration instead? Whole communication with device WITHOUT MQTT broker?