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)