Hallo,
zur Geräteerkennung in einem Modul (Discovery Instanz) nutze ich die Methode ZC_QueryService.
private function DiscoverDevices()
{
$ids = IPS_GetInstanceListByModuleID(CORE_DNS_SD_GUID);
$devices = ZC_QueryServiceType($ids[0], '_bose-passport._tcp.', '');
$this->SendDebug(__FUNCTION__, print_r($devices, true), 0);
$existingDevices = [];
if (!empty($devices)) {
foreach ($devices as $device) {
$data = [];
$deviceInfos = ZC_QueryService($ids[0], $device['Name'], '_bose-passport._tcp.', 'local.');
$this->SendDebug(__FUNCTION__, print_r($deviceInfos, true), 0);
if (!empty($deviceInfos)) {
foreach ($deviceInfos as $info) {
if (empty($info['IPv4'])) {
$data['ip'] = $info['IPv6'][0];
} else {
$data['ip'] = $info['IPv4'][0];
}
$data['productName'] = (string) str_replace('._bose-passport._tcp.local', '', $info['Name']);
if (array_key_exists('TXTRecords', $info)) {
$txtRecords = $info['TXTRecords'];
foreach ($txtRecords as $record) {
if (strpos($record, 'PNAME=') !== false) {
$data['productType'] = (string) str_replace('PNAME=', '', $record);
}
if (strpos($record, 'GUID=') !== false) {
$data['productID'] = (string) str_replace('GUID=', '', $record);
}
}
}
array_push($existingDevices, $data);
}
}
}
}
return $existingDevices;
}
Auf meiner SymBox funktioniert das auch sehr gut und liefert mir die Geräte / Werte als Ergebnis.
Jedoch unter Windows 10 und Mac OS 10.15.7 werden keine Ergebnisse zurückgemeldet.
Dies ist in sofern unschön, da ja die Discovery Instanz für alle Plattformen funktionieren sollte.
Jemand eine Idee oder einen Tip?
Uli