I’d like to find the date of my best solar production. I’ve just started exploring the InfluxDB addon and I can get as far as this query
SELECT max("value") AS "max_value" FROM "home_assistant"."autogen"."kWh" WHERE time > :dashboardTime: AND time < :upperDashboardTime: AND "friendly_name"='Solar Power Today' GROUP BY time(1d) FILL(null)
which shows a nice graph with dates on the x axis and kwh for the day on the y axis. (the entity gets added to constantly throughout the day and then zeroed just before midnight)
But now how do I find the date and value which are the max all-time? I mean, I can change the dates on the dashboard easily enough, but I don’t mean to search the entire graph for the past N years. Isn’t this something a database ought to be able to answer easily? I just can’t see it. Guessing several others have already done the same thing, right?
Have you checked TOP?
Yes, almost there. Doing this in the InfluxDB page in HA, the result is a graph with one data point, and if I hover it then sometimes it’ll tell me the value and date (sometimes hover doesn’t do that, I don’t know why). Do you know how I can make it just spit out text? I can download the CSV if there is no other way.
I’m not sure what you use to make graphs. I don’t have an influxdb page in HA, I use Grafana.
If you want the day of max production among the various days and your entity stores the daily energy, use this
SELECT max("value") FROM "kWh" WHERE ("entity_id"::tag = 'your entity') AND $timeFilter
You need to remove the GROUP BY.
How to display it, no idea.