From df76a84afe1afc0f94059cd05432ed1dbc26ceab Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 8 Nov 2019 12:41:17 +0100 Subject: [PATCH] Fix kodi plugin not reconnecting properly --- kodi/devicepluginkodi.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kodi/devicepluginkodi.cpp b/kodi/devicepluginkodi.cpp index 7a109a7d..b4403258 100644 --- a/kodi/devicepluginkodi.cpp +++ b/kodi/devicepluginkodi.cpp @@ -357,9 +357,18 @@ void DevicePluginKodi::onConnectionChanged(bool connected) } } - kodi->showNotification("nymea", tr("Connected"), 2000, "info"); - device->setStateValue(kodiConnectedStateTypeId, kodi->connected()); + + if (connected) { + kodi->showNotification("nymea", tr("Connected"), 2000, "info"); + } else { + if (!info) { + // This isn't a setup, we've been reconnected before, so try reconnecting in 5 secs + QTimer::singleShot(5000, kodi, [kodi](){ + kodi->connectKodi(); + }); + } + } } void DevicePluginKodi::onStateChanged()