Reputation:
I've set up a rule
SELECT * FROM '$aws/things/+/shadow/update/accepted'
This rule triggers my lambda function when the shadow of any thing in my AWS IoT updates.
Instead I want it to get triggered only when the shadows of some things are updated, not all of them. Any way I can do that?
Upvotes: 3
Views: 1449
Reputation: 132862
I recently learned that you can use functions to filter on parts of the topic, and something like this could potentially work for you:
SELECT *
FROM '$aws/things/+/shadow/update/accepted'
WHERE startswith(topic(3), 'someprefix-')
This would only trigger the action(s) when the part of the topic captured by the +
started with "someprefix-". You can use other functions to filter in other ways if a prefix does not work for you.
Upvotes: 2
Reputation: 9
Each individual device you have registered will have a specific /shadow/update/accepted topic that you can subscribe to. It should be easy as replacing the '+' in your topic with the name of the device.
The same topic is also listed in the 'Interact' section of each device in IoT Core.
Upvotes: 0