- Newest
- Most votes
- Most comments
The root cause for the issue is that you can't use the output of IoT SQL statements in substitution templates. So you can use SELECT state.reported.*
to generate an input for the Timestream action, but for dimension value you can only reference the device by ${state.reported.device}.
If for whatever reason you can't use ${state.reported.device} and need to use ${device} for dimension, the simplest way to work around here is to use "Republish" action with the content of SELECT state.reported.*
to another IoT Rule. To make it cost efficient you can republish to another IoT Rule using basic Ingest, e.g. using topic like $aws/rules/MyRule
. However, for your use case I am quite confident that the approach I describe above should work and you don' need a second IoT Rule.
Relevant content
- asked 6 months ago
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
Thanks for the answer. The problem is I'm targeting sensor's agnostic code, so each sensor might have a different name for it's sensors (i.e.; temperature, temperature_internal, temperature_external, temp, t1, etc.). Is there any way to target this use case?
Sorry AWS-User-SOS, the answer I provided was worded in a confusing way, I updated it to make it easier to understand. Is it fair to assume that "device" attribute is available in each message? If so, you approach will work if you replace
dimension value: ${device}
withdimension value: ${state.reported.device}