How to clean MQTT? Database still remembers device

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
User avatar
Wolly76
Posts: 24
Joined: Sunday 21 March 2021 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands / Utrecht region
Contact:

How to clean MQTT? Database still remembers device

Post by Wolly76 »

Dear all,
I've removed a virtual device (for Tasmota) as I'm using "Autodiscovery of Tasmota" now. However, the virtual device appeared to have a reference to MQTT and now giving errors in the log:

Code: Select all

2021-09-12 20:26:07.229 Error: Tasmota: (Tasmota) tasmota::updateInfo1Devices: Set module and version failed: 'Module'
2021-09-12 20:26:10.003 Error: Mosquitto: MQTT: unknown idx received! (idx 115) 
Is there a way to clean the DB to get rid of these error messages?

Many thanks in advance!
Regards,
/W
User avatar
FireWizard
Posts: 1892
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: How to clean MQTT? Database still remembers device

Post by FireWizard »

Hello @Wolly76,

I assume you use Mosquitto as broker and probably the error message is caused, because of retained message(s).

Clearing ALL retained messages:

1. First we have to stop the mosquitto broker. sudo systemctl stop mosquitto.service. ...
2. Delete the mosquitto.db containing all the stored message data in the persistence. By default, located in /var/lib/mosquitto/mosquitto.db. ...
3. Restart the mosquitto service. sudo systemctl start mosquitto.service.

This should do the trick.

Regards
User avatar
Wolly76
Posts: 24
Joined: Sunday 21 March 2021 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands / Utrecht region
Contact:

Re: How to clean MQTT? Database still remembers device

Post by Wolly76 »

Thanks for your response. After cleaning the DB and a reboot the first error message has been vanished but the second one ("Error: Mosquitto: MQTT: unknown idx received! (idx 115)") refering to a deleted dummy device with the index 115 still remains.

Anybody another idea? Looking forward to it. Many thanks!
User avatar
FireWizard
Posts: 1892
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: How to clean MQTT? Database still remembers device

Post by FireWizard »

Hello @Wolly76,

You could install MQTT Explorer (http://mqtt-explorer.com/) on your desktop/laptop.

Configure this one to look to your Mosquitto broker and see if you can find a message with idx 115. If so delete it.
Check if it comes back.

Regards
User avatar
Wolly76
Posts: 24
Joined: Sunday 21 March 2021 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands / Utrecht region
Contact:

Re: How to clean MQTT? Database still remembers device

Post by Wolly76 »

Thanks for the MQTT-tool. I've used it to find any lines to the corrupted idx (115 in my case).
Subsequently, I performed an action in Domoticz in which the corrupted idx is send to MQTT.
MQTT reports the following:

Code: Select all

in = {"idx":115,"nvalue":1,"svalue":"","Battery":100,"RSSI":5}
So I considered to have a look in the Domoticz database. Exported the database and used "DB Browser (SQLite)" to view. Searching for the idx-value "115" didn't result in any hit. So, now I'm a bit confused. Where is this idx triggered/send?

Any suggestions for a clue?

Many thanks for considering.
User avatar
FireWizard
Posts: 1892
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: How to clean MQTT? Database still remembers device

Post by FireWizard »

Hi, @Wolly76,

You wrote:
So I considered to have a look in the Domoticz database. Exported the database and used "DB Browser (SQLite)" to view. Searching for the idx-value "115" didn't result in any hit. So, now I'm a bit confused. Where is this idx triggered/send?
This is not surprising, as you already said:
("Error: Mosquitto: MQTT: unknown idx received! (idx 115)")
So the idx (115) is unknown and you will not find it in the database.


Try to disable the MQTT interface in Domoticz and use MQTT Explorer to check if the message is still send. Could it be a Tasmota device?

Regards
User avatar
Wolly76
Posts: 24
Joined: Sunday 21 March 2021 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands / Utrecht region
Contact:

Re: How to clean MQTT? Database still remembers device

Post by Wolly76 »

Thanks for the reply. Apparently I don't understand the MQTT idea. I thought it should be a kind of "man in the middle" but according to the comments it works a bit different.

However, the errors does not appear when the MQTT is disabled. But it does not tell me where to solve the issue. The considered index is from an old dummy switch, and not a Tasmota.
User avatar
FireWizard
Posts: 1892
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: How to clean MQTT? Database still remembers device

Post by FireWizard »

Hello @Wolly76,

You wrote:
However, the errors does not appear when the MQTT is disabled.
That is correct. If you disable MQTT in Domoticz, no MQTT messages will be received by Domoticz. So, Domoticz will also not receive a message with an unknown idx.

While MQTT is disabled, check with MQTT Explorer if something is received under the topic domoticz/in with something as "idx":115 in its message.

Something must publish that unwanted message, unless it is a retained message in the broker.
In that case clear the retained message.
See: http://www.steves-internet-guide.com/mq ... s-example/

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest