Comment out debugging code.

This commit is contained in:
Pieter Hollander 2024-07-25 11:07:10 +02:00
parent 1dbea69f52
commit 77a59f814b
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg

View file

@ -214,6 +214,8 @@ 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 // Record events data
// Optional debugging code:
// log.Println("Events data:", "age", inverter.DataAge, "event number", inverter.Events, "previous event count", getPreviousEventsCount(db, inverter.Serial))
if inverter.DataAge == 0 && inverter.Events > 0 && inverter.Events > getPreviousEventsCount(db, inverter.Serial) { if inverter.DataAge == 0 && 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)
@ -472,6 +474,7 @@ func queryEventsEndpoint(inverterSerial string) (*EventsResponse, error) {
// Additionally, this function requires OpenDTU to be set to "Clear Eventlog at midnight" for each inverter. // Additionally, this function requires OpenDTU to be set to "Clear Eventlog at midnight" for each inverter.
// "Clear Eventlog at midnight" should be set to ON in "Inverter settings" -> "pencil" -> "Advanced". // "Clear Eventlog at midnight" should be set to ON in "Inverter settings" -> "pencil" -> "Advanced".
// To account for possible time drifts, the first and last 10 minutes of the day are excluded. // To account for possible time drifts, the first and last 10 minutes of the day are excluded.
//
// Longest day NL: sun up 4:16, sun down 22:50 // Longest day NL: sun up 4:16, sun down 22:50
// Shortest day NL: sun up 8:44, sun down 16:25 // Shortest day NL: sun up 8:44, sun down 16:25
func getPreviousEventsCount(db *sql.DB, inverterSerial string) int { func getPreviousEventsCount(db *sql.DB, inverterSerial string) int {