Try calling Connect
This commit is contained in:
parent
9039f13ae6
commit
d393a274aa
1 changed files with 4 additions and 1 deletions
5
main.go
5
main.go
|
@ -164,7 +164,10 @@ func scrape() error {
|
|||
|
||||
handler := modbus.TCPHandlerFromConnection(sgc)
|
||||
handler.SlaveId = 0x01
|
||||
//handler.Connect()
|
||||
if err := handler.Connect(); err != nil {
|
||||
return err
|
||||
}
|
||||
defer handler.Close()
|
||||
|
||||
client := modbus.NewClient(handler)
|
||||
|
||||
|
|
Loading…
Reference in a new issue