Node-Red-Influxdb with Shelly 3EM

Hello, I use Node-Red with the Shelly 3 EM energy meter. I can display the data in the dashboard via MQTT.
Question/ Problem: I write the data to the Influx DB database every 3 seconds.
I can then read them via: query ..msg.query=selct * ........ and display them in the dashboard.

Problem: I understand how to query values ​​for the last minute...hour.

But how is the query: if I want special days or a whole month. Example: a month that was many months ago.

Do I first have to create/write hourly values ​​in the Influxdb .. every 1h (how does that work) and then create the daily values ​​from the hourly values?
I would like to always evaluate my energy values ​​for a month (summarize)
Sorry for my bad English but I've been looking for solutions in German forums for weeks.

You don't need to have different time records in InfluxDB, that is kind of its selling point. Each record is a point in time, InfluxDB itself knows how to aggregate over different timespans using the built-in aggregators.

So what you need is something like an average function wrapped around your values.

The easiest way to do this by the way is to install Grafana. It has native support for InfluxDB so you can create and visualise the data using a point-and-click interface in Grafana. Then you can click a button to show the raw query that you can then use in Node-RED. Of course, lots of us can't be bothered with that and we leave our historical charts in Grafana where they look good and perform incredibly.