From d11a9eb38ddd3b50dfd4c1a9d8288c3b6860fe0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 8 Aug 2022 14:57:28 +0200 Subject: [PATCH] Perform init when the connection is reachable instead of connected. --- phoenixconnect/integrationpluginphoenixconnect.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phoenixconnect/integrationpluginphoenixconnect.cpp b/phoenixconnect/integrationpluginphoenixconnect.cpp index bccf398..c0e28f7 100644 --- a/phoenixconnect/integrationpluginphoenixconnect.cpp +++ b/phoenixconnect/integrationpluginphoenixconnect.cpp @@ -119,9 +119,9 @@ void IntegrationPluginPhoenixConnect::setupThing(ThingSetupInfo *info) } }); - connect(connection, &PhoenixModbusTcpConnection::connectionStateChanged, thing, [connection, thing](bool status){ - qCDebug(dcPhoenixContact()) << "Connection state changed" << status; - if (status) { + connect(connection, &PhoenixModbusTcpConnection::reachableChanged, thing, [connection, thing](bool reachable){ + qCDebug(dcPhoenixContact()) << "Reachable state changed" << reachable; + if (reachable) { connection->initialize(); } else { thing->setStateValue("connected", false);