Example: I have a simple query that returns the maximum temperature my weather station has ever seen:
sensor:
- platform: influxdb
- name: "Record Max Temp"
unit_of_measurement: "°F"
measurement: "temp"
group_function: max
where: >-
"entity_id"='outside_temperature' AND time < now() GROUP BY "entity_id"
field: value
database: homeassistant
unique_id: sensor.influx.record_max_temp
This works great. However, I would like to know WHEN this record max temperature was recorded.
The time is already returned as part of the influxdb query. I was thinking a clean solution was simply to add this time as an attribute of the sensor value.
I believe, as a time series database, that every query with data includes a time value for the data.