Hello everyone. I am new with InfluxDB 1.8 and Grafana and want to calculate the amount of power i am overproducing and selling. I have read out my smartmeter and got information from my Fronius inverter every second.
Thats the idea
To compare the usage with production and if there is a minus a want to add them. That i know how much power i sold and how much a consumed.
With Chatgpt i got the following code:
CREATE CONTINUOUS QUERY subtract_query ON Nodered BEGIN
SELECT A.field_A - B.field_A AS result INTO new_measurement
FROM measurement_A AS A
JOIN measurement_B AS B ON A.time = B.time
WHERE A.time >= now() - 1d
GROUP BY time(15m)
END;
If possible, it would be very nice to set the retention time for Measurement A and B on maybe 1 week or so.
I would be very gratefull if someone could ceck the and the idea - wheter it is correct and possible or not
Thank you for help