Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
egekorkan authored Jul 26, 2024
1 parent b341418 commit e8cbe44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion things/elevator/modbus/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { parseArgs } = require('node:util')
require('dotenv').config()

const thingName = "modbus-elevator"
// The following is needed since the modbus library we use does not support localhost but does support 0.0.0.0
const hostname = process.env.HOSTNAME
? process.env.HOSTNAME === "localhost" ? "0.0.0.0" : process.env.HOSTNAME
: "0.0.0.0"
Expand Down Expand Up @@ -191,4 +192,4 @@ const serverTCP = new ServerTCP(vector, { host: hostname, port: portNumber, debu
serverTCP.on("socketError", function(err){
// Handle socket error if needed, can be ignored
console.error(err)
});
});

0 comments on commit e8cbe44

Please sign in to comment.