How to add edit/add metadata to a stored variable in a bucket?

How to add edit/add metadata to a stored variable in a bucket?

Dear all,
I currently have an agricultural application, with sensors that collect soil information like humidity, temperature, etc. My devices send this data in hexadecimal and through a payload parser I get my variables. By doing this I generate my data with the structure { variable, value, unit, location(optional) }.

As I want to make the presentation of my dashboards more intuitive, I would like to be able to add the color, icon, x, y, url, etc. metadata. In order for me to decide what metadata value to add to my variable, I need to do an analysis, because I need to compare the values obtained with the thresholds that my user sets from an input widget. Finally I generate a new data, which is exactly the same as my original data, but has added the metadata I require for my dashboards. This solution that I have has the problem that it generates duplicate data, that is to say I have the original variable (that comes from the payload parser without metadata) and the new generated variable with metadata (this one has the same value and unit that the original one). Logically this solution greatly increases my storage usage.

What I want to do with my analysis is to be able to add the metadata to my existing variables, but so far I haven't figured out how to do it. Could you provide me with some example code to do this, I would be very grateful for your answers.