From 2a508e76b2b1a34297cfeacaf2a1998a03dbada0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Tue, 24 May 2022 17:49:26 +0200 Subject: [PATCH] Add host address state for webinterface reference --- keba/integrationpluginkeba.cpp | 5 +++-- keba/integrationpluginkeba.json | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/keba/integrationpluginkeba.cpp b/keba/integrationpluginkeba.cpp index a0d8b9f7..ccd0977d 100644 --- a/keba/integrationpluginkeba.cpp +++ b/keba/integrationpluginkeba.cpp @@ -163,9 +163,10 @@ void IntegrationPluginKeba::setupThing(ThingSetupInfo *info) if (!keba) return; - qCDebug(dcKeba()) << "Network device monitor reachable changed for" << thing->name() << reachable; + qCDebug(dcKeba()) << "Network device monitor for" << thing->name() << (reachable ? "is now reachable" : "is not reachable any more" ); if (reachable) { // Update address and refresh + thing->setStateValue("hostAddress", monitor->networkDeviceInfo().address().toString()); keba->setAddress(monitor->networkDeviceInfo().address()); refresh(thing, keba); } @@ -214,7 +215,6 @@ void IntegrationPluginKeba::postSetupThing(Thing *thing) } refresh(thing, keba); - } }); @@ -424,6 +424,7 @@ void IntegrationPluginKeba::setupKeba(ThingSetupInfo *info, const QHostAddress & qCDebug(dcKeba()) << "Setup finsihed successfully for" << thing << thing->params(); thing->setStateValue("connected", true); + thing->setStateValue("hostAddress", address.toString()); thing->setStateValue("firmware", report.firmware); thing->setStateValue("uptime", report.seconds / 60); }); diff --git a/keba/integrationpluginkeba.json b/keba/integrationpluginkeba.json index dc2b0445..35434757 100644 --- a/keba/integrationpluginkeba.json +++ b/keba/integrationpluginkeba.json @@ -335,6 +335,14 @@ "displayNameEvent": "Firmware changed", "type": "QString", "defaultValue": "" + }, + { + "id": "11501a4b-8b83-4b92-be3c-a714d507f158", + "name": "hostAddress", + "displayName": "Host address", + "displayNameEvent": "Host address changed", + "type": "QString", + "defaultValue": "http://127.0.0.1" } ], "actionTypes": [ @@ -580,6 +588,14 @@ "displayNameEvent": "Firmware changed", "type": "QString", "defaultValue": "" + }, + { + "id": "eef1d569-f383-4980-8cb8-06ccc5069b0b", + "name": "hostAddress", + "displayName": "Host address", + "displayNameEvent": "Host address changed", + "type": "QString", + "defaultValue": "http://127.0.0.1" } ], "actionTypes": [