Ips2apple

Dem muss ich mich anschliessen, heute neu eingerichtet und bekomme auch folgende Meldungen:

Could not load configuration form
Warning: 
Notice: Undefined property: stdClass::$content in /var/lib/symcon/modules/IPS2Apple/libs/FindMyiPhone.php on line 109

Warning: Invalid argument supplied for foreach() in /var/lib/symcon/modules/IPS2Apple/libs/FindMyiPhone.php on line 109
RESULT:a:0:{} in /var/lib/symcon/modules/IPS2Apple/IPS2AppleConfigurator/module.php on line 89

Notice: Undefined variable: ResultArray in /var/lib/symcon/modules/IPS2Apple/IPS2AppleConfigurator/module.php on line 111

Warning: count(): Parameter must be an array or an object that implements Countable in /var/lib/symcon/modules/IPS2Apple/IPS2AppleConfigurator/module.php on line 49
{"status":[{"code":101,"icon":"inactive","caption":"Instanz wird erstellt"},{"code":102,"icon":"active","caption":"Instanz ist aktiv"},{"code":104,"icon":"inactive","caption":"Instanz ist inaktiv"},{"code":202,"icon":"error","caption":"Kommunikationfehler!"}],"elements":[{"type":"SelectCategory","name":"Category","caption":"Zielkategorie"},{"type":"Label","caption":"_____________________________________________________________________________________________________"},{"type":"Configurator","name":"AppleDevices","caption":"Apple-Devices","rowCount":10,"delete":false,"sort":{"column":"Device","direction":"ascending"},"columns":[{"caption":"Modell","name":"Device","width":"100px","visible":true},{"caption":"Name","name":"Name","width":"auto","visible":true}],"values":[]}]} (Code: -32603)

Scheint mir aber ein generelles Problem zu sein, mit dem anderen Modul ( Find my iPhone ) bekomme ich auch keine Daten mehr rein, allerdings ohen Fehlermeldungen.

Das Debug meldet:

07/11/2022, 03:30:18 PM | GetData | „wrong credentials“

Ich habs sowohl mit dem Original-Passwort / Account wie auch mit einem Anwendungsspezifischen Passwort probiert, gleiches Verhalten

Die Ursache des Problems ist, dass die minimum Anforderungen an den Zugriff zur Apple Icloud höher geworden sind.

In meinem Modul habe ich das in der Beta Version gefixt. Die Stable Version ist abgeleht worden, da ich im Konfigurator noch einiges anpassen muss.
Ich denke dass ich heute Abend die nochmal als Stable einreichen kann.

Gruß

Danke schon mal dafür.

Ich habs bei mir vorsichtshalber deaktiviert, bevor mir die ständigen Anfragen den Account sperren :slight_smile:

Hallo,
ich benutze lediglich das Script „findmyiphone“ und „IPS2Apple“.
Können diese weiterhin verwendet werden bzw. was muss hierbei angepasst werden??
Vielen Dank für Hinweise!

Du musst die findmyiphone.php anpassen.


<?php

/**
 * FindMyiPhone - A PHP class for interacting with iCloud's Find My iPhone.
 * Copyright (c) 2013 Neal <neal@ineal.me>
 */

class FindMyiPhone {

    private $username;
    private $password;

    public $devices = array();

    private $email_updates = false;

    private $host = 'fmipmobile.icloud.com';
    private $scope;

    private $client_context = array(
	'appName' => 'FindMyiPhone',
	'appVersion' => '5.0',
	'buildVersion' => '376',
	'clientTimestamp' => 0,
	'deviceUDID' => null,
	'inactiveTime' => 1,
	'osVersion' => '15.0',
	'productType' => 'iPhone12,8'
	);

    private $server_context = array(
        'callbackIntervalInMS' => 10000,
        'classicUser' => false,
        'clientId' => null,
        'cloudUser' => true,
        'deviceLoadStatus' => '200',
        'enableMapStats' => false,
        'isHSA' => false,
        'lastSessionExtensionTime' => null,
        'macCount' => 0,
        'maxDeviceLoadTime' => 60000,
        'maxLocatingTime' => 90000,
        'preferredLanguage' => 'en-us',
        'prefsUpdateTime' => 0,
        'sessionLifespan' => 900000,
        'timezone' => null,
        'trackInfoCacheDurationInSecs' => 86400,
        'validRegion' => true
    );


    /**
     * Constructor
     * Checks requred extensions, sets username/password and gets url host for the user.
     * @param $username - iCloud Apple ID
     * @param $password - iCloud Password
     */
    public function __construct($username, $password) {
        if (!extension_loaded('curl')) {
            throw new FindMyiPhoneException('PHP extension cURL is not loaded.');
        }

        $this->username = $username;
        $this->password = $password;

        $this->init_client();
    }


    /**
     * Set email updates
     * If false, requests will request to not send email to the user. (doesn't work on all requests)
     * True by default. (optional to set)
     * $param $email_updates - bool
     */
    public function set_email_updates($email_updates) {
        $this->email_updates = (bool) $email_updates;
    }


    /**
     * Init Client
     *
     */
    private function init_client() {
        $post_data = json_encode(array(
            'clientContext' => $this->client_context
        ));

        $headers = $this->parse_curl_headers($this->make_request('initClient', $post_data, true));

        #$this->host = $headers['X-Apple-MMe-Host'];
        #$this->scope = $headers['X-Apple-MMe-Scope'];
        $this->scope = $this->username;

        $this->refresh_client();
    }


    /**
     * Refresh Client
     *
     */
    public function refresh_client() {
        $post_data = json_encode(array(
            'clientContext' => $this->client_context,
            'serverContext' => $this->server_context
        ));

        foreach (json_decode($this->make_request('refreshClient', $post_data))->content as $id => $device) {
            $this->devices[$id] = $device;
        }
    }


    /**
     * Play Sound
     *
     */
    public function play_sound($device_id, $subject = 'Find My iPhone Alert') {
        if(!is_string($device_id)) throw new FindMyiPhoneException('Expected $device_id to be a string');
        if(!is_string($subject)) throw new FindMyiPhoneException('Expected $subject to be a string');

        $post_data = json_encode(array(
            'clientContext' => $this->client_context,
            'serverContext' => $this->server_context,
            'device' => $device_id,
            'subject' => $subject
        ));

        return json_decode($this->make_request('playSound', $post_data))->content[0]->snd;
    }


    /**
     * Send Message
     *
     */
    public function send_message($device_id, $text, $sound = false, $subject = 'Important Message') {
        if(!is_string($device_id)) throw new FindMyiPhoneException('Expected $device_id to be a string');
        if(!is_string($text)) throw new FindMyiPhoneException('Expected $text to be a string');
        if(!is_bool($sound)) throw new FindMyiPhoneException('Expected $sound to be a bool');
        if(!is_string($subject)) throw new FindMyiPhoneException('Expected $subject to be a string');

        $post_data = json_encode(array(
            'clientContext' => $this->client_context,
            'serverContext' => $this->server_context,
            'device' => $device_id,
            'emailUpdates' => $this->email_updates,
            'sound' => $sound,
            'subject' => $subject,
            'text' => $text,
            'userText' => true
        ));

        return json_decode($this->make_request('sendMessage', $post_data))->content[0]->msg;
    }


    /**
     * Lock Device
     *
     */
    public function lost_device($device_id, $passcode, $owner_phone_number = '911', $sound = true, $text = 'This iPhone has been lost. Please call me.') {
        if(!is_string($device_id)) throw new FindMyiPhoneException('Expected $device_id to be a string');
        if(!is_string($passcode)) throw new FindMyiPhoneException('Expected $passcode to be a string');
        if(strlen($passcode) !== 4) throw new FindMyiPhoneException('Expected $passcode to be 4 characters long');
        if(!is_string($owner_phone_number)) throw new FindMyiPhoneException('Expected $owner_phone_number to be a string');
        if(!is_bool($sound)) throw new FindMyiPhoneException('Expected $sound to be a bool');
        if(!is_string($text)) throw new FindMyiPhoneException('Expected $text to be a string');

        $post_data = json_encode(array(
            'clientContext' => $this->client_context,
            'serverContext' => $this->server_context,
            'device' => $device_id,
            'emailUpdates' => $this->email_updates,
            'lostModeEnabled' => true,
            'ownerNbr' => $owner_phone_number,
            'passcode' => $passcode,
            'sound' => $sound,
            'text' => $text,
            'trackingEnabled' => true,
            'userText' => true
        ));

        return json_decode($this->make_request('lostDevice', $post_data))->content[0]->lostDevice;
    }


    /**
     * Notify When Found
     *
     */
    public function notify_when_found($device_id, $notify = true) {
        if(!is_string($device_id)) throw new FindMyiPhoneException('Expected $device_id to be a string');
        if(!is_string($notify)) throw new FindMyiPhoneException('Expected $notify to be a boolean');

        $post_data = json_encode(array(
            'clientContext' => $this->client_context,
            'serverContext' => $this->server_context,
            'device' => $device_id,
            'lostModeEnabled' => $notify
        ));

        return json_decode($this->make_request('saveLocFoundPref', $post_data))->content[0]->locFoundEnabled;
    }


    /**
     * Lock and Message
     *
     */
    public function lock_and_message($device_id, $passcode, $text, $sound = true, $title = 'Find My iPhone Alert') {
        if(!is_string($device_id)) throw new FindMyiPhoneException('Expected $device_id to be a string');
        if(!is_string($passcode)) throw new FindMyiPhoneException('Expected $passcode to be a string');
        if(strlen($passcode) !== 4) throw new FindMyiPhoneException('Expected $passcode to be 4 characters long');
        if(!is_string($text)) throw new FindMyiPhoneException('Expected $text to be a string');
        if(!is_bool($sound)) throw new FindMyiPhoneException('Expected $sound to be a bool');
        if(!is_string($title)) throw new FindMyiPhoneException('Expected $title to be a string');

        $post_data = json_encode(array(
            'clientContext' => $this->client_context,
            'serverContext' => $this->server_context,
            'device' => $device_id,
            'emailUpdates' => $this->email_updates,
            'passcode' => $passcode,
            'sound' => $sound,
            'text' => $text,
            'title' => $title,
            'userText' => true
        ));

        return json_decode($this->make_request('lockAndMessage', $post_data))->content[0]->remoteLock;
    }


    /**
     * Remote Lock
     *
     */
    public function remote_lock($device_id, $passcode) {
        if(!is_string($device_id)) throw new FindMyiPhoneException('Expected $device_id to be a string');
        if(!is_string($passcode)) throw new FindMyiPhoneException('Expected $passcode to be a string');
        if(strlen($passcode) !== 4) throw new FindMyiPhoneException('Expected $passcode to be 4 characters long');

        $post_data = json_encode(array(
            'clientContext' => $this->client_context,
            'serverContext' => $this->server_context,
            'device' => $device_id,
            'emailUpdates' => $this->email_updates,
            'passcode' => $passcode
        ));

        return json_decode($this->make_request('remoteLock', $post_data))->content[0]->remoteLock;
    }


    /**
     * Remote Wipe
     *
     */
    public function remote_wipe($device_id, $passcode, $text) {
        if(!is_string($device_id)) throw new FindMyiPhoneException('Expected $device_id to be a string');
        if(!is_string($passcode)) throw new FindMyiPhoneException('Expected $passcode to be a string');
        if(strlen($passcode) !== 4) throw new FindMyiPhoneException('Expected $passcode to be 4 characters long');
        if(!is_string($text)) throw new FindMyiPhoneException('Expected $text to be a string');

        $post_data = json_encode(array(
            'clientContext' => $this->client_context,
            'serverContext' => $this->server_context,
            'device' => $device_id,
            'passcode' => $passcode,
            'text' => $text,
            'emailUpdates' => $this->email_updates
        ));

        return json_decode($this->make_request('remoteWipe', $post_data))->content[0]->remoteWipe;
    }


    /**
     * Locate Device
     *
     */
    public function locate_device($device, $timeout = 120) {
        if(!is_integer($device)) throw new FindMyiPhoneException('Expected $device to be an integer');
        if(!isset($this->devices[$device])) $this->refresh_client();

        $start = time();
        while (!$this->devices[$device]->location->locationFinished) {
            if ((time() - $start) > intval($timeout)) {
                throw new FindMyiPhoneException('Failed to locate device! Request timed out.');
            }
            sleep(5);
            $this->refresh_client();
        }

        return $this->devices[$device]->location;
    }


    /**
     * Make request to the Find My iPhone server.
     * @param $method - the method
     * @param $post_data - the POST data
     * @param $return_headers - also return headers when true
     * @param $headers - optional headers to send
     * @return HTTP response
     */
    private function make_request($method, $post_data, $return_headers = false, $headers = array()) {
        if(!is_string($method)) throw new FindMyiPhoneException('Expected $method to be a string');
        if(!$this->is_json($post_data)) throw new FindMyiPhoneException('Expected $post_data to be json');
        if(!is_array($headers)) throw new FindMyiPhoneException('Expected $headers to be an array');
        if(!is_bool($return_headers)) throw new FindMyiPhoneException('Expected $return_headers to be a bool');
        if(!isset($this->scope)) $this->scope = $this->username;

        array_push($headers, 'Accept-Language: en-us');
        array_push($headers, 'Content-Type: application/json; charset=utf-8');
        array_push($headers, 'X-Apple-Realm-Support: 1.0');
        array_push($headers, 'X-Apple-Find-Api-Ver: 3.0');
        array_push($headers, 'X-Apple-Authscheme: UserIdGuest');

        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_TIMEOUT => 9,
            CURLOPT_CONNECTTIMEOUT => 5,
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_AUTOREFERER => true,
            CURLOPT_VERBOSE => false,
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => $post_data,
            CURLOPT_HTTPHEADER => $headers,
            CURLOPT_HEADER => $return_headers,
            CURLOPT_URL => sprintf("https://%s/fmipservice/device/%s/%s", $this->host, $this->scope, $method),
            CURLOPT_USERPWD => $this->username . ':' . $this->password,
            CURLOPT_USERAGENT => 'FindMyiPhone/376 CFNetwork/672.0.8 Darwin/14.0.0'
        ));

        $http_result = curl_exec($curl);
        curl_close($curl);

        return $http_result;
    }


    /**
     * Parse cURL headers
     * @param $response - cURL response including the headers
     * @return array of headers
     */
    private function parse_curl_headers($response) {
        $headers = array();
        foreach (explode("\r\n", substr($response, 0, strpos($response, "\r\n\r\n"))) as $i => $line) {
            if ($i === 0) {
                $headers['http_code'] = $line;
            } else {
                list($key, $value) = explode(': ', $line);
                $headers[$key] = $value;
            }
        }
        return $headers;
    }

    /**
     * Finds whether a variable is json.
     */
    private function is_json($var) {
        json_decode($var);
        return (json_last_error() == JSON_ERROR_NONE);
    }
}

class FindMyiPhoneException extends Exception {}

?>

Mit dem Update von „findmyiphone“ von heute funktioniert die Abfrage bei iCloud wieder. Habs gerade neu eingerichtet.

Hi, worin liegt denn der Unterschied zwischen deinem Modul aus dem Store „Find my IPhone“ und dem Modul von @JPaeperIPS2Apple“ ?

Das von jPaper ist, so wie es auf dem ersten Blick aussieht veraltet und wird nicht laufen. Ich benutze zB nur die findmyiphone.php und hole die Daten selber aus der iCloud mit einem Script.

Ich bekomme weiterhin eine Fehlermeldung, aber die Abfrage funktioniert trotzdem.

richimaint

…aktuell habe ich leider sehr wenig Zeit mich darum zu kümmern. Der Hinweis was man in der Klasse verändern muss ist aber schon mal sehr hilfreich…

Joachim

…habe die findmyiphone-Klasse nach dem Vorbild von qwik angepasst, bitte mal Rückmeldung geben…

Joachim

Gerade mal installiert und bisher sieht es gut aus, Daten werden aus der iCloud geladen und alle Geräte gelistet

Ich habe das Modul aktualisiert, bei mir kommt der Fehler leider immer noch

Hast du dafür ein eigenes Passwort in iCloud erstellt oder das normale benutzt ?
Ich hab das normale genutzt und es funktioniert.

Allerdings werden dei GoogleMaps nicht geladen - kurz war mal eine im Webfront zu sehen aber mittlerweile bei keinem Gerät

Bei dem findmyiphone-Modul zeigt GoogleMaps mir ständig eine Route zum Regierungsviertel Berlin an, bekomme ich auch nicht weg :slight_smile:

habe das ganz normale Passwort verwendet

Ich bekomme auch noch Fehlermeldungen nach dem Update:

26.07.2022, 10:59:13 | TimerPool            | IPS2AppleSplitter Zoe (DataUpdate): 
Notice: Undefined property: stdClass::$content in C:\ProgramData\Symcon\modules\IPS2Apple\libs\FindMyiPhone.php on line 109

Warning: Invalid argument supplied for foreach() in C:\ProgramData\Symcon\modules\IPS2Apple\libs\FindMyiPhone.php on line 109

richimaint

Hallo.

Kann es sein, dass es seit gestern Abend 20:55 da wieder ein Problem gibt?

Hallo,

wo du es schreibst, hab auch gerade mal reingeschaut

Konnte Konfigurationsform nicht laden
Warning: 
Notice: Undefined property: stdClass::$content in /var/lib/symcon/modules/IPS2Apple/libs/FindMyiPhone.php on line 109

Warning: Invalid argument supplied for foreach() in /var/lib/symcon/modules/IPS2Apple/libs/FindMyiPhone.php on line 109
RESULT:a:0:{} in /var/lib/symcon/modules/IPS2Apple/IPS2AppleConfigurator/module.php on line 89

Notice: Undefined variable: ResultArray in /var/lib/symcon/modules/IPS2Apple/IPS2AppleConfigurator/module.php on line 111

Warning: count(): Parameter must be an array or an object that implements Countable in /var/lib/symcon/modules/IPS2Apple/IPS2AppleConfigurator/module.php on line 49
{"status":[{"code":101,"icon":"inactive","caption":"Instanz wird erstellt"},{"code":102,"icon":"active","caption":"Instanz ist aktiv"},{"code":104,"icon":"inactive","caption":"Instanz ist inaktiv"},{"code":202,"icon":"error","caption":"Kommunikationfehler!"}],"elements":[{"type":"SelectCategory","name":"Category","caption":"Zielkategorie"},{"type":"Label","caption":"_____________________________________________________________________________________________________"},{"type":"Configurator","name":"AppleDevices","caption":"Apple-Devices","rowCount":10,"delete":false,"sort":{"column":"Device","direction":"ascending"},"columns":[{"caption":"Modell","name":"Device","width":"100px","visible":true},{"caption":"Name","name":"Name","width":"auto","visible":true}],"values":[]}]} (Code: -32603)

poppt auf beim Öffnen des Konfigurators.

EDIT: hab mal die komplette Fehlermeldung reinkopiert

nö, war bei mir durchgänig seit Anfang des Jahres

Ja, irgendwas wurde mal wieder geändert.
Aktuell kommt auf eine Anfrage nur das von Server zurück, anstatt der Daten.
grafik

Ursache und wie man es fixt ist mir zur Zeit noch unbekannt.