Feature request: per-field custom tags

Hi.

I’m using Temperature / Relative Humidity sensors. Using a custom payload decode function, I generate an object

objectJSON: {
  "humidity": 66,
  "temperature": 21.8
}

I can add tags to the device:

tags: {
    "location": "Room 42"
}

Thanks to Influx integration, I can send that data to an Influx database with the tags correctly set.

The feature I’m missing is the ability to set different tags per field. I see at least two reasons for this

  • add extra information, such as unit, or measure type
  • add a more friendly name to display instead of device_frmpayload_data_xxx

Something like

objectJSON: {
  "humidity": {"value": 66, "tags": {"unit": "%", "type": "Air relative humidity", "label": "Relative humidity"}}
  "temperature": {"value": 21.8, "tags": {"unit": "°C", "type": "Air temperature", "label": "Temperature"}}
}

or perhaps more likely

objectJSON: {
  "humidity": 66,
  "temperature": 21.8
},
per_field_tags: {
  "humidity": {"unit": "%", "type": "Air relative humidity", "label": "Relative humidity"},
  "temperature": {"unit": "°C", "type": "Air temperature", "label": "Temperature"}
}

To achieve this, it would take

  • A mechanism to define a tag mapping at device level. Not just tags, but tags that depend on the payload fields.
  • A modification to the Influx integration (and perhaps other integrations if applicable) to understand this.

Thoughts?

I can’t think of a workaround. I could hardcode stuff in the decode function and use two profiles and create two devices, except I can only create one device for a devEUI and I can only associate it to a single profile.