Try calling Connect

This commit is contained in:
Josh Deprez 2023-01-22 17:55:06 +11:00
parent 9039f13ae6
commit d393a274aa
Signed by: josh
SSH key fingerprint: SHA256:zZji7w1Ilh2RuUpbQcqkLPrqmRwpiCSycbF2EfKm6Kw

View file

@ -164,7 +164,10 @@ func scrape() error {
handler := modbus.TCPHandlerFromConnection(sgc) handler := modbus.TCPHandlerFromConnection(sgc)
handler.SlaveId = 0x01 handler.SlaveId = 0x01
//handler.Connect() if err := handler.Connect(); err != nil {
return err
}
defer handler.Close()
client := modbus.NewClient(handler) client := modbus.NewClient(handler)