ioBroker / ioBroker.modbus

Modbus adapter for ioBroker
MIT License
50 stars 28 forks source link

Write value no more possible with 3.4.2 - unknown function code: 134 #135

Closed 5G7K closed 3 years ago

5G7K commented 3 years ago

Describe the bug
With versions 3.2.6 it was possible to write values. Now with 3.4.2 following error message occurs:

modbus.0    2021-06-16 10:39:21.379 debug   (26828) Cleaning up request fifo.
modbus.0    2021-06-16 10:39:21.379 debug   (26828) Clearing timeout of the current request.
modbus.0    2021-06-16 10:39:21.371 info    (26828) Disconnected from slave
modbus.0    2021-06-16 10:39:21.190 debug   (26828) Poll holdingRegs DevID(2) address 1 - 20 bytes
modbus.0    2021-06-16 10:39:21.190 debug   (26828) Poll device 2
modbus.0    2021-06-16 10:39:20.371 error   (26828) Cannot write [265]: {"err":"timeout","timeout":5000}
modbus.0    2021-06-16 10:39:20.370 error   (26828) Request timed out.
modbus.0    2021-06-16 10:39:20.369 warn    (26828) Error: undefined
modbus.0    2021-06-16 10:39:15.392 error   (26828) unknown function code: 134
modbus.0    2021-06-16 10:39:15.362 debug   (26828) state Changed ack=false: modbus.0.holdingRegisters.40266_Dauer_Spitzendrehzahl_Küche: {"val":60,"ack":false,"ts":1623832755359,"q":0,"from":"system.adapter.linkeddevices.0","user":"system.use
modbus.0    2021-06-16 10:39:10.958 debug   (26828) Poll holdingRegs DevID(2) address 384 - 9 bytes
modbus.0    2021-06-16 10:39:10.881 debug   (26828) Poll holdingRegs DevID(2) address 336 - 16 bytes
modbus.0    2021-06-16 10:39:10.796 debug   (26828) Poll holdingRegs DevID(2) address 256 - 30 bytes
modbus.0    2021-06-16 10:39:10.717 debug   (26828) Poll holdingRegs DevID(2) address 1 - 20 bytes
modbus.0    2021-06-16 10:39:10.716 debug   (26828) Poll device 2
modbus.0    2021-06-16 10:39:00.488 debug   (26828) Poll holdingRegs DevID(2) address 384 - 9 bytes
modbus.0    2021-06-16 10:39:00.411 debug   (26828) Poll holdingRegs DevID(2) address 336 - 16 bytes
modbus.0    2021-06-16 10:39:00.329 debug   (26828) Poll holdingRegs DevID(2) address 256 - 30 bytes
modbus.0    2021-06-16 10:39:00.250 debug   (26828) Poll holdingRegs DevID(2) address 1 - 20 bytes
modbus.0    2021-06-16 10:39:00.249 debug   (26828) Poll device 2
Apollon77 commented 3 years ago

There are new settings to always use "Do not use "Write multiple registers\"" command or such to query ... maybe check if this helps to change that?

5G7K commented 3 years ago

Both options are unchecked. I tried both ones - always with the same result I downgraded to 3.3.1 and everything works fine with the same settings Log of 3.3.1

modbus.0 2021-06-16 14:12:17.216 debug (15863) Write successfully [265]: 72
modbus.0 2021-06-16 14:12:17.184 debug (15863) state Changed ack=false: modbus.0.holdingRegisters.40266_Dauer_Spitzendrehzahl_Küche: {"val":360,"ack":false,"ts":1623845537180,"q":0,"from":"system.adapter.linkeddevices.0","user":"system.use
modbus.0 2021-06-16 14:12:09.036 debug (15863) Poll holdingRegs DevID(2) address 384 - 9 bytes
modbus.0 2021-06-16 14:12:08.957 debug (15863) Poll holdingRegs DevID(2) address 336 - 16 bytes
modbus.0 2021-06-16 14:12:08.876 debug (15863) Poll holdingRegs DevID(2) address 256 - 30 bytes
modbus.0 2021-06-16 14:12:08.795 debug (15863) Poll holdingRegs DevID(2) address 1 - 20 bytes
modbus.0 2021-06-16 14:12:08.743 debug (15863) Poll device 2

2021-06-16 14_09_38-Clipboard

Edit: I have to set a read interval. see #132. But I also tried without Read interval while writing a value. same issue

GermanBluefox commented 3 years ago

I added in 3.4.3 some error codes. May be they will help to identify the problem

HJS72 commented 3 years ago

i've tested 3.4.4 with Option "Write multiple registers". Reading works fine, but when I try to write a Register I get following error:

(24322) Cannot write [550]: {"errorCode":134,"exceptionCode":1,"message":"ILLEGAL FUNCTION"}

5G7K commented 3 years ago

my test with 3.4.4.

2021-06-17 08:32:03.055 - debug: modbus.0 (13806) Redis Objects: Use Redis connection: 0.0.0.0:9001
2021-06-17 08:32:03.106 - debug: modbus.0 (13806) Objects client ready ... initialize now
2021-06-17 08:32:03.109 - debug: modbus.0 (13806) Objects create System PubSub Client
2021-06-17 08:32:03.110 - debug: modbus.0 (13806) Objects create User PubSub Client
2021-06-17 08:32:03.112 - debug: modbus.0 (13806) Objects client initialize lua scripts
2021-06-17 08:32:03.127 - debug: modbus.0 (13806) Objects connected to redis: 0.0.0.0:9001
2021-06-17 08:32:03.137 - debug: modbus.0 (13806) objectDB connected
2021-06-17 08:32:03.139 - debug: modbus.0 (13806) Redis States: Use Redis connection: 127.0.0.1:6379
2021-06-17 08:32:03.147 - debug: modbus.0 (13806) States create System PubSub Client
2021-06-17 08:32:03.149 - debug: modbus.0 (13806) States create User PubSub Client
2021-06-17 08:32:03.158 - debug: modbus.0 (13806) States connected to redis: 127.0.0.1:6379
2021-06-17 08:32:03.159 - debug: modbus.0 (13806) statesDB connected
2021-06-17 08:32:03.554 - debug: modbus.0 (13806) Plugin sentry Initialize Plugin (enabled=true)
2021-06-17 08:32:03.812 - info: modbus.0 (13806) starting. Version 3.4.4 in /opt/iobroker/node_modules/iobroker.modbus, node: v12.22.1, js-controller: 3.2.16

write a value with both options unchecked:

2021-06-17 08:32:16.050 - debug: modbus.0 (13806) Poll device 2
2021-06-17 08:32:16.052 - debug: modbus.0 (13806) Poll holdingRegs DevID(2) address 1 - 20 bytes
2021-06-17 08:32:16.160 - debug: modbus.0 (13806) Poll holdingRegs DevID(2) address 256 - 30 bytes
2021-06-17 08:32:16.267 - debug: modbus.0 (13806) Poll holdingRegs DevID(2) address 336 - 16 bytes
2021-06-17 08:32:16.375 - debug: modbus.0 (13806) Poll holdingRegs DevID(2) address 384 - 9 bytes
2021-06-17 08:32:22.343 - debug: modbus.0 (13806) state Changed ack=false: modbus.0.holdingRegisters.40267_Dauer_Boost: {"val":600,"ack":false,"ts":1623911542340,"q":0,"from":"system.adapter.linkeddevices.0","user":"system.user.admin","lc":1623911542340}
2021-06-17 08:32:22.371 - error: modbus.0 (13806) Error response for FCx6: Illegal Function
2021-06-17 08:32:22.372 - error: modbus.0 (13806) Error response: Function code received in the query is not recognized or allowed by slave
2021-06-17 08:32:22.849 - warn: modbus.0 (13806) Error: undefined
2021-06-17 08:32:22.849 - error: modbus.0 (13806) Request timed out.
2021-06-17 08:32:22.850 - error: modbus.0 (13806) Cannot write [266]: {"err":"timeout","timeout":500}
2021-06-17 08:32:23.851 - info: modbus.0 (13806) Disconnected from slave
2021-06-17 08:32:23.858 - debug: modbus.0 (13806) Clearing timeout of the current request.
2021-06-17 08:32:23.859 - debug: modbus.0 (13806) Cleaning up request fifo.

with option: without multiple register

2021-06-17 08:36:15.452 - debug: modbus.0 (19840) Poll device 2
2021-06-17 08:36:15.454 - debug: modbus.0 (19840) Poll holdingRegs DevID(2) address 1 - 20 bytes
2021-06-17 08:36:15.560 - debug: modbus.0 (19840) Poll holdingRegs DevID(2) address 256 - 30 bytes
2021-06-17 08:36:15.667 - debug: modbus.0 (19840) Poll holdingRegs DevID(2) address 336 - 16 bytes
2021-06-17 08:36:15.773 - debug: modbus.0 (19840) Poll holdingRegs DevID(2) address 384 - 9 bytes
2021-06-17 08:36:25.346 - debug: modbus.0 (19840) state Changed ack=false: modbus.0.holdingRegisters.40267_Dauer_Boost: {"val":600,"ack":false,"ts":1623911785344,"q":0,"from":"system.adapter.linkeddevices.0","user":"system.user.admin","lc":1623911785344}
2021-06-17 08:36:25.375 - error: modbus.0 (19840) Error response for FCx6: Illegal Function
2021-06-17 08:36:25.375 - error: modbus.0 (19840) Error response: Function code received in the query is not recognized or allowed by slave
2021-06-17 08:36:25.851 - warn: modbus.0 (19840) Error: undefined
2021-06-17 08:36:25.852 - error: modbus.0 (19840) Request timed out.
2021-06-17 08:36:25.853 - error: modbus.0 (19840) Cannot write [266]: {"err":"timeout","timeout":500}
2021-06-17 08:36:26.005 - debug: modbus.0 (19840) Poll device 2
2021-06-17 08:36:26.006 - debug: modbus.0 (19840) Poll holdingRegs DevID(2) address 1 - 20 bytes
2021-06-17 08:36:26.708 - warn: modbus.0 (19840) Poll error count: 1 code: "App Timeout"
2021-06-17 08:36:26.854 - info: modbus.0 (19840) Disconnected from slave
2021-06-17 08:36:26.865 - debug: modbus.0 (19840) Clearing timeout of the current request.
2021-06-17 08:36:26.866 - debug: modbus.0 (19840) Cleaning up request fifo.

with option: write only multiple register

2021-06-17 08:37:43.999 - debug: modbus.0 (22070) Poll device 2
2021-06-17 08:37:44.000 - debug: modbus.0 (22070) Poll holdingRegs DevID(2) address 1 - 20 bytes
2021-06-17 08:37:44.109 - debug: modbus.0 (22070) Poll holdingRegs DevID(2) address 256 - 30 bytes
2021-06-17 08:37:44.217 - debug: modbus.0 (22070) Poll holdingRegs DevID(2) address 336 - 16 bytes
2021-06-17 08:37:44.322 - debug: modbus.0 (22070) Poll holdingRegs DevID(2) address 384 - 9 bytes
2021-06-17 08:37:49.982 - debug: modbus.0 (22070) state Changed ack=false: modbus.0.holdingRegisters.40267_Dauer_Boost: {"val":600,"ack":false,"ts":1623911869978,"q":0,"from":"system.adapter.linkeddevices.0","user":"system.user.admin","lc":1623911869978}
2021-06-17 08:37:50.015 - error: modbus.0 (22070) Error response for FCx6: Illegal Function
2021-06-17 08:37:50.016 - error: modbus.0 (22070) Error response: Function code received in the query is not recognized or allowed by slave
2021-06-17 08:37:50.491 - warn: modbus.0 (22070) Error: undefined
2021-06-17 08:37:50.492 - error: modbus.0 (22070) Request timed out.
2021-06-17 08:37:50.493 - error: modbus.0 (22070) Cannot write [266]: {"err":"timeout","timeout":500}
2021-06-17 08:37:51.493 - info: modbus.0 (22070) Disconnected from slave
2021-06-17 08:37:51.501 - debug: modbus.0 (22070) Clearing timeout of the current request.
2021-06-17 08:37:51.502 - debug: modbus.0 (22070) Cleaning up request fifo.

Thank you for your support!

GermanBluefox commented 3 years ago

It will be always written with FC6.... no matter what options are set... Strange.

GermanBluefox commented 3 years ago

Please test 3.4.5

HJS72 commented 3 years ago

Test with Maico WS75 Powerbox (Write multiple registers only) was successful. Thanks for the very fast support.

5G7K commented 3 years ago

Test successful. Thank you very much!