public function getPairedDevices($refresh = false)
    {
        if ($refresh === false) {
            $device = Discovery::lookupDevice('ip', $this->ip);
            if (isset($device['device']) && is_array($device['device'])) {
                return $device['device'];
            }
        }

        $service = $this->services['BridgeService']['serviceType'];
        $controlUrl = $this->services['BridgeService']['controlURL'];
        $method = 'GetEndDevices';
        $arguments = [
            'DevUDN'      => $this->getUDN($refresh),
            'ReqListType' => 'PAIRED_LIST'
        ];

        $rs = $this->client->request($controlUrl, $service, $method, $arguments);
        $rs = $this->unwrapResponse($rs);
        $rs = WemoClient::xmlToArray($rs['u:GetEndDevicesResponse']['DeviceLists']);

        // Standalone devices.
        $devices = $rs['DeviceLists']['DeviceList']['DeviceInfos'];
        if(static::isArrayAssoc($devices)) {
            $devices = $rs['DeviceLists']['DeviceList']['DeviceInfos']['DeviceInfo'];
        }
        foreach ($devices as $k => $d) {
            $d['IsGroupAction'] = 'NO';
            $devices[$k] = $d;
        }
        // Grouped devices.
        $groupedDeviceList = [];
        $groupedDevices = $rs['DeviceLists']['DeviceList']['GroupInfos'];
        if(static::isArrayAssoc($groupedDevices)) {
            $groupedDeviceList[] = $rs['DeviceLists']['DeviceList']['GroupInfos']['GroupInfo'];
        }
        foreach ($groupedDeviceList as $gd) {
            if(!empty($gd['GroupID']) && !empty($gd['GroupName']) && !empty($gd['GroupCapabilityValues'])) {
                $devices[] = [
                    'DeviceID'      => $gd['GroupID'],
                    'FriendlyName'  => $gd['GroupName'],
                    'CurrentState'  => $gd['GroupCapabilityValues'],
                    'productName'   => $gd['DeviceInfos']['DeviceInfo'][0]['productName'],
                    'IsGroupAction' => 'YES'
                ];
                if(isset($gd['DeviceInfos']) && isset($gd['DeviceInfos']['DeviceInfo'])){
                    foreach($gd['DeviceInfos']['DeviceInfo'] as $gdi){
                        $gdi['IsGroupAction'] = 'NO';
                        $devices[] = $gdi;
                    }
                }
            }
        }
        return $devices;
    }
public function getPairedDevices($refresh = false)
    {
        if ($refresh === false) {
            $device = Discovery::lookupDevice('ip', $this->ip);
            if (isset($device['device']) && is_array($device['device'])) {
                return $device['device'];
            }
        }

        $service = $this->services['BridgeService']['serviceType'];
        $controlUrl = $this->services['BridgeService']['controlURL'];
        $method = 'GetEndDevices';
        $arguments = [
            'DevUDN'      => $this->getUDN($refresh),
            'ReqListType' => 'PAIRED_LIST'
        ];

        $rs = $this->client->request($controlUrl, $service, $method, $arguments);
        $rs = $this->unwrapResponse($rs);
        $rs = WemoClient::xmlToArray($rs['u:GetEndDevicesResponse']['DeviceLists']);

        // Standalone devices.
        $devices = $rs['DeviceLists']['DeviceList']['DeviceInfos'];
        if(static::isArrayAssoc($devices)) {
            $devices = $rs['DeviceLists']['DeviceList']['DeviceInfos']['DeviceInfo'];
        }
        foreach ($devices as $k => $d) {
            $d['IsGroupAction'] = 'NO';
            $devices[$k] = $d;
        }
        // Grouped devices.
        $groupedDeviceList = [];
        $groupedDevices = $rs['DeviceLists']['DeviceList']['GroupInfos'];
        if(static::isArrayAssoc($groupedDevices)) {
            $groupedDeviceList[] = $rs['DeviceLists']['DeviceList']['GroupInfos']['GroupInfo'];
        }
        foreach ($groupedDeviceList as $gd) {
            if(!empty($gd['GroupID']) && !empty($gd['GroupName']) && !empty($gd['GroupCapabilityValues'])) {
                $devices[] = [
                    'DeviceID'      => $gd['GroupID'],
                    'FriendlyName'  => $gd['GroupName'],
                    'CurrentState'  => $gd['GroupCapabilityValues'],
                    'productName'   => $gd['DeviceInfos']['DeviceInfo'][0]['productName'],
                    'IsGroupAction' => 'YES'
                ];
                if(isset($gd['DeviceInfos']) && isset($gd['DeviceInfos']['DeviceInfo'])){
                    foreach($gd['DeviceInfos']['DeviceInfo'] as $gdi){
                        $gdi['IsGroupAction'] = 'NO';
                        $devices[] = $gdi;
                    }
                }
            }
        }
        return $devices;
    }
public function getPairedDevices ( $ refresh = false ) { if ( $ refresh === false ) { $ device = Discovery :: lookupDevice ( 'ip' , $ this -> ip ) ; if ( isset ( $ device [ 'device' ] ) && is_array ( $ device [ 'device' ] ) ) { return $ device [ 'device' ] ; } } $ service = $ this -> services [ 'BridgeService' ] [ 'serviceType' ] ; $ controlUrl = $ this -> services [ 'BridgeService' ] [ 'controlURL' ] ; $ method = 'GetEndDevices' ; $ arguments = [ 'DevUDN' => $ this -> getUDN ( $ refresh ) , 'ReqListType' => 'PAIRED_LIST' ] ; $ rs = $ this -> client -> request ( $ controlUrl , $ service , $ method , $ arguments ) ; $ rs = $ this -> unwrapResponse ( $ rs ) ; $ rs = WemoClient :: xmlToArray ( $ rs [ 'u:GetEndDevicesResponse' ] [ 'DeviceLists' ] ) ; // Standalone devices. $ devices = $ rs [ 'DeviceLists' ] [ 'DeviceList' ] [ 'DeviceInfos' ] ; if ( static :: isArrayAssoc ( $ devices ) ) { $ devices = $ rs [ 'DeviceLists' ] [ 'DeviceList' ] [ 'DeviceInfos' ] [ 'DeviceInfo' ] ; } foreach ( $ devices as $ k => $ d ) { $ d [ 'IsGroupAction' ] = 'NO' ; $ devices [ $ k ] = $ d ; } // Grouped devices. $ groupedDeviceList = [ ] ; $ groupedDevices = $ rs [ 'DeviceLists' ] [ 'DeviceList' ] [ 'GroupInfos' ] ; if ( static :: isArrayAssoc ( $ groupedDevices ) ) { $ groupedDeviceList [ ] = $ rs [ 'DeviceLists' ] [ 'DeviceList' ] [ 'GroupInfos' ] [ 'GroupInfo' ] ; } foreach ( $ groupedDeviceList as $ gd ) { if ( ! empty ( $ gd [ 'GroupID' ] ) && ! empty ( $ gd [ 'GroupName' ] ) && ! empty ( $ gd [ 'GroupCapabilityValues' ] ) ) { $ devices [ ] = [ 'DeviceID' => $ gd [ 'GroupID' ] , 'FriendlyName' => $ gd [ 'GroupName' ] , 'CurrentState' => $ gd [ 'GroupCapabilityValues' ] , 'productName' => $ gd [ 'DeviceInfos' ] [ 'DeviceInfo' ] [ 0 ] [ 'productName' ] , 'IsGroupAction' => 'YES' ] ; if ( isset ( $ gd [ 'DeviceInfos' ] ) && isset ( $ gd [ 'DeviceInfos' ] [ 'DeviceInfo' ] ) ) { foreach ( $ gd [ 'DeviceInfos' ] [ 'DeviceInfo' ] as $ gdi ) { $ gdi [ 'IsGroupAction' ] = 'NO' ; $ devices [ ] = $ gdi ; } } } } return $ devices ; }
Retrieves all paired bridge devices.

@param bool $refresh Set true to force device discovery

@return mixed
@throws \Exception
Retrieves all paired bridge devices .