MatterVN / ModbusTCP2MQTT

Sungrow & SMA Solar Inverter addon for Home Assistant using mobusTCP
MIT License
69 stars 52 forks source link

Addon disconnects and MQTT broker socket error - username 'addons' #19

Closed scottgow closed 2 years ago

scottgow commented 2 years ago

I've been able to get the addon working however it disconnects at times and there is no real logic to why. After a review of the MQTT broker log I noticed the login below

1642395202: New client connected from 172.30.33.12 as ModbusTCP (p2, c1, k60, u'addons').

I've running the Mosquitto broker 6.0.1 and from all accounts appears you need to pass the correct auth otherwise you will get a socket error.

1642395266: Socket error on client ModbusTCP, disconnecting.

Which you can see resolves in a disconnection

Are we able to have options within the config to include

MQTT_USER MQTT_PASS MQTT_HOST MQTT_PORT

I believe this will resolve this issue, I note I also had System Bridge installed with the wrong username and password which resulted in the same socket error and disconnection message. Fixing the U/P fixed the socket error and you can see the correct username.

Hopefully this is an easy fix

shaunsull commented 2 years ago

Hi Scott - I had the same issue. I restarted ModbusTCP2MQTT and it fixed itself.

[https://github.com/TenySmart/ModbusTCP2MQTT/issues/18#issue-1105327750]

It's been okay now even after a few HA restarts. If it comes back again I'll put another comment here.