How to send mqtt messages in different topics to AWS IoT

Hi,

My device sends different sensor data at different frequencies, and I would want these messages to be forwarded to AWS IoT in different topics ex. “app_eui/dev_eui/topic1/up” and “app_eui/dev_eui/topic2/up”, so I can handle different data appropriately using AWS IoT rules. Appreciate any help on how to achieve this.

Thanks,
Sid

is that a LoRaWAN node connected to TTN ?

Yes, LoRaWAN node sending 2 different sets of data containing different sensor reading at different frequency (ex. 1 set sending once every hour and 1 set once every day). I need different mqtt topics for these sets to handle them differently in my AWS IoT rules.

@sidpat

Option 1:
It is still possible to filter messages based on payload criteria and take different actions on them. It requires two separate IoT rules with a query statement somewhere along these lines: SELECT * FROM 'app_eui/dev_eui/topic/up' WHERE field1 = 'blue' AND field2 = 'red'

Option 2:
Use your rule or rule similar to ones above to republish on a separate topic.

Let me know if this helps!

@ajackson_ww This will do the trick, at a slight extra cost. The rule SQL query would be SELECT * FROM 'app_id/devices/dev_id/up' WHERE NOT isUndefined(field1) and SELECT * FROM 'app_id/devices/dev_id/up' WHERE NOT isUndefined(field2) to handle different data sets.
Thanks.

1 Like