how to publish mqtt messages to greengrass core devices from cloud via SDK for JavaScript?

0

Hi, I have a Greengrass core device publishing mqtt messages to AWS IoT Core and I want to send a confirmation to the same device but i couldn't find a way to do that. My idea was via Lambda process a message and send automatically a response to the device. Unfortunately I found many solutions to publish messages to IoT Core but not to the opossite, i mean, from IoT Core to the devices.

Thanks for any help, greetings!

질문됨 2년 전335회 조회
1개 답변
1
수락된 답변

Your Greengrass component needs to subscribe to messages from AWS IoT Core on a device specific topic, e.g fromcloud/device001, as described here.

If you just want to echo a message back to the device, you can use the AWS IoT Republishing action in the AWS IoT Rule Engine that triggers when a message arrives in AWS IoT on a topic e.g tocloud/device001 and republish it to a topic e.g fromcloud/device001 . You can use the AWS IoT Rule engine SQL function topic(2) to extract the device id from the topic name to construct the return topic.

If you trigger a Lambda function from the AWS IoT Rule Engine, you can use the iotdata.publish() REST method from one of our AWS SDKs to publish a message to the device specific topic fromcloud/device001

Hope that helps

profile pictureAWS
전문가
Jan_B
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠