Connect to Modbus TCP using HomeyScript


I’m trying to create a HomeyScript to connect to our KOSTAL inverter via Modbus TCP to read data about the energy consummed from the battery for example.

However, it seems that the HomeyScript does not allow the Javascript require() function and I’m getting the following error back:

:x: Script Error
:warning: ReferenceError: require is not defined

  • at connect-to-modbus.js:1:13*
  • at process.processTicksAndRejections (node:internal/process/task_queues:95:5)*

Please advise.

Best regards,


1 Like

Not possible with Homeyscript (also not the intended use for Homeyscript), so you’ll have to look for an alternative (most likely write an app).

Thanks for the info Robert.

Best regards,