Small clarification of events versus inverter data.
This commit is contained in:
parent
fb756e943d
commit
69b488acc8
1 changed files with 2 additions and 1 deletions
3
main.go
3
main.go
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue