ahoy icon indicating copy to clipboard operation
ahoy copied to clipboard

MQTT Client Received pubcomp for unknown message ID: XX

Open Leviathan09 opened this issue 1 year ago • 19 comments

Platform

ESP32

Assembly

I did the assebly by myself

nRF24L01+ Module

nRF24L01+ plus

Antenna

external antenna

Power Stabilization

Elko (~100uF)

Connection picture

  • [ ] I will attach/upload an Image of my wiring

Version

0.7.36

Github Hash

ba218edbdb1b0a168e0c721bc2259fcc97c57f8a

Build & Flash Method

AhoyDTU Webinstaller

Setup

System Config is default Static IP Only 1 inverter, Intervall 6s, max reries 5 de.pool.ntp.org as NTP Longtitude and Latitude set with 45 min offset and pause during night MQTT Broker set with interval 0s, Broker is ioBroker No Display

Debug Serial Log output

No response

Error description

Since the update from 0.6.0 to 0.7.36 i recieve many MQTT log entries in my ioBroker like this

'Client Received pubcomp for unknown message ID: XX`

I didn't change anything accept updating to a newer version.

Leviathan09 avatar Aug 21 '23 10:08 Leviathan09

Interessting. I have ioBroker here and two ESPs (8266 and 32). Both of them are connected to the mqtt.0 instance. If I check my log in ioBroker, I can't see anything regarding your reported problem. Do you use username and password for MqTT?

lumapu avatar Aug 21 '23 10:08 lumapu

Interessting. I have ioBroker here and two ESPs (8266 and 32). Both of them are connected to the mqtt.0 instance. If I check my log in ioBroker, I can't see anything regarding your reported problem. Do you use username and password for MqTT?

Yes, username and password is used but without any special characters or something, just alphabetic character and numbers

Leviathan09 avatar Aug 21 '23 11:08 Leviathan09

Check your mqtt topics, they changed as result of an issue with Home Assistant. Bu sure to select the right ones after update 0.7.x https://github.com/lumapu/ahoy/issues/1066

TIpp: Set ntp to your Router IP, this is faster and more stable. You should block AhoyDTU from internet by setting or activating the rules inside your Router.

rmayergfx avatar Aug 21 '23 18:08 rmayergfx

Check your mqtt topics, they changed as result of an issue with Home Assistant. Bu sure to select the right ones after update 0.7.x #1066

TIpp: Set ntp to your Router IP, this is faster and more stable. You should block AhoyDTU from internet by setting or activating the rules inside your Router.

iobroker is listening to all mqtt topics, so Home Assistant stuff does not applie here.

Good hint with the router IP for ntp

Leviathan09 avatar Aug 22 '23 11:08 Leviathan09

Listening to all topics is not the problem, can you see all the topics from ahoydtu in iobroker? The update changed the structure, so it could be possible that you need to select the right topic again. Is TasmoAdmin in use? this can also be a reason for the messages!

rmayergfx avatar Aug 23 '23 17:08 rmayergfx

I have the same setup and it happens after a few hours the same in my case. Restarting the AhoyDTU or the MQTT adapter in my iobroker fixes the problem directly for the next few hours. It doesn't play a role which side of the MQTT connection I restart, I just have to do it for one side and it's directly working again. But after a few hours the logging starts again with the same messages and the DTU stops reacting on limit control commands over MQTT anymore. (but some values are still updating from DTU to broker, it just seems that the DTU stops reacting on MQTT commands)

BerziOnline avatar Sep 02 '23 11:09 BerziOnline

Because the DTU has freezed right now again, I checked the logs even more on iobroker side and I saw, that the reason is a huge amount of these error-messages: 2023-09-03_09-15

The error message sometimes changes: 2023-09-03_09-11_1

I have this problem since 4 days, but one day it wasn't that bad obviously: (very strange) 2023-09-03_09-11

Right now I am getting these messages (although the DTU is full functional and always reachable - distance to the router is 20cm): 2023-09-03_09-19

The log to the same time now on the DTU side: 2023-09-03_09-19_1

Rebooting the DTU directly stops the error messages in the iobroker logs and it's working again.

I have no idea why this is happening. I also investigated the logs trying figure out when this error message starts, but I couldn't see any strange behaviour or commands to the DTU before.

BerziOnline avatar Sep 03 '23 07:09 BerziOnline

The bug comes with the step from 0.7.26 to 0.7.36 very sure.

I went over to dev v0.7.45 and the problem still exists. A downgrade to 0.7.26 eliminates the full problem directly.

BerziOnline avatar Sep 03 '23 11:09 BerziOnline

The bug comes with the step from 0.7.26 to 0.7.36 very sure.

I went over to dev v0.7.45 and the problem still exists. A downgrade to 0.7.26 eliminates the full problem directly.

Good to known that a downgrade help. In the meantime i changed the log level of the mqtt adapter to warning which also helped

Leviathan09 avatar Sep 05 '23 08:09 Leviathan09

I had this issue too. I am controlling two inverters over iobroker -> jscript -> mqtt. (Powerlimit) but i am still on 0.7.45. The only thing i messed around with was that the values i send to the inverter were of type float and not of type string. It expects type string, so i cast them to string. Furthermore, i rounded the values down to only full decimal values. Reseted the inverter, rebooted ahoy dtu and since then, this error messages are gone and everything seems working fine.

I2e4per avatar Sep 06 '23 06:09 I2e4per

I use this script HoymilesZeroExport for controlling my inverter. But maybe the float/string part could be a problem when ahydtu reports the stuff back to iobroker with mqtt

Leviathan09 avatar Sep 06 '23 07:09 Leviathan09

I had a quick look at this *.py script. as far as i can see there is a cast from float to int, which is basically sort of the same i am doing by rounding to full decimal values. Therefore, yes. This could be related.

I2e4per avatar Sep 06 '23 07:09 I2e4per

see def SetLimit(pLimit): ... NewLimit = CastToInt(pLimit*Factor)

So the def CastToInt() Method should be changed to Cast ToString() or additional be implemented. A simple str(..) of the result might also do the trick already.

I2e4per avatar Sep 06 '23 07:09 I2e4per

The question is, wht exactly ahoy dtu or iobroker is expecting here.

I2e4per avatar Sep 06 '23 07:09 I2e4per

I don't think it's the source of the problem. The data sent from my iobroker to the inverter is always a string, because I am using not the percentage as limit, I am using the absulte values. So the limit is a built string with the number and the unit sign "W". This is how the mqtt limit field distinguishes if you want to have an absolute limit or not. So the only chance giving to the same datapoint an absolut limit is in adding "W" to your number, what is only possible if you build a string before. It's described in the documentation of the MQTT part of AhoyDTU.

So as a conclusion: I already just sending the limit control as a string, because the AhoyDTU exactly needs that to understand it as an absolute value.

BerziOnline avatar Sep 06 '23 15:09 BerziOnline

Ich muss diese issue nochmal aufwärmen:

Mein Setup: AhoyDTU 0.8.111 mit 3x HM-800, HoymilesZeroExport-Skript, VzLogger, ioBroker mit MQTT-Server

Seit einigen Versionen (0.8.97 - 0.8.111) habe ich im ioBroker-Protokoll alle 10 Sekunden die folgende Fehlemeldung der MQTT-Servers:

Client [ahoydtu] Received pubrel for unknown message ID

2024-04-19 17_30_28-Window

Die IDs wiederholen sich alle 10 Sekunden bzw. werden irgendwann immer mehr ...

2024-04-19 17_44_48-Window

Diese "Infos" treten nach einigen Stunden nach dem Neustart der Ahoy DTU (oder der MQTT-Instanz) auf. Ich hab nun schon mehrere Ansätze verfolgt - vom Abschalten des HoymilesZeroExport-Skripts über das Aufsetzen einer neuen MQTT-Instanz im ioBroker und die Veränderung des Abfrageintervalls der AhoyDTU mit den Wechselrichtern (höher und niedriger als 10 Sek.) ... nichts hat geholfen (und die Fehlermeldung kam immer alle 10 Sekunden - egal, wie das Abfrageintervall in der AhoyDTU eingestellt ist). MQTT-Intervall steht auf 0 (Standard) in der Ahoy-DTU.

Hat irgendwer noch eine Idee wo man schauen könnte? Diese Problematik trat die letzten Monate nie auf und kam (meiner Meinung nach ohne Veränderungen am Setup) plötzlich. Die Ahoy-DTU habe ich immer geupdated (und die Config übernommen/angepasst) - seit 0.6.xx .... liegt darion vielleicht das Problem? Mich machen die 10 Sekunden stutzig (und die Fehleranzahl - es sind jeweils 50, 52 oder mal 118 Fehler gleichzeitig) ...

Airwalk007 avatar Apr 19 '24 15:04 Airwalk007

Gleiches Problem hier bei IOBroker MQTT Adapter V5.2.0 und AhoyDTU V0.8.83 image

RALFISBORN avatar May 06 '24 18:05 RALFISBORN

ich verwendet auch ioBroker, kann den Fehler aber garnicht sehen 🫤

lumapu avatar May 30 '24 22:05 lumapu

bisher konnte ich den Fehler leider nicht mehr reproduzieren.

RALFISBORN avatar May 31 '24 16:05 RALFISBORN

Ich habe das hier im ioBroker Issue Tracker in einem Kommentar zu 297 gefunden:

In fact whats needed would be a debug log from before and after when it happens to see what exactly the referenced message ids were,

If this error happens on adapter start (like inthe log on Dropbox) I can only assume that the adapter stopped "In the middl of message sending" because the adapter received a pubrel (which is the qos2 answer to pubrec) where he do not know the ID (because IDs were cleared on adapterstart), so I would consider this as an potential normal behaviour for a "restart" of the adapter. This is for the case that the adapter is the receiver of the message

QOS2 process is: 1. sender sends publish -> 2. receiver sends pubrec -> 3. sender sends pubrel -> 4. receiver sends pubcomp

In this case the adapter was ended after he sended out the first pubrec and before he sent out pubcomp and so the sender resends the pubrel, but we do not know these IDs anymore. But the sender remembered that these messages were in the queue unanswered.

We now could persist these inflight messages somehow and restore them on restart ... but we do not do that right now.

So the "pubrel" ones are ok and to be ignored for now ... in fact you know that you somehow did not received these number of messages from the last adapter run ...

@Leviathan09 @BerziOnline @RALFISBORN tritt der Fehler bei Euch noch auf oder können wir das Issue auf der Ahoy Seite schließen ?

stefan123t avatar Oct 29 '24 16:10 stefan123t