Disable netatmo timer only if there is no device left

This commit is contained in:
Simon Stürz 2019-03-04 17:50:09 +01:00 committed by Michael Zanetti
parent 3f13275722
commit 21a83b5dac

View File

@ -117,12 +117,6 @@ void DevicePluginNetatmo::deviceRemoved(Device *device)
OAuth2 * authentication = m_authentications.key(device);
m_authentications.remove(authentication);
authentication->deleteLater();
if (m_pluginTimer) {
m_pluginTimer->deleteLater();
m_pluginTimer = nullptr;
}
} else if (device->deviceClassId() == indoorDeviceClassId) {
NetatmoBaseStation *indoor = m_indoorDevices.key(device);
m_indoorDevices.remove(indoor);
@ -132,6 +126,11 @@ void DevicePluginNetatmo::deviceRemoved(Device *device)
m_outdoorDevices.remove(outdoor);
outdoor->deleteLater();
}
if (myDevices().isEmpty() && m_pluginTimer) {
m_pluginTimer->deleteLater();
m_pluginTimer = nullptr;
}
}
DeviceManager::DeviceError DevicePluginNetatmo::executeAction(Device *device, const Action &action)