- Le plus récent
- Le plus de votes
- La plupart des commentaires
Hello,
Based on the log which you provided there are no errors. Everything there is completely normal.
Are you experiencing problems, if so:
- What are you doing
- What did you expect to happen
- What actually happened
Hi Michael, Thanks for your reply. Love your videos! I suppose my next questions would be where do I go from here? I would like to get the below example to work.
Send Modbus TCP command using Greengrass IPC local messages You can send a command to Modbus device by publishing a request to the following topic.
modbus/request/{device name} Sample request { "id": "TestRequest", "function": "ReadCoils", "address": 1, "quantity": 1 }
However how do I achieve this? do I need to modify the Modbus TCP adapter recipe and add another artifact that handles the IPC messaging? I already have one that is doing my MQTT handling.. should I just add it into that one?
You can add this logic into your existing component, that design is up to you, I don't know what is best for you.
You do not modify the existing Modbus recipe. You create a new component, or update an existing component, to use the local pubsub IPC methods and perform the interaction with the modbus component.
If that's overly complicated, you definitely do not need to use the modbus component at all. Your component can run a modbus client and directly connect to whatever devices you want.
Hi,
I have successfully been able to connect to the modbus slave device, however I am unable to read the data. I tried using a command line modbus tool and it works, however when using the same addresses and count for the modbus component I am getting errors.
Here is the response of the modbus command tool:
C:\modpoll-3.10\win>modpoll -a 1 -c 1 -r 602 -m tcp 169.254.216.147
modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2021 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.
Protocol configuration: MODBUS/TCP, FC3
Slave configuration...: address = 1, start reference = 602, count = 1
Communication.........: 169.254.216.147, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, output (holding) register table
-- Polling slave... (Ctrl-C to stop)
[602]: 1204
-- Polling slave... (Ctrl-C to stop)
However when using this code
message = { "id": "TestRequest", "function": "ReadInputRegisters", "address": 602, "quantity": 1 }
on the modbus-TCP adapter I get this error:
com.gateway.mqtt: stdout. Successfully subscribed to topic: modbus/response/PacketPower-41E4-0000-0000-0B23.
com.gateway.mqtt: stdout. message, {"id": "TestRequest", "function": "ReadInputRegisters", "address": 602, "quantity": 1}.
com.gateway.mqtt: stdout. Successfully published to topic: modbus/request/PacketPower-41E4-0000-0000-0B23.
com.gateway.mqtt: stdout. Received modbus message:{"type":"ExceptionCode","id":"TestRequest","code":"IllegalDataAddress"}.
Contenus pertinents
- demandé il y a un an
- demandé il y a 7 mois
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 10 mois
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a un an
Hi Michael, Thanks for your reply. Love your videos! I suppose my next questions would be where do I go from here? I would like to get the below example to work.
Send Modbus TCP command using Greengrass IPC local messages You can send a command to Modbus device by publishing a request to the following topic.
modbus/request/{device name} Sample request { "id": "TestRequest", "function": "ReadCoils", "address": 1, "quantity": 1 }
However how do I achieve this? do I need to modify the Modbus TCP adapter recipe and add another artifact that handles the IPC messaging? I already have one that is doing my MQTT handling.. should I just add it into that one?
The documentation for the component tells you what to do (https://github.com/awslabs/aws-greengrass-labs-modbus-tcp-protocol-adapter#send-modbus-tcp-command-using-greengrass-ipc-local-messages).
"publishing a request to the following topic" = publish to topic (https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-publish-subscribe.html#ipc-operation-publishtotopic) "subscribing to the following topic" = subscribe to topic (https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-publish-subscribe.html#ipc-operation-subscribetotopic).
To use these IPC APIs, you must create your own component.