Fix to take into account user-defined timezone for insertEvents. Add multi OpenDTU TODO.
This commit is contained in:
parent
32bebfdca2
commit
014a5e85a2
1 changed files with 4 additions and 1 deletions
5
main.go
5
main.go
|
@ -4,6 +4,7 @@
|
||||||
// Idea: Gather settings only on start-up.
|
// Idea: Gather settings only on start-up.
|
||||||
// TODO: Only update meter readings such as yieldday, yieldtotal on-change.
|
// TODO: Only update meter readings such as yieldday, yieldtotal on-change.
|
||||||
// TODO: Add a health check endpoint, potentially log to it.
|
// TODO: Add a health check endpoint, potentially log to it.
|
||||||
|
// TODO: Add support for monitoring multiple OpenDTU's at once.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -563,7 +564,9 @@ func getPreviousEventsCount(db *sql.DB, inverterSerial string) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func insertEvents(db *sql.DB, inverterSerial string, events *EventsResponse) {
|
func insertEvents(db *sql.DB, inverterSerial string, events *EventsResponse) {
|
||||||
timestamp := time.Now()
|
timeZone := config.TZ
|
||||||
|
loc, _ := time.LoadLocation(timeZone)
|
||||||
|
timestamp := time.Now().In(loc)
|
||||||
|
|
||||||
for _, event := range events.Events {
|
for _, event := range events.Events {
|
||||||
// Insert events data into the events table
|
// Insert events data into the events table
|
||||||
|
|
Loading…
Reference in a new issue