Mqtt2server mit Home Assistant Verbindungsprobleme

Begonnen von andre07, 29 September 2026, 12:43:34

Vorheriges Thema - Nächstes Thema

andre07

Mit deiner gepatchten Version hatte ich immer noch Probleme es kamen immer wieder ständige reconnects alle 15s
In 00_MQTT2_SERVER.pm, Zeile 567 (UNSUBACK bei Protokoll 5), stimmt die Länge nicht.
Dort steht pack("CCnCC*",0xb0,2+@ret,$pid,0,@ret). Es müsste 3+@ret sein, weil Packet-ID, Properties-Länge und Reason Code zusammen 3+@ret Bytes ergeben.Nach der Änderung funktioniert es bei mir lampen lassen sich schalten bei meiner solaranlage steht zwar noch offline liegt aber vieleicht daran das es dunkel ist morgen früh weiß ich mehr.Die ausgabe mit orginal DEBUG:paho.mqtt.client:Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'unsub-test' properties=None
DEBUG:paho.mqtt.client:Received CONNACK (0, Success) properties=[SessionExpiryInterval : 0, MaximumQoS : 1, SubscriptionIdentifierAvailable : 1, SharedSubscriptionAvailable : 0]
CONNACK Success
DEBUG:paho.mqtt.client:Sending SUBSCRIBE (d0, m1) [(b'test/#', {QoS=1, noLocal=False, retainAsPublished=False, retainHandling=0})]
DEBUG:paho.mqtt.client:Received SUBACK
SUBACK ['Granted QoS 0']
DEBUG:paho.mqtt.client:Sending UNSUBSCRIBE (d0, m2) None [b'test/#']
DISCONNECT Unspecified error
DEBUG:paho.mqtt.client:Sending CONNECT (u1, p1, wr0, wq0, wf0, c0, k60) client_id=b'unsub-test' properties=None
DEBUG:paho.mqtt.client:Received CONNACK (0, Success) properties=[SessionExpiryInterval : 0, MaximumQoS : 1, SubscriptionIdentifierAvailable : 1, SharedSubscriptionAvailable : 0]
CONNACK Success
DEBUG:paho.mqtt.client:Sending SUBSCRIBE (d0, m3) [(b'test/#', {QoS=1, noLocal=False, retainAsPublished=False, retainHandling=0})]
DEBUG:paho.mqtt.client:Received SUBACK
SUBACK ['Granted QoS 0']
DEBUG:paho.mqtt.client:Sending UNSUBSCRIBE (d0, m4) None [b'test/#']
DISCONNECT Unspecified error
DEBUG:paho.mqtt.client:Sending CONNECT (u1, p1, wr0, wq0, wf0, c0, k60) client_id=b'unsub-test' properties=None
DEBUG:paho.mqtt.client:Received CONNACK (0, Success) properties=[SessionExpiryInterval : 0, MaximumQoS : 1, SubscriptionIdentifierAvailable : 1, SharedSubscriptionAvailable : 0]
CONNACK Success
DEBUG:paho.mqtt.client:Sending SUBSCRIBE (d0, m5) [(b'test/#', {QoS=1, noLocal=False, retainAsPublished=False, retainHandling=0})]
DEBUG:paho.mqtt.client:Received SUBACK
SUBACK ['Granted QoS 0']
DEBUG:paho.mqtt.client:Sending UNSUBSCRIBE (d0, m6) None [b'test/#']
DISCONNECT Unspecified error
DEBUG:paho.mqtt.client:Sending CONNECT (u1, p1, wr0, wq0, wf0, c0, k60) client_id=b'unsub-test' properties=None
DEBUG:paho.mqtt.client:Received CONNACK (0, Success) properties=[SessionExpiryInterval : 0, MaximumQoS : 1, SubscriptionIdentifierAvailable : 1, SharedSubscriptionAvailable : 0]
CONNACK Success
DEBUG:paho.mqtt.client:Sending SUBSCRIBE (d0, m7) [(b'test/#', {QoS=1, noLocal=False, retainAsPublished=False, retainHandling=0})]
DEBUG:paho.mqtt.client:Received SUBACK
SUBACK ['Granted QoS 0']
DEBUG:paho.mqtt.client:Sending UNSUBSCRIBE (d0, m8) None [b'test/#']
DISCONNECT Unspecified error
DEBUG:paho.mqtt.client:Sending CONNECT (u1, p1, wr0, wq0, wf0, c0, k60) client_id=b'unsub-test' properties=None
DEBUG:paho.mqtt.client:Received CONNACK (0, Success) properties=[SessionExpiryInterval : 0, MaximumQoS : 1, SubscriptionIdentifierAvailable : 1, SharedSubscriptionAvailable : 0]
CONNACK Success
DEBUG:paho.mqtt.client:Sending SUBSCRIBE (d0, m9) [(b'test/#', {QoS=1, noLocal=False, retainAsPublished=False, retainHandling=0})]
DEBUG:paho.mqtt.client:Received SUBACK
SUBACK ['Granted QoS 0']
DEBUG:paho.mqtt.client:Sending UNSUBSCRIBE (d0, m10) None [b'test/#']
DISCONNECT Unspecified error
und nach Änderung DEBUG:paho.mqtt.client:Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'unsub-test' properties=None
DEBUG:paho.mqtt.client:Received CONNACK (0, Success) properties=[SessionExpiryInterval : 0, MaximumQoS : 1, SubscriptionIdentifierAvailable : 1, SharedSubscriptionAvailable : 0]
CONNACK Success
DEBUG:paho.mqtt.client:Sending SUBSCRIBE (d0, m1) [(b'test/#', {QoS=1, noLocal=False, retainAsPublished=False, retainHandling=0})]
DEBUG:paho.mqtt.client:Received SUBACK
SUBACK ['Granted QoS 0']
DEBUG:paho.mqtt.client:Sending UNSUBSCRIBE (d0, m2) None [b'test/#']
DEBUG:paho.mqtt.client:Received UNSUBACK (Mid: 2)
UNSUBACK ['Success'] []
Zwei Kleinigkeiten fielen noch auf, gespeicherte nachrichten kommen bei Abos mit Wildcard mit Retain-Flag 0 an und in gespeicherten Discovery-Nachrichten von Zigbee2MQTT und OpenMQTTGateway fehlen die Backslashes in eingebetteten Strings
Script zum testen im Anhang