Im trying to create a simple extra field in one of my items by adding it as “metadata” via the UI entering it as a “namespace”, is this the correct way of doing it?
The Item itself (being a motion sensor) is showing up with data in InfluxDB2 but now i decided i wanted to add an extra field in it such as “sensor_id” and adding it like i did in the above, does not show up in the fields or in any data under the motion sensor item in InfluxDB2 UI.
I restarted the server, i cleared Openhab cache, etc.. but still the metadata is not visible in InfluxDB2.
I can see that @s10 has entered the wrong namespace for the UI-based metadata.
The namespace needs to be influxdb.
Just have a look at the linked docs.
thanks, i changed it to influxDB2 and it picked it up, but it picked it up as a string. How can i change it into an integer or float number? because i want to be able to use 111 in the Y Axis. in the graph.
I’m not sure it is possible to change the tag to number, as it’s meant to be a string…
Maybe you can change the datatype on the fly when accessing the data?
I can do it on the fly in the query on InfluxDB2 like this:
....
|> map(fn: (r) => ({ r with _value: float(v: r.sensorId) }))
....
But I just dont know how much strain this can potentially cause the server for each motion sensor, each time any of them is detected?
Is there no other way to create metadata of an item to a numerical value that is not interpreted as a string?
I also would not prefer to create an extra item for every motion sensor and use a bunch of rules to get this small task done.
Yes and i said those items i have are strings. So i want to add a numerical value as metadata. Again, as i said… i can convert it on the fly in influxdb2, but is this the only way to do it? What about potential strain on the server each time the query runs?
Sorry i made a mistake. My motion sensors are of type Switch, but i need a metadata of type Number, because i want to display them all on ONE graph and have them labeled on the Y Axis, to do that i need to use them as a numerical value and map them to a label on Grafana.
Just like they do in this vid: https://www.youtube.com/watch?v=9AA86wQeY3U
Florian, is it or is not possible to create the namespace tag as a numerical value and not a string? For the purposes of using it in InfluxDB2 and Grafana.
If not, can you recommend another way to do this besides converting it on the fly within the influxdb2 query?