1

What I want to have is to send some metrics from greengrass device to greengrass lambda function in the local network.

I'm using the subscribe mode of basicDiscovery.py to send some device metrics to the amazon greengrass core device and invoke the lambda function deployed on the core. The lambda function simply prints the event. My confusion is when I use a subscription from IoT Cloud -> lambda function it work's fine but It's not working when I configure a subscription from device -> lambda function.
Also when I disconnect the device the device from the internet (in case 1), it buffers the messages and sends them when it gets connected to the internet again. I know that I'm passing xxxxxxx.iot.us-west-2.amazonaws.com as the endpoint and it's accessible over the internet, but not sure how to have an endpoint for the core.

Mohammad Mazraeh
  • 1,044
  • 7
  • 12

2 Answers2

0

I have tried sending data from device to lambda and lambda to cloud.As per my understanding you have to take care of the following points: 1.The device that is connected to greengrass should be publishing data for a topic 2.For the same topic subscription has to created between device and lambda 3.To test this behavior,create another subscription between lambda and cloud

Reference:https://medium.com/tensoriot/aws-greengrass-on-raspberry-pi-creating-core-and-node-devices-707a38452293

0

I had the same problem.I tried to trigger a lambda function in Greengrass. If I created a subscription whose source was cloud and target was lambda. Then when I published a message to a topic with my device credentials, the lambda function was triggered.

But if the connection between greengrass and AWS was lost, the lambda function didn't trigger. I needed the lambda function to work even when greengrass didn't have connection with AWS.

So I think this issue can be fixed if I change the source of subscription to device.

However, if I create a subscription with source set as device itself, then publishing a message does not trigger the lambda function. Although I can get message from the topic.

rohanmehto2
  • 910
  • 1
  • 7
  • 19
Larry Xia
  • 1
  • 1