- 最新
- 最多得票
- 最多評論
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.
相關內容
- AWS 官方已更新 2 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 10 個月前
- AWS 官方已更新 3 年前
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}