From 69b488acc875eb8a59d3edc4fbfda3efa9acb6fc Mon Sep 17 00:00:00 2001 From: Pieter Hollander Date: Thu, 28 Mar 2024 14:33:33 +0100 Subject: [PATCH] Small clarification of events versus inverter data. --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 9cddad0..81ff617 100644 --- a/main.go +++ b/main.go @@ -211,6 +211,7 @@ func handleMessage(message []byte, db *sql.DB) { // Check conditions for recording data for _, inverter := range liveData.Inverters { + // Record events data if inverter.Events > 0 && inverter.Events > getPreviousEventsCount(db, inverter.Serial) { // Query the endpoint for events events, err := queryEventsEndpoint(inverter.Serial) @@ -222,7 +223,7 @@ func handleMessage(message []byte, db *sql.DB) { // Insert events data into the opendtu_events table insertEvents(db, inverter.Serial, events) } - + // Record inverter data if inverter.DataAge == 0 && inverter.Reachable { // Insert data into PostgreSQL tables insertLiveData(db, inverter, liveData.Total, liveData.Hints)