Skip to content

Commit

Permalink
Fixed GoodWeCommunicator isOnline check always resulted in sending an…
Browse files Browse the repository at this point in the history
… offline message to the inverter
  • Loading branch information
Jan ten Hove committed Jun 15, 2017
1 parent 2c71c34 commit ea7bffa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions GoodWeCommunicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ void GoodWeCommunicator::checkOfflineInverters()
//check inverter timeout
for (char index = 0; index < inverters.size(); ++index)
{
inverters[index].isOnline = (millis() - inverters[index].lastSeen < OFFLINE_TIMEOUT);
sendRemoveRegistration(inverters[index].address); //send in case the inverter thinks we are online
if (inverters[index].isOnline)
{
inverters[index].isOnline = (millis() - inverters[index].lastSeen < OFFLINE_TIMEOUT);
//check if inverter timed out
if(!inverters[index].isOnline)
sendRemoveRegistration(inverters[index].address); //send in case the inverter thinks we are online
}

}

}
Expand Down

0 comments on commit ea7bffa

Please sign in to comment.