Skip to content

Pull device_id from json payload #155

@chuckb7

Description

@chuckb7

I have a json formatted message coming from Meshtastic that looks like the message below. I would like to use the json .from field as the device_id or a unique label/location that is associated with the payload data.

Since all of the sensors reporting have the MQTT topic of the gateway node, the .from field is the only way to distinguish .payload.* data from each sensor.

It appears that device_id and relabel regex both rely on the topic path, not anything within the json payload itself. Am I mis-reading the documentation? Is there another way to accomplish what I want? Would this be a new enhancement request?

{
"channel": 1,
"from": 1568714334,
"hop_start": 3,
"hops_away": 0,
"id": 202947538,
"payload": {
"current_ch1": 0,
"current_ch2": 25.6000003814697,
"current_ch3": 0,
"voltage_ch1": 0,
"voltage_ch2": 2.55999994277954,
"voltage_ch3": 0
},
"rssi": -33,
"sender": "!da6a55de",
"snr": 6.5,
"timestamp": 1732741620,
"to": 42937465,
"type": "telemetry"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions