HT-M02 Seperating Topics

I have a couple of M02 that will not allways have net connectivity. Each one will have a number of sensors using the AB02 broadcasting to the M02. The packets go from the AB02 to the M02 perfectly and appear under the topic application/999/device/+/rx in mosquitto on the M02.

in the json transmitted there is a “data” field that contains the temperature, voltage and an alert status.

What i would like to do is seperate these out and have them appear as their own topics similar to

I have another device that is on the wired side of the network that monitors these and will react based on the status and levels.

I am not sure if i do this in mosquitto by creating some sort of filter or is this done elsewhere?
it seems that most of the documentaion in relation to the M02 is using an external server such as TTN but in this case I am not able to use TTN as the network will not always be available.

Any ideas on this would be appreciated and any direction as to where I should be looking in the M02 for these config files to do this would be a huge help.

You can use “Custom JavaScript codec functions” to separate them, like this


Thank you, Yes I have managed to get that working directly on the M02 however what I was hoping to be able to do is publish (or re-publish) just the sensor data as a topic on the M02. Thank you for the codec example. it looks a lot nicer than my one :slight_smile:

initially i was having issues finding the config files to do this but ended up opening up a port forward in a telnet session to the M02 to port 8080 and that allowed me to pull up the application server.