Comments (3)
Hi Sander,
I tried to replicate your issue on my side, however I didn't see the null exception you saw.
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"00017","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":84}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"00017","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":84}
Invalid TcpPort: , set to DefaultTcpPort: 502
Invalid RetryCount: , set to DefaultRetryCount: 10
Invalid RetryInterval: , set to DefaultRetryInterval: 50
Opening.../dev/ttyS0
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"17","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":85}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"17","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":85}
Invalid TcpPort: , set to DefaultTcpPort: 502
Invalid RetryCount: , set to DefaultRetryCount: 10
Invalid RetryInterval: , set to DefaultRetryInterval: 50
Opening.../dev/ttyS0
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"00017","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":86}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"00017","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":86}
Invalid TcpPort: , set to DefaultTcpPort: 502
Invalid RetryCount: , set to DefaultRetryCount: 10
Invalid RetryInterval: , set to DefaultRetryInterval: 50
Opening.../dev/ttyS0
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
Modbus exception code: 1
I will add extra check while loading the configuration, if the starting address is not specified with proper 5 digit or 6 digit format, the operation will be ignored.
from iot-edge-modbus.
update testing images as follow.
microsoft/azureiotedge-modbus-tcp:0.0.1-amd64
microsoft/azureiotedge-modbus-tcp:0.0.1-arm32v7
Please help to validate if the issue is resolved.
Thanks!
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","TcpPort":"502","RetryCount":"10","RetryInterval":"100","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"17","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":89}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","TcpPort":"502","RetryCount":"10","RetryInterval":"100","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"17","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":89}
Op01 has invalid StartAddress 17, remove from dictionary...
Opening.../dev/ttyS0
No valid operation in modbus session available!!
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","TcpPort":"502","RetryCount":"10","RetryInterval":"100","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"17","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"},"Op02":{"PollingInterval":"2000","UnitId":"1","StartAddress":"400020","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":90}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","TcpPort":"502","RetryCount":"10","RetryInterval":"100","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"17","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"},"Op02":{"PollingInterval":"2000","UnitId":"1","StartAddress":"400020","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":90}
Op01 has invalid StartAddress 17, remove from dictionary...
Opening.../dev/ttyS0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","TcpPort":"502","RetryCount":"10","RetryInterval":"100","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"4001","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"},"Op02":{"PollingInterval":"2000","UnitId":"1","StartAddress":"400020","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":91}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","TcpPort":"502","RetryCount":"10","RetryInterval":"100","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op01":{"PollingInterval":"2000","UnitId":"1","StartAddress":"4001","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"},"Op02":{"PollingInterval":"2000","UnitId":"1","StartAddress":"400020","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}}}},"$version":91}
Op01 has invalid StartAddress 4001, remove from dictionary...
Opening.../dev/ttyS0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","TcpPort":"502","RetryCount":"10","RetryInterval":"100","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op02":{"PollingInterval":"2000","UnitId":"1","StartAddress":"400020","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"},"Op01":null}}},"$version":92}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","TcpPort":"502","RetryCount":"10","RetryInterval":"100","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op02":{"PollingInterval":"2000","UnitId":"1","StartAddress":"400020","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"},"Op01":null}}},"$version":92}
Op01 is null, remove from dictionary...
Opening.../dev/ttyS0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op02":{"PollingInterval":"2000","UnitId":"1","StartAddress":"400020","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}},"TcpPort":null,"RetryCount":null,"RetryInterval":null}},"$version":93}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","HwId":"PowerMeter-0a:01:01:01:01:01","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","Operations":{"Op02":{"PollingInterval":"2000","UnitId":"1","StartAddress":"400020","Count":"2","CorrelationId":"MessageType1","DisplayName":"Voltage"}},"TcpPort":null,"RetryCount":null,"RetryInterval":null}},"$version":93}
Invalid TcpPort: , set to DefaultTcpPort: 502
Invalid RetryCount: , set to DefaultRetryCount: 10
Invalid RetryInterval: , set to DefaultRetryInterval: 50
Opening.../dev/ttyS0
400020: 1000
400021: 0
400020: 1000
400021: 0
400020: 1000
400021: 0
from iot-edge-modbus.
The updated module microsoft/azureiotedge-modbus-tcp:0.0.1-amd64 fixes my issue with the invalid start address.
I used thin device twin (as seen above, I added TcpPort, RetryCount, RetryInterval and CorrelationID to prevent the info lines).
"desired": {
"PublishInterval": "5000",
"SlaveConfigs": {
"Slave01": {
"SlaveConnection": "/dev/ttyS0",
"BaudRate": "9600",
"DataBits": "8",
"StopBits": "1",
"Parity": "NONE",
"FlowControl": "NONE",
"HwId": "Adam4168U1",
"Operations": {
"Op01": {
"PollingInterval": "5000",
"UnitId": "1",
"StartAddress": "00017",
"Count": "8",
"DisplayName": "Relays",
"CorrelationId": "Message8Coils"
}
},
"TcpPort": "502",
"RetryCount": "10",
"RetryInterval": "100"
}
}
When theis Module Twin is sent, is results in a good response. I get the values of the coils:
8/28/2018 10:47:47 PM> Device: [linux6900], Data:[{"machine":{"temperature":101.08185656174635,"pressure":10.123249481717938},"ambient":{"temperature":20.733080430064852,"humidity":25},"timeCreated":"2018-08-28T20:47:47.9496227Z"}]
8/28/2018 10:47:52 PM> Device: [linux6900], Data:[{"PublishTimestamp":"2018-08-28 20:47:52","Content":[{"HwId":"Adam4168U1","Data":[{"CorrelationId":"Message8Coils","SourceTimestamp":"2018-08-28 20:47:50","Values":[{"DisplayName":"Relays","Address":"00017","Value":"1"},{"DisplayName":"Relays","Address":"00018","Value":"0"},{"DisplayName":"Relays","Address":"00019","Value":"0"},{"DisplayName":"Relays","Address":"00020","Value":"0"},{"DisplayName":"Relays","Address":"00021","Value":"0"},{"DisplayName":"Relays","Address":"00022","Value":"0"},{"DisplayName":"Relays","Address":"00023","Value":"0"},{"DisplayName":"Relays","Address":"00024","Value":"0"}]}]}]}]Properties:
'content-type': 'application/edge-modbus-json'
So I change the 00017 into 17:
00024: 0
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","HwId":"Adam4168U1","Operations":{"Op01":{"PollingInterval":"5000","UnitId":"1","StartAddress":"17","Count":"8","DisplayName":"Relays","CorrelationId":"Message8Coils"}},"TcpPort":"502","RetryCount":"10","RetryInterval":"100"}},"$version":41}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","HwId":"Adam4168U1","Operations":{"Op01":{"PollingInterval":"5000","UnitId":"1","StartAddress":"17","Count":"8","DisplayName":"Relays","CorrelationId":"Message8Coils"}},"TcpPort":"502","RetryCount":"10","RetryInterval":"100"}},"$version":41}
Op01 has invalid StartAddress 17, remove from dictionary...
Opening.../dev/ttyS0
No valid operation in modbus session available!!
The response is ok. 17 is rejected.
So I switch back to 00017:
Desired property change:
{"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","HwId":"Adam4168U1","Operations":{"Op01":{"PollingInterval":"5000","UnitId":"1","StartAddress":"00017","Count":"8","DisplayName":"Relays","CorrelationId":"Message8Coils"}},"TcpPort":"502","RetryCount":"10","RetryInterval":"100"}},"$version":42}
Attempt to load configuration: {"PublishInterval":"5000","SlaveConfigs":{"Slave01":{"SlaveConnection":"/dev/ttyS0","BaudRate":"9600","DataBits":"8","StopBits":"1","Parity":"NONE","FlowControl":"NONE","HwId":"Adam4168U1","Operations":{"Op01":{"PollingInterval":"5000","UnitId":"1","StartAddress":"00017","Count":"8","DisplayName":"Relays","CorrelationId":"Message8Coils"}},"TcpPort":"502","RetryCount":"10","RetryInterval":"100"}},"$version":42}
Opening.../dev/ttyS0
00017: 1
00018: 0
00019: 0
00020: 0
00021: 0
00022: 0
00023: 0
And I get a good response with valid values again.
I do not have any issues anymore. The response is clear.
from iot-edge-modbus.
Related Issues (20)
- No longer being maintained HOT 2
- Invoke method not working without internet HOT 2
- ‘Operation timeout expired’ error HOT 1
- Exception Code 2 - StartAddress being passed as 0 HOT 4
- Modbus TCP problem with Siemens PAC2200
- Update to new iotedge version HOT 2
- modbus tcp connection refused on Raspberry pi 3 HOT 3
- Data not being recieved in IoT Central HOT 3
- Please update RTU configuration in Readme.md HOT 2
- Windows Container Modbus module on Windows 10 1809 LTS supports RTU? HOT 1
- Only device that contains lots of registers, how to organize data? HOT 2
- Error building image HOT 2
- Support for arm64v8 HOT 3
- Add content properties to the message sent to the output HOT 4
- REAL type value is not correct in the output HOT 3
- Signalizing slave communication error HOT 1
- The While loop in the Start method freezes, when the module has more than 500 active operations HOT 2
- Cannot read data from slave HOT 2
- IoT Central Device template for iot-edge-modbus module HOT 1
- Module healthy but no data received from the device HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iot-edge-modbus.