Skip to content

Commit

Permalink
Fix Modbus request timeout configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalle19 committed May 10, 2024
1 parent 8068f65 commit b7c202c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sensor/modbus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ export const getSensorData: PowerSensorPollFunction = async (
logger.info(`Connecting to ${sensorSettings.address}:${sensorSettings.port}...`)
await client.connectTCP(sensorSettings.address, {
port: sensorSettings.port,
// Connect timeout (probably)
timeout: requestTimeout,
})
client.setID(sensorSettings.unit)
// Request timeout
client.setTimeout(requestTimeout)
}

// Read the register and parse it accordingly
Expand Down

0 comments on commit b7c202c

Please sign in to comment.