General question about database model/Schema InfluxDB2.2

Hello everyone, :wink:

first of all thank you for the great forum and community here. I could already inform me strongly.
But at the moment i am a little bit confused. :upside_down_face:
I’ve been thinking about this for about a week now. Hope you can give me some thoughts about this. :wink:

I would like to measure the consumption of various devices in our company. For this we have relied on Shelly3EM, which also works quite well.
I am using MQTT and NodeRed to retrieve the values and write them to the Influxdb.

Currently Schema:

device
fields
values

For the time being, we are talking about 5 machines. Tendency increasing.
At the end I would like to reach naturally also a total value of all machines/consumers.

In the meantime, however, I come to more and more challenges, whereby I already doubt my scheme.

The Shelly delivers the “total value” per phase.
I have to aggregate this three phases and calculate the total consumption per device with the “last” value.

1.Question
I want to downsample the values. For this I have created different buckets. “ds-1m, ds-1h”, ds-1d", ds-1mo", ds-1y".
How can I differ to downsample different values the “mean” and with others the “last” value?
For example:

I want the “last” value of the “total_wh” but the “mean” of “voltage”.

How can I archive this?

Is it better to store the values as for example

wh
Volt
Ampere

??

Have a lot more questions about monthly/yearly charts in grafana, but let us start at the beginning.
:grinning:

Thank you very much!

Greetings
Haezer89

you can use Get started with InfluxDB tasks | InfluxDB OSS 2.0 Documentation
I am also using tasks to downsample the data and storing in different measurements and buckets.

You can run multiple tasks depending on your requirements and they will periodically store the data in respective buckets.

Thank you for your answer. Did already read this but still a little bit confused how to aggregate more devices with same unit. Have to read it again about the “Tags”.
Do you know if i need to add the timezone when i have to downsample?
At the moment i use

import “timezone” option location = timezone.location(name:“Europe/Berlin”)

and then in the Query in Grafana again. Not 100% sure if the value is right.

Should i leave it?

Thank you & have a nice day!

if you want to downsample the data and want to change the timezone in InfluxDB itself then you use timezone option from InfluxDB but if you want to show the data in a different time zone then change the time zone in Grafana.