stormmurdoc / victron_sdm630_bridge

MQTT-dbus Bridge for Victron CerboGX (Venus) and Eastron SDM630 Power Meter
MIT License
26 stars 7 forks source link

On MQTT disconnection, meter does not reconnect again. #4

Closed e-i-k-e closed 2 years ago

e-i-k-e commented 2 years ago

Hello, I have found that as soon as the MQTT connection is briefly interrupted, the meter does not reconnect independently. The value of the counter remains at the last value. Only a restart of VenusOS helps.

e-i-k-e commented 2 years ago

@stormmurdoc I would be very grateful if you could help me with this problem.

hleber commented 2 years ago

I have solved that by a script: run.sh ----- begin of file ----

!/bin/sh

while true; do
  /data/sdm630/sdm630-bridge
  sleep 1
done

---- end of file ----

and a change in the connectLostHandler

--- code change ---

var connectLostHandler mqtt.ConnectionLostHandler = func(client mqtt.Client, err
    log.Info(fmt.Sprintf("Connect lost: %v", err))
    os.Exit(1) /* THIS IS NEW */
}

--- end code change ---

When ever a connection ist lost, the service is starting again

stormmurdoc commented 2 years ago

Hi @hleber, thanks for your workaround. I've updated the source code and released version 0.2

stormmurdoc commented 2 years ago

@e-i-k-e Please try out the new workaround!

e-i-k-e commented 2 years ago

@e-i-k-e Please try out the new workaround!

Hello, it works.

Thank you! :)

stormmurdoc commented 2 years ago

Perfect! Thanks for the feedback.