NEWS
JavaScript adapter wont detect modbus-serial
-
I am trying to use the modbus-serial library so that I can automate the creation of new instances in iobroker when it detects a new TCP signal. However, for some reason it does not recognize that I have downloaded this module already. I have attached a screenshot for clarification.

I am doing this in the JavaScript adapter.
Any help would be greatly appreciated, thanks in advance.
-
@jack-3 do something with ModbusRTU, the error might only be visually(because of some restriction the sandbox has). Only if yo get additional errors when using the module you can tell the module is not loaded
-
@fastfoot I tried this code which I copied and edited from the modbus serial documentation and I am getting these errors

@jack-3 ok, thats a real error. Which version of JS-Adapter do you have? I think there is a bug in the newest Beta not installing modules that were entered in the instance config. Remove these lines, leave the config and enter them again. After leaving the config then have a look to the Log Tab, you schould see the that module(s) are getting installed.
Workaround on the cli:
- cd /opt/iobroker
- npm i modbus-serial
- js-adapter should recognize the module now, though the red underline might still be there
let us know, there should be no need to install module in /opt/iobroker/node_modules/iobroker.javascript instead of /opt/iobroker
-
@jack-3 ok, thats a real error. Which version of JS-Adapter do you have? I think there is a bug in the newest Beta not installing modules that were entered in the instance config. Remove these lines, leave the config and enter them again. After leaving the config then have a look to the Log Tab, you schould see the that module(s) are getting installed.
Workaround on the cli:
- cd /opt/iobroker
- npm i modbus-serial
- js-adapter should recognize the module now, though the red underline might still be there
let us know, there should be no need to install module in /opt/iobroker/node_modules/iobroker.javascript instead of /opt/iobroker
-
@fastfoot Thats the thing, I do not have an /opt/iobroker directory, it does not exist is what the terminal tells me
-
@jack-3 what system are you running iobroker, windows? There it schould be C:\iobroker. All Linux Systems use /opt/iobroker. Though not sure where tis is on a Mac
-
@jack-3 what system are you running iobroker, windows? There it schould be C:\iobroker. All Linux Systems use /opt/iobroker. Though not sure where tis is on a Mac
-
2024-07-09 09:07:46.559 - error: modbus.0 (604) Socket Error 2024-07-09 09:07:46.564 - error: modbus.0 (604) Client in error state. 2024-07-09 09:07:46.564 - warn: modbus.0 (604) On error: {"errno":-4039,"code":"ETIMEDOUT","syscall":"connect","address":"131.246.75.233","port":5020} 2024-07-09 09:07:46.592 - error: modbus.1 (12848) Socket Error 2024-07-09 09:07:46.601 - error: modbus.1 (12848) Client in error state. 2024-07-09 09:07:46.601 - warn: modbus.1 (12848) On error: {"errno":-4078,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":502} 2024-07-09 09:08:47.615 - error: modbus.1 (12848) Socket Error 2024-07-09 09:08:47.615 - error: modbus.1 (12848) Client in error state. 2024-07-09 09:08:47.615 - warn: modbus.1 (12848) On error: {"errno":-4078,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":502} 2024-07-09 09:09:08.775 - error: modbus.0 (604) Socket Error 2024-07-09 09:09:08.775 - error: modbus.0 (604) Client in error state. 2024-07-09 09:09:08.775 - warn: modbus.0 (604) On error: {"errno":-4039,"code":"ETIMEDOUT","syscall":"connect","address":"131.246.75.233","port":5020} 2024-07-09 09:09:12.133 - info: admin.0 (5516) ==> Connected system.user.admin from ::1 2024-07-09 09:09:12.221 - error: host.PCRT49 cannot call visUtils: Not exists 2024-07-09 09:09:18.930 - info: admin.0 (5516) ==> Connected system.user.admin from ::1 2024-07-09 09:09:21.197 - info: javascript.0 (12652) Start JavaScript script.js.Test (Javascript/js) 2024-07-09 09:09:21.206 - error: javascript.0 (12652) script.js.Test compile failed: at script.js.Test:4is that what you mean?