Skip to content

Commit a793ddc

Browse files
committed
Skip Netatmo sensor timeout check for Thermostats
1 parent 4db378a commit a793ddc

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

hardware/Netatmo.cpp

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -443,35 +443,39 @@ bool CNetatmo::ParseDashboard(const Json::Value &root, const int DevIdx, const i
443443

444444
int batValue = GetBatteryLevel(ModuleType, battery_percent);
445445

446-
std::time_t tNetatmoLastUpdate = 0;
447-
std::time_t tNow = time(NULL);
448-
449-
// initialize the relevant device flag
450-
if ( m_bNetatmoRefreshed.find(ID) == m_bNetatmoRefreshed.end() )
451-
{
452-
m_bNetatmoRefreshed[ID] = true;
453-
}
454-
// Check when dashboard data was last updated
455-
if ( !root["time_utc"].empty() )
456-
{
457-
tNetatmoLastUpdate = root["time_utc"].asUInt();
458-
}
459-
_log.Debug(DEBUG_HARDWARE, "Netatmo: Module [%s] last update = %s", name.c_str(), ctime(&tNetatmoLastUpdate));
460-
// check if Netatmo data was updated in the past 10 mins (+1 min for sync time lags)... if not means sensors failed to send to cloud
461-
if (tNetatmoLastUpdate > (tNow - 660))
446+
// check for Netatmo cloud data timeout, except if we deal with a thermostat
447+
if (ModuleType != "NATherm1")
462448
{
463-
if (!m_bNetatmoRefreshed[ID])
449+
std::time_t tNetatmoLastUpdate = 0;
450+
std::time_t tNow = time(NULL);
451+
452+
// initialize the relevant device flag
453+
if ( m_bNetatmoRefreshed.find(ID) == m_bNetatmoRefreshed.end() )
464454
{
465-
_log.Log(LOG_STATUS, "Netatmo: cloud data for module [%s] is now updated again", name.c_str());
466455
m_bNetatmoRefreshed[ID] = true;
467456
}
468-
}
469-
else
470-
{
471-
if (m_bNetatmoRefreshed[ID])
472-
_log.Log(LOG_ERROR, "Netatmo: cloud data for module [%s] no longer updated (module possibly disconnected)", name.c_str());
473-
m_bNetatmoRefreshed[ID] = false;
474-
return false;
457+
// Check when dashboard data was last updated
458+
if ( !root["time_utc"].empty() )
459+
{
460+
tNetatmoLastUpdate = root["time_utc"].asUInt();
461+
}
462+
_log.Debug(DEBUG_HARDWARE, "Netatmo: Module [%s] last update = %s", name.c_str(), ctime(&tNetatmoLastUpdate));
463+
// check if Netatmo data was updated in the past 10 mins (+1 min for sync time lags)... if not means sensors failed to send to cloud
464+
if (tNetatmoLastUpdate > (tNow - 660))
465+
{
466+
if (!m_bNetatmoRefreshed[ID])
467+
{
468+
_log.Log(LOG_STATUS, "Netatmo: cloud data for module [%s] is now updated again", name.c_str());
469+
m_bNetatmoRefreshed[ID] = true;
470+
}
471+
}
472+
else
473+
{
474+
if (m_bNetatmoRefreshed[ID])
475+
_log.Log(LOG_ERROR, "Netatmo: cloud data for module [%s] no longer updated (module possibly disconnected)", name.c_str());
476+
m_bNetatmoRefreshed[ID] = false;
477+
return false;
478+
}
475479
}
476480

477481
if (!root["Temperature"].empty())

0 commit comments

Comments
 (0)