From 21a83b5dacf2dd7a63c89ce5abf223c656fa6845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 4 Mar 2019 17:50:09 +0100 Subject: [PATCH] Disable netatmo timer only if there is no device left --- netatmo/devicepluginnetatmo.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/netatmo/devicepluginnetatmo.cpp b/netatmo/devicepluginnetatmo.cpp index 6f20a476..d8ace1be 100644 --- a/netatmo/devicepluginnetatmo.cpp +++ b/netatmo/devicepluginnetatmo.cpp @@ -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)