Merge PR #265: Avahi Monitor: added address and port
commit
c33c9faaba
|
|
@ -60,7 +60,9 @@ void IntegrationPluginAvahiMonitor::setupThing(ThingSetupInfo *info)
|
||||||
if (info->thing()->paramValue(avahiThingServiceParamTypeId).toString() == entry.name() &&
|
if (info->thing()->paramValue(avahiThingServiceParamTypeId).toString() == entry.name() &&
|
||||||
info->thing()->paramValue(avahiThingHostNameParamTypeId).toString() == entry.hostName()) {
|
info->thing()->paramValue(avahiThingHostNameParamTypeId).toString() == entry.hostName()) {
|
||||||
info->thing()->setStateValue(avahiIsPresentStateTypeId, true);
|
info->thing()->setStateValue(avahiIsPresentStateTypeId, true);
|
||||||
info->thing()->setStateValue(avahiLastSeenTimeStateTypeId, QDateTime::currentDateTime());
|
info->thing()->setStateValue(avahiLastSeenTimeStateTypeId, QDateTime::currentDateTime().toString());
|
||||||
|
info->thing()->setStateValue(avahiAddressStateTypeId, entry.hostAddress().toString());
|
||||||
|
info->thing()->setStateValue(avahiPortStateTypeId, entry.port());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +112,9 @@ void IntegrationPluginAvahiMonitor::onServiceEntryAdded(const ZeroConfServiceEnt
|
||||||
if (thing->paramValue(avahiThingServiceParamTypeId).toString() == serviceEntry.name() &&
|
if (thing->paramValue(avahiThingServiceParamTypeId).toString() == serviceEntry.name() &&
|
||||||
thing->paramValue(avahiThingHostNameParamTypeId).toString() == serviceEntry.hostName()) {
|
thing->paramValue(avahiThingHostNameParamTypeId).toString() == serviceEntry.hostName()) {
|
||||||
thing->setStateValue(avahiIsPresentStateTypeId, true);
|
thing->setStateValue(avahiIsPresentStateTypeId, true);
|
||||||
thing->setStateValue(avahiLastSeenTimeStateTypeId, QDateTime::currentDateTime());
|
thing->setStateValue(avahiLastSeenTimeStateTypeId, QDateTime::currentDateTime().toString());
|
||||||
|
thing->setStateValue(avahiAddressStateTypeId, serviceEntry.hostAddress().toString());
|
||||||
|
thing->setStateValue(avahiPortStateTypeId, serviceEntry.port());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,22 @@
|
||||||
"type": "int",
|
"type": "int",
|
||||||
"unit": "UnixTime",
|
"unit": "UnixTime",
|
||||||
"defaultValue": 0
|
"defaultValue": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "db04b1ce-bc05-48b8-8012-bab97f3d0728",
|
||||||
|
"name": "address",
|
||||||
|
"displayName": "IP address",
|
||||||
|
"displayNameEvent": "IP address changed",
|
||||||
|
"type": "QString",
|
||||||
|
"defaultValue": "0.0.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "e98a4d9e-92e0-4d84-adf9-2693cf2cd714",
|
||||||
|
"name": "port",
|
||||||
|
"displayName": "Port",
|
||||||
|
"displayNameEvent": "Port changed",
|
||||||
|
"type": "int",
|
||||||
|
"defaultValue": "0"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue