Small clarification of events versus inverter data.
All checks were successful
Build Docker image / build (push) Successful in 1m14s
Build Golang packages / release (push) Successful in 2m8s

This commit is contained in:
Pieter Hollander 2024-03-28 14:33:33 +01:00
parent fb756e943d
commit 69b488acc8
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg

View file

@ -211,6 +211,7 @@ func handleMessage(message []byte, db *sql.DB) {
// Check conditions for recording data // Check conditions for recording data
for _, inverter := range liveData.Inverters { for _, inverter := range liveData.Inverters {
// Record events data
if inverter.Events > 0 && inverter.Events > getPreviousEventsCount(db, inverter.Serial) { if inverter.Events > 0 && inverter.Events > getPreviousEventsCount(db, inverter.Serial) {
// Query the endpoint for events // Query the endpoint for events
events, err := queryEventsEndpoint(inverter.Serial) events, err := queryEventsEndpoint(inverter.Serial)
@ -222,7 +223,7 @@ func handleMessage(message []byte, db *sql.DB) {
// Insert events data into the opendtu_events table // Insert events data into the opendtu_events table
insertEvents(db, inverter.Serial, events) insertEvents(db, inverter.Serial, events)
} }
// Record inverter data
if inverter.DataAge == 0 && inverter.Reachable { if inverter.DataAge == 0 && inverter.Reachable {
// Insert data into PostgreSQL tables // Insert data into PostgreSQL tables
insertLiveData(db, inverter, liveData.Total, liveData.Hints) insertLiveData(db, inverter, liveData.Total, liveData.Hints)