By using AWS re:Post, you agree to the Terms of Use

Learn AWS faster by following popular topics

see all
1/18

Recent questions

see all
1/18

Modbus TCP adapter usage with greengrass V2

Hi, Am I able to use the Greengrass Modbus TCP Protocol Adapter in greengrass v2 as a component. I have a modbus device connected to my greengrass edge device with a fixed IP and trying to connect to it, however I am experiencing some errors in trying to connect to the device. Here is the log: 2022-08-19T15:09:11.351Z [INFO] (Copier) aws.greengrass.labs.ModbusTCP: stdout. Invoked shutdown hook.. {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=RUNNING} 2022-08-19T15:09:13.150Z [INFO] (Copier) aws.greengrass.labs.ModbusTCP: Run script exited. {exitCode=143, serviceName=aws.greengrass.labs.ModbusTCP, currentState=STOPPING} 2022-08-19T15:10:24.400Z [INFO] (pool-2-thread-17) aws.greengrass.labs.ModbusTCP: shell-runner-start. {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=STARTING, command=["java -jar C:\greengrass\v2\packages\artifacts\aws.greengrass.labs.ModbusTCP\1...."]} 2022-08-19T15:10:28.112Z [WARN] (Copier) aws.greengrass.labs.ModbusTCP: stderr. Aug 19, 2022 8:10:27 AM software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection$1 onConnectionSetup. {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=RUNNING} 2022-08-19T15:10:28.114Z [WARN] (Copier) aws.greengrass.labs.ModbusTCP: stderr. INFO: Socket connection \\.\pipe\NucleusNamedPipe-Cgreengrassv2:8033 to server result [AWS_ERROR_SUCCESS]. {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=RUNNING} 2022-08-19T15:10:28.401Z [WARN] (Copier) aws.greengrass.labs.ModbusTCP: stderr. Aug 19, 2022 8:10:28 AM software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection$1 onProtocolMessage. {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=RUNNING} 2022-08-19T15:10:28.402Z [WARN] (Copier) aws.greengrass.labs.ModbusTCP: stderr. INFO: Connection established with event stream RPC server. {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=RUNNING} 2022-08-19T15:10:29.139Z [WARN] (Copier) aws.greengrass.labs.ModbusTCP: stderr. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".. {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=RUNNING} 2022-08-19T15:10:29.140Z [WARN] (Copier) aws.greengrass.labs.ModbusTCP: stderr. SLF4J: Defaulting to no-operation (NOP) logger implementation. {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=RUNNING} 2022-08-19T15:10:29.141Z [WARN] (Copier) aws.greengrass.labs.ModbusTCP: stderr. SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.. {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=RUNNING} 2022-08-19T15:10:30.455Z [INFO] (Copier) aws.greengrass.labs.ModbusTCP: stdout. Connected: ModbusConfiguration(endpoints=[Endpoint(host=169.254.216.147, port=502, timeout=null, devices=[Device(name=PacketPower-41E4-0000-0000-0B23, unitId=0)])]). {scriptName=services.aws.greengrass.labs.ModbusTCP.lifecycle.Run, serviceName=aws.greengrass.labs.ModbusTCP, currentState=RUNNING} Here is my recipe: ``` { "RecipeFormatVersion": "2020-01-25", "ComponentName": "aws.greengrass.labs.ModbusTCP", "ComponentVersion": "1.0.0", "ComponentType": "aws.greengrass.generic", "ComponentDescription": "Modbus TCP protocol adapter", "ComponentPublisher": "Amazon", "ComponentConfiguration": { "DefaultConfiguration": { "Modbus": { "Endpoints": [ { "Host": "169.254.216.147", "Port": 502, "Devices": [ { "Name": "PacketPower-41E4-0000-0000-0B23", "UnitId": 0 } ] } ] }, "accessControl": { "aws.greengrass.ipc.pubsub": { "aws.greengrass.labs.ModbusTCP:pubsub:1": { "policyDescription": "Allows publish to all topics.", "operations": [ "aws.greengrass#PublishToTopic" ], "resources": [ "*" ] }, "aws.greengrass.labs.ModbusTCP:pubsub:2": { "policyDescription": "Allows subscribe to all topics.", "operations": [ "aws.greengrass#SubscribeToTopic" ], "resources": [ "*" ] } } } } }, "Manifests": [ { "Platform": { "os": "/linux|darwin/" }, "Name": "UNIX", "Lifecycle": { "Run": "java -jar {artifacts:path}/ModbusTCP-1.0.0.jar" }, "Artifacts": [ { "Uri": "s3://peamans-components/artifacts/com.gateway.modbustcp/ModbusTCP-1.0.0.jar", "Digest": "Nph2h/xpODOMC42ZKGEeslrQVXYsgfGD931GGkuKkiY=", "Algorithm": "SHA-256", "Unarchive": "NONE", "Permission": { "Read": "OWNER", "Execute": "NONE" } } ] }, { "Platform": { "os": "windows" }, "Name": "Windows", "Lifecycle": { "Run": "java -jar {artifacts:path}\\ModbusTCP-1.0.0.jar" }, "Artifacts": [ { "Uri": "s3://peamans-components/artifacts/com.gateway.modbustcp/ModbusTCP-1.0.0.jar", "Digest": "Nph2h/xpODOMC42ZKGEeslrQVXYsgfGD931GGkuKkiY=", "Algorithm": "SHA-256", "Unarchive": "NONE", "Permission": { "Read": "OWNER", "Execute": "NONE" } } ] } ], "Lifecycle": {} } ``` Thanks for any help!
0
answers
0
votes
9
views
asked 2 hours ago

AWS IoT Timestream Rule Action write: Problem with float and int values

Hello, we have some sensors that send multiple variables (temp, humidity, pressure) through the IoT core writing them to timestream and dynamoDB at the same time using an IoT rule (SQL 2016-03-23). We are having some problems with rejected values when trying to write those values. Cloudwatch says: ``` "failedAction": "TimestreamAction", "errorMessage": "Failed to write records to Timestream. The error received was 'One or more records have been rejected. See RejectedRecords for details. (Service: AmazonTimestreamWrite; Status Code: 419; Error Code: RejectedRecordsException; Request ID: xxx; Proxy: null), Rejected records: [{RecordIndex: 9, Reason: Measure name already has an assigned measure value type. Each measure name can have only one measure value type and cannot be changed.,}]'. Message arrived on mit/decoded, Action: timestream, Database: sensordata-timestream-db, Table: mit-timestream-table" ``` The natural type of the values is `double` and the first write in timestream defined that measurement with the correct type. The problem relies when some of the measurements are with decimal part equal to zero (which can be interpreted as an `int`), for example `13.0`. In this case Timestream detects it as an `int` instead of `double` and rejects the measurement. Reading the documentation and different questions here in re:Post, I saw that a possible solution is to cast the variable as double, but seems not be working. This is how we are casting it: ``` SELECT cast(event.payload_sensordata.Hum_SHT as double) as Hum_SHT .... FROM .... ``` Another way we have tested without luck is casting as `DECIMAL` instead of `double`. This is what we are seeing in both tables: ![Enter image description here](/media/postImages/original/IMcxwgiNJ3RMaxmJoljYSYLw) Any thoughts on how to solve this within the IoT rule? Thanks!
0
answers
0
votes
1
views
asked 3 hours ago

Recent articles

see all
1/10