Max, Min, Current from Values stored as String

Hello!
I have weather data saved to InfluxDB. All values such as temperature, humidity, are saved as strings (I know this is not ideal but this is how I have the data currently).
The visualization of the values in the graph is correct, but the Max, Minimum, Current, fields in the Legend are not displayed.

I did some research and found that Max, Min, Current, do not support String values. Someone suggested to use CONVERT or CAST in the SQL query to adjust the type of the values.

I tried this approach but I think I am missing something in my SQL query.

This is my panel:

Original query:
SELECT “value” FROM “mqtt_consumer” WHERE (“topic” = ‘weather_sensor/novo_hamburgo/rincao/casa/rua_parana/temp’) AND $timeFilter

The data it gets as result:

InfluxDB show measurements:
name: mqtt_consumer
fieldKey fieldType
-------- ---------
value string

I found this discussion where it seems to be possible to convert the value in the query, but I had no success: https://stackoverflow.com/questions/54771946/grafana-sql-query-convert-string-to-number

So, in short, it would be really great if I could make Min, Max, Current work by doing the value conversion in the SQL query, but I am lacking the SQL knowledge to write this query. Any help would be greatly appreciated!

I have the exact same issue, tried to implement your idea but I’m not sure how to build this query too.
I really don’t understand why the legend or the mouse over can’t display the values correctly while the graphic itself does.

Any help from the community on how to overcome this would be much appreciated.