Hello, I’m trying to integrate a value in (watt) from a mysql database, it works well so far. unfortunately the value stagnates from 10000. the value is then simply given as 10000 again and again in grafana. in the mqsql database it is the value already at 14766.869. I use this query
SELECT
UNIX_TIMESTAMP(TIMESTAMP) as time_sec,
CAST(VALUE AS DECIMAL(10, 6)) as value,
‘PM2.5’ as metric
FROM history
WHERE $__timeFilter(TIMESTAMP) AND DEVICE = 'PV_Summe ’ AND READING = ‘state’
ORDER BY TIMESTAMP ASC
I tried this adjustment and waited until the value was read again, but there was no change. These are my first attempts with grafana and mysql. Unfortunately I don’t understand what datatype value means, I import the value from an fhem instance into a mysql database. it is the yield of a solar system. The only thing i set is the datasource and the query code
Do you mean the specification of the data type
DECIMAL, NUMERIC
? Unfortunately I don’t really have a clue about the subject, I generate the output via home automation software (Fhem) I use a tool for this called DB Log. I’m trying to adjust the output of this tool, but unfortunately without success so far. After all, isn’t the category value decisive? there is no text in this one. Text is only in the Event section. I will now try again to change the decimal place in the output from Fhem, maybe that will bring me success. Thank you in advance for the help
Yes, you are absolutely right, but I don’t use this value with the included text at all. I use the value dummy in garafana, without AT, the value is 13268.561 there is no text here, the value with the text simply goes into the database, but is not used in grafana. I think the problem must be something else. Maybe the 3 digits after the decimal point are the problem. As soon as I have a solution I’ll let you know
Doesn’t really matter if you use that row or not, it indicates that the column does not a properly configured data type. all of the values within it are string. how do we know? because one of the values shows as string.
Hey, I try a lot of things with no success. finally i change the VALUE AS DECIMAL to 6,0 . After that all is fine and shown up correctly.
thank you very much for your patience and help.
UNIX_TIMESTAMP(TIMESTAMP) as time_sec,
CAST(VALUE AS DECIMAL(6,0)) as value,
‘PM2.5’ as metric
FROM history
WHERE $__timeFilter(TIMESTAMP) AND DEVICE = ‘PV_Summe’ AND READING = ‘state’
ORDER BY TIMESTAMP ASC