FHEM Forum

FHEM => Codeschnipsel => Thema gestartet von: Guybrush am 13 August 2026, 15:25:00

Titel: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 13 August 2026, 15:25:00
Ich habe bei mir Apples Wo Ist? integriert. Die bisherigen Ansätze über Homekit usw waren mir zu kompliziert. Da ich auch das Rad nicht komplett neu erfinden wollte habe für die Einbindung nun pyicloud genommen, was aktiv gepflegt wird. Da das aber keine vernünftige Schnittstelle für FHEM gab, habe ich eine mqtt bridge entwickelt, womit man nun direkt über mqtt mit pyicloud kommunizieren kann und sowohl die Standorte erhält als auch Lokalisierung starten kann. FHEM mit MQTT wird natürlich vorausgesetzt. Man kann das tool auch nutzen um wichtige Meldungen direkt auf dem iPhone anzeigen zu lassen ;) Ich hab das bei mir primär zum suchen meiner Geräte bei mir umgesetzt. Aber auch eine Anwesenheitserkennung lässt sich damit robust umsetzen.

https://github.com/next81/findmy2mqtt

Das Ganze ist dort schon kurz beschrieben, aber hier nochmal in kürze für debian:

sudo apt update
sudo apt install -y git python3 python3-full python3-pip python3-venv ca-certificates

git clone https://github.com/next81/findmy2mqtt.git
cd findmy2mqtt

sudo ./install.sh

Die Config ist selbsterklärend und liegt im YAML Format default unter:
/etc/findmy2mqtt/config.yaml

Nachdem die config angepasst ist muss der Login zu apple hergestellt werden:
findmy2mqtt password <person1>
findmy2mqtt auth <person1>

Dabei sollte dann die 2FA von apple angestoßen werden. Die Pin sollte dann im Prompt eingegeben werden.

wenn das durch ist können testweise die devices abgefragt werden:
findmy2mqtt devices <person1>


wenn das geht, dann findmy2mqtt als service einrichten:
systemctl enable --now findmy2mqtt

Danach sollten neue mqtt devices in FHEM auftauchen. Ein Beispiel Device für FHEM ist auch in der Github Readme enthalten.
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: CQuadrat am 13 August 2026, 16:58:51
Danke dafür!

Ich werde es die Tage mal ausprobieren.
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: binford6000 am 14 August 2026, 09:36:20
Vielen Dank fürs Entdecken!
Ich habe die FHEM Definition aus dem github Repo mal etwas angepasst:

defmod iphone_sebastian.fm MQTT2_DEVICE
attr iphone_sebastian.fm autocreate 0
attr iphone_sebastian.fm devicetopic findmy/person/deviceid
attr iphone_sebastian.fm event-on-change-reading .*
attr iphone_sebastian.fm readingList $DEVICETOPIC/state:.* { json2nameValue($EVENT) }
attr iphone_sebastian.fm setList locate $DEVICETOPIC/locate\
message:textField {"$DEVICETOPIC/message ".(split(/ /,$EVENT,2))[1]}
attr iphone_sebastian.fm timestamp-on-change-reading .*
attr iphone_sebastian.fm userReadings presence {findmyPresence($name)}

Die Fn "findmyPresence" für das presence userReading basiert auf lat und long in global und wurde mit Hilfe von KI generiert:
sub findmyPresence($) {
  my ($name) = @_;
  my $homeRadius = 150;  # Umkreis in Metern um Zuhause, der noch als "home" gilt
  my $lat1 = ReadingsVal($name,"latitude",undef);
  my $lon1 = ReadingsVal($name,"longitude",undef);
  my $lat2 = AttrVal("global","latitude",undef);
  my $lon2 = AttrVal("global","longitude",undef);
  return "unknown" if(!defined($lat1) || !defined($lon1) || !defined($lat2) || !defined($lon2));
  my $pi = 3.14159265358979;
  my $earthRadius = 6371000;  # Erdradius in Metern
  my $dLat = ($lat2-$lat1)*$pi/180;
  my $dLon = ($lon2-$lon1)*$pi/180;
  my $a = sin($dLat/2)**2 + cos($lat1*$pi/180)*cos($lat2*$pi/180)*sin($dLon/2)**2;
  my $c = 2*atan2(sqrt($a),sqrt(1-$a));
  my $distance = $earthRadius*$c;
  return ($distance <= $homeRadius) ? "present" : "absent";
}

VG Sebastian
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 14 August 2026, 10:31:14
die idee ist gut. das übernehme ich mal ;) ich würd nur schematisch die home koordinaten mit attributen und nicht mit readings setzen und statt undef 0 nehmen. das setlist passe ich auch im beispiel noch an. ich hatte den topic erst noch anders und nicht umgestellt als ich das vereinheitlicht hab.

ich hab in dem kontext auch die darstellung noch angepasst:

attr FindMy.AndreasiPhone devStateIcon (0|1)\d?:measure_battery_0@red [2-3]\d+:measure_battery_25@orange [4-6]\d+:measure_battery_50@green [7-8]\d+:measure_battery_75@green (9\d+|100).*:measure_battery_100@green
attr FindMy.AndreasiPhone stateFormat { my $s=ReadingsVal($name,"state","unknown");; my $b=ReadingsNum($name,"battery","-");; return "$b\n$s";; }
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 14 August 2026, 20:52:07
Hi,
ich habe ein Problem. Zuerst habe ich folgendes gemacht, und ich bin mir sicher, das ich den richtigen Code eingegeben habe. Der Code wurde auf meinem MAC angezeigt, und ich habe 'allow' gedrückt.
jamo@inuc:~$ sudo findmy2mqtt auth Jamo
2026-08-14 18:36:45,722 INFO findmy2mqtt.apple: Apple login succeeded for Jamo
2026-08-14 18:36:45,723 INFO findmy2mqtt.apple: Two-factor authentication is required.
Apple verification code (Enter = request new code): 695252
2026-08-14 18:36:58,402 ERROR pyicloud.base: Code verification failed.
2026-08-14 18:36:58,402 ERROR findmy2mqtt: Apple rejected the verification code

Danach habe ich ich im /etc/findmy2mqtt/config.yaml Gross/Kleinschreibung für meinen user und die e-mail Adresse geändert. Jetzt alles klein Schreibung. Passwort neu eingegeben.

Jetzt bekomme ich einfach keinen Apple verification code mehr, auf keinem meiner autorisierten Geräte. Es passiert gar nichts. Und ich habe schon länger als 60 Minuten gewartet.
jamo@inuc:~$ sudo findmy2mqtt auth Jamo
2026-08-14 20:33:07,735 INFO findmy2mqtt.apple: Apple login succeeded for Jamo
2026-08-14 20:33:07,736 INFO findmy2mqtt.apple: Two-factor authentication is required.
Apple verification code (Enter = request new code):
2026-08-14 20:33:40,712 ERROR findmy2mqtt: Apple could not request a new verification code
Auch wenn ich Enter eingebe, bekomme ich keinen neuen code auf einem meiner autorisierten gerate, weder iPhone/iPad/Mac/Watch.

Hat jemand einen Tip?
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: binford6000 am 14 August 2026, 21:07:09
ZitatHat jemand einen Tip?
Hi Jamo,
findmy kennt verbose:

--verbose             enable debug logging
Vielleicht kommt da etwas mehr?
Gruß,
Sebastian
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 14 August 2026, 21:16:31
ja, nach dem Enter kommt die Fehlerbeschreibung warum nach dem Enter kein neuer code angefordert werden kann, aber es kommt initial weiterhin kein 2FA code auf keinem meiner Geräte:
jamo@inuc:~$ sudo findmy2mqtt --verbose auth jamo
2026-08-14 21:09:32,241 DEBUG pyicloud.session: Using session file /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 21:09:32,242 DEBUG pyicloud.base: Checking session token validity
2026-08-14 21:09:32,242 DEBUG pyicloud.session: POST https://setup.icloud.com/setup/ws/1/validate
2026-08-14 21:09:32,244 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): setup.icloud.com:443
2026-08-14 21:09:32,572 DEBUG urllib3.connectionpool: https://setup.icloud.com:443 "POST /setup/ws/1/validate HTTP/1.1" 200 1970
2026-08-14 21:09:32,573 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 21:09:32,574 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 21:09:32,575 DEBUG pyicloud.base: Session token is still valid
2026-08-14 21:09:32,575 INFO findmy2mqtt.apple: Apple login succeeded for jamo
2026-08-14 21:09:32,575 INFO findmy2mqtt.apple: Two-factor authentication is required.
Apple verification code (Enter = request new code):
2026-08-14 21:13:35,116 ERROR findmy2mqtt: Apple could not request a new verification code
2026-08-14 21:13:35,117 ERROR findmy2mqtt: Detailed error
Traceback (most recent call last):
  File "/opt/findmy2mqtt/findmy2mqtt.py", line 40, in main
    result = execute_command(args, config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/lib/cli.py", line 224, in execute_command
    interactive_auth(config, find_account(config, args.account))
  File "/opt/findmy2mqtt/lib/apple.py", line 97, in interactive_auth
    raise RuntimeError("Apple could not request a new verification code")
RuntimeError: Apple could not request a new verification code
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: binford6000 am 14 August 2026, 21:24:19
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 14 August 2026, 21:46:08
Ich habe jetzt mein Apple Account Passwort geändert auf einem meiner trusted Devices. Dann mit "sudo findmy2mqtt password jamo" auch für findmy2mqtt geändert. Dann bekomme ich nach sudo findmy2mqtt --verbose auth jamowieder einen 2FA code. Nach dem ich mit 'allow' akzeptiert habe und den angezeigten 6-stelligen Code eingebe, kommt aber immer "Apple rejected the verification code". Versteh ich nicht.

Ich probiere morgen früh nochmal.

Apple verification code (Enter = request new code): 227108
2026-08-14 21:36:33,046 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/verify/trusteddevice/securitycode
2026-08-14 21:36:33,616 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/verify/trusteddevice/securitycode HTTP/1.1" 409 None
2026-08-14 21:36:33,619 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 21:36:33,621 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 21:36:33,622 ERROR pyicloud.base: Code verification failed.
2026-08-14 21:36:33,622 ERROR findmy2mqtt: Apple rejected the verification code
2026-08-14 21:36:33,623 ERROR findmy2mqtt: Detailed error
Traceback (most recent call last):
  File "/opt/findmy2mqtt/findmy2mqtt.py", line 40, in main
    result = execute_command(args, config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/lib/cli.py", line 224, in execute_command
    interactive_auth(config, find_account(config, args.account))
  File "/opt/findmy2mqtt/lib/apple.py", line 109, in interactive_auth
    raise RuntimeError("Apple rejected the verification code")
RuntimeError: Apple rejected the verification code
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 14 August 2026, 22:13:41
ich hab eine Vermutung woran es liegt. Versuche mal folgendes:

1. Das Session-Verzeichnis /var/lib/findmy2mqtt/sessions/jamo leeren.
2. sudo findmy2mqtt --verbose auth jamo starten.
3. Beim ersten Prompt den möglicherweise bereits angezeigten Code ignorieren und Enter drücken.
4. Den danach neu angeforderten Code erst beim Prompt New Apple verification code eingeben.

bitte debug + log hier dann posten.
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 14 August 2026, 22:20:10
Das hat geklappt!!!jamo@inuc:~$ sudo findmy2mqtt --verbose auth jamo
2026-08-14 22:17:11,646 DEBUG pyicloud.session: Using session file /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:11,646 INFO pyicloud.session: Session file does not exist
2026-08-14 22:17:11,647 DEBUG pyicloud.base: Authenticating as jamo@emaildomain.com
2026-08-14 22:17:11,647 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/authorize/signin
2026-08-14 22:17:11,649 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): idmsa.apple.com:443
2026-08-14 22:17:12,293 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/authorize/signin?frame_id=21f66354-981d-11f1-ae3a-1c697a6923d0&skVersion=7&iframeid=21f66354-981d-11f1-ae3a-1c697a6923d0&client_id=d39ba9916b7251055b22c7f910e2ea796ee65e98b2ddecea8f5dde8d9d1a815d&response_type=code&redirect_uri=https%3A%2F%2Fwww.icloud.com&response_mode=web_message&state=21f66354-981d-11f1-ae3a-1c697a6923d0&authVersion=latest HTTP/1.1" 200 None
2026-08-14 22:17:12,297 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:12,299 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:12,301 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/signin/init
2026-08-14 22:17:12,519 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/signin/init HTTP/1.1" 200 None
2026-08-14 22:17:12,522 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:12,523 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:12,564 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/signin/complete
2026-08-14 22:17:13,630 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/signin/complete?isRememberMeEnabled=true HTTP/1.1" 409 None
2026-08-14 22:17:13,634 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:13,635 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:13,635 DEBUG pyicloud.base: 2FA required to complete authentication.
2026-08-14 22:17:13,636 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth
2026-08-14 22:17:13,920 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth HTTP/1.1" 200 None
2026-08-14 22:17:13,923 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:13,924 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:13,927 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/verify/trusteddevice
2026-08-14 22:17:14,374 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/verify/trusteddevice HTTP/1.1" 200 None
2026-08-14 22:17:14,376 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:14,377 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:14,378 DEBUG pyicloud.base: Requested 2FA code via trusted device push
2026-08-14 22:17:14,378 DEBUG pyicloud.session: PUT https://idmsa.apple.com/appleauth/auth/verify/phone
2026-08-14 22:17:15,085 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "PUT /appleauth/auth/verify/phone HTTP/1.1" 200 None
2026-08-14 22:17:15,088 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:15,089 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:15,090 DEBUG pyicloud.base: Requested 2FA code via SMS (phone id 1)
2026-08-14 22:17:15,090 DEBUG pyicloud.session: POST https://setup.icloud.com/setup/ws/1/accountLogin
2026-08-14 22:17:15,093 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): setup.icloud.com:443
2026-08-14 22:17:15,561 DEBUG urllib3.connectionpool: https://setup.icloud.com:443 "POST /setup/ws/1/accountLogin HTTP/1.1" 200 2009
2026-08-14 22:17:15,565 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:15,568 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:15,569 DEBUG pyicloud.base: 2FA is required
2026-08-14 22:17:15,569 INFO findmy2mqtt.apple: Apple login succeeded for jamo
2026-08-14 22:17:15,569 INFO findmy2mqtt.apple: Two-factor authentication is required.
Apple verification code (Enter = request new code):
2026-08-14 22:17:23,115 DEBUG pyicloud.hsa2_bridge: Bootstrapping trusted-device bridge: auth_endpoint=https://idmsa.apple.com/appleauth/auth websocket_host=websocket.push.apple.com topic=com.apple.idmsauthwidget source_app_id=1159
2026-08-14 22:17:23,118 DEBUG pyicloud.hsa2_bridge: Opening trusted-device websocket: host=websocket.push.apple.com bootstrapPayloadLen=342
2026-08-14 22:17:24,074 DEBUG pyicloud.hsa2_bridge: Trusted-device bridge connected; received push token (80 bytes)
2026-08-14 22:17:24,074 DEBUG pyicloud.hsa2_bridge: Sent trusted-device webFilterMessage for topic=com.apple.idmsauthwidget
2026-08-14 22:17:24,075 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 0 with sessionUUID=dd5e042e... ptknLen=160
2026-08-14 22:17:24,075 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/0
2026-08-14 22:17:24,718 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/0 HTTP/1.1" 200 None
2026-08-14 22:17:24,720 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:24,721 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:38,124 DEBUG pyicloud.hsa2_bridge: Acknowledged trusted-device push message id=2412964662 topic=com.apple.idmsauthwidget
2026-08-14 22:17:38,124 DEBUG pyicloud.hsa2_bridge: Received trusted-device bridge payload: sessionUUID=dd5e042e... nextStep=2 ruiURLKey=None
Verification code requested via: trusted_device
New Apple verification code: 485172
2026-08-14 22:17:48,741 DEBUG pyicloud.hsa2_bridge: Starting trusted-device bridge code verification: sessionUUID=dd5e042e... nextStep=2 txnid=2300_4653917...
2026-08-14 22:17:48,831 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 2 with sessionUUID=dd5e042e...
2026-08-14 22:17:48,831 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/2
2026-08-14 22:17:49,172 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/2 HTTP/1.1" 200 None
2026-08-14 22:17:49,173 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:49,174 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:51,131 DEBUG pyicloud.hsa2_bridge: Acknowledged trusted-device push message id=1387051303 topic=com.apple.idmsauthwidget
2026-08-14 22:17:51,131 DEBUG pyicloud.hsa2_bridge: Decoded trusted-device bridge payload: sessionUUID=dd5e042e... nextStep=4 txnid=2300_3953450... ec=0 has_data=True has_encryptedCode=False
2026-08-14 22:17:51,132 DEBUG pyicloud.hsa2_bridge: Received trusted-device bridge payload: sessionUUID=dd5e042e... nextStep=4 txnid=2300_3953450...
2026-08-14 22:17:51,132 DEBUG pyicloud.hsa2_bridge: Processing trusted-device bridge step 4 payload for sessionUUID=dd5e042e...
2026-08-14 22:17:51,162 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 4 with sessionUUID=dd5e042e...
2026-08-14 22:17:51,162 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/4
2026-08-14 22:17:51,538 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/4 HTTP/1.1" 200 None
2026-08-14 22:17:51,540 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:51,542 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:53,133 DEBUG pyicloud.hsa2_bridge: Acknowledged trusted-device push message id=1870295629 topic=com.apple.idmsauthwidget
2026-08-14 22:17:53,133 DEBUG pyicloud.hsa2_bridge: Decoded trusted-device bridge payload: sessionUUID=dd5e042e... nextStep=4 txnid=2300_3953595... ec=0 has_data=False has_encryptedCode=True
2026-08-14 22:17:53,133 DEBUG pyicloud.hsa2_bridge: Received trusted-device bridge final payload: sessionUUID=dd5e042e... nextStep=4 txnid=2300_3953595...
2026-08-14 22:17:53,133 DEBUG pyicloud.hsa2_bridge: Decrypting trusted-device bridge code for sessionUUID=dd5e042e...
2026-08-14 22:17:53,134 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/code/validate
2026-08-14 22:17:53,656 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/code/validate HTTP/1.1" 409 None
2026-08-14 22:17:53,658 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:53,660 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:53,660 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge completion step 4 with sessionUUID=dd5e042e... verifyStatus=409
2026-08-14 22:17:53,660 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/4
2026-08-14 22:17:54,186 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/4 HTTP/1.1" 200 None
2026-08-14 22:17:54,189 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:54,191 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:54,194 DEBUG pyicloud.base: Code verification successful.
2026-08-14 22:17:54,195 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/2sv/trust
2026-08-14 22:17:54,902 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/2sv/trust HTTP/1.1" 204 0
2026-08-14 22:17:54,904 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:54,906 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:54,907 DEBUG pyicloud.session: POST https://setup.icloud.com/setup/ws/1/accountLogin
2026-08-14 22:17:55,241 DEBUG urllib3.connectionpool: https://setup.icloud.com:443 "POST /setup/ws/1/accountLogin HTTP/1.1" 200 2011
2026-08-14 22:17:55,245 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-14 22:17:55,248 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-14 22:17:55,249 DEBUG pyicloud.base: Session trust successful.
2026-08-14 22:17:55,249 INFO findmy2mqtt.apple: 2FA completed for jamo
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 14 August 2026, 22:22:28
ok, dann bau ich das mal robuster um... danke fürs mithelfen  ;D
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 14 August 2026, 22:48:53
ich hab das im dev branch mal geändert und auch das alte auth verfahren rausgenommen. war sowieso blödsinn das mit einzubauen, weils nur uralt accounts betreffen dürfte.

git clone -b dev https://github.com/next81/findmy2mqtt.git

damit sollte der auth dann direkt richtig funktionieren. bitte einmal testen wenn möglich :-) das sessionverzeichnis in /var/lib/findmy2mqtt/sessions/jamo/ vorher leeren
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 14 August 2026, 23:07:48
Erstmal danke für die super Entwicklungsarbeit. Hammer!
Habe gerade erstmal alle meine Devices eingerichtet.

Kurze Frage, damit ich nichts zerschiesse: Nach dem
"git clone -b dev https://github.com/next81/findmy2mqtt.git" muss ich wieder ein "sudo ./install.sh" machen, korrekt?
Danach dann das "sudo findmy2mqtt --verbose auth jamo"...
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 14 August 2026, 23:26:24
danke :) wenn du noch das ausgecheckte dir hast, kannst du einfach in dem dir mit "git switch dev" auf den dev branch wechseln. vorher/nacher noch ein "git pull"  machen.

./install.sh muss immer ausgeführt werden, weil das die aktualisierten Dateien aus dem Git Repo aufs System erst kopiert. danach mit "service findmy2mqtt restart" den daemon neu starten und dann mit auth weiter
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 15 August 2026, 10:31:19
Hallo Guybrush, das funktioniert nicht - es kommt unter Linux keine prompt, wo ich den Verifikation Code eingeben kann. Also die Zeile "Apple verification code (Enter = request new code): " kommt nicht. Das ganze stoppt wo ich HIER HIER HIER HIER eingefügt habe. Ein Enter führt dann zum Abbruch:

jamo@inuc:~$ sudo findmy2mqtt --verbose auth jamo
2026-08-15 10:23:58,807 DEBUG pyicloud.session: Using session file /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:23:58,808 INFO pyicloud.session: Session file does not exist
2026-08-15 10:23:58,808 DEBUG pyicloud.base: Authenticating as jamo@emaildomain.com
2026-08-15 10:23:58,808 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/authorize/signin
2026-08-15 10:23:58,811 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): idmsa.apple.com:443
2026-08-15 10:23:59,527 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/authorize/signin?frame_id=a9db1fc0-9882-11f1-8c33-1c697a6923d0&skVersion=7&iframeid=a9db1fc0-9882-11f1-8c33-1c697a6923d0&client_id=d39ba9916b7251055b22c7f910e2ea796ee65e98b2ddecea8f5dde8d9d1a815d&response_type=code&redirect_uri=https%3A%2F%2Fwww.icloud.com&response_mode=web_message&state=a9db1fc0-9882-11f1-8c33-1c697a6923d0&authVersion=latest HTTP/1.1" 200 None
2026-08-15 10:23:59,531 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:23:59,532 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 10:23:59,533 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/signin/init
2026-08-15 10:23:59,738 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/signin/init HTTP/1.1" 200 None
2026-08-15 10:23:59,741 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:23:59,742 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 10:23:59,781 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/signin/complete
2026-08-15 10:24:00,664 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/signin/complete?isRememberMeEnabled=true HTTP/1.1" 409 None
2026-08-15 10:24:00,665 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:24:00,665 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 10:24:00,666 DEBUG pyicloud.base: 2FA required to complete authentication.
2026-08-15 10:24:00,666 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth
2026-08-15 10:24:00,954 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth HTTP/1.1" 200 None
2026-08-15 10:24:00,955 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:24:00,955 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 10:24:00,956 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/verify/trusteddevice
2026-08-15 10:24:01,531 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/verify/trusteddevice HTTP/1.1" 200 None
2026-08-15 10:24:01,531 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:24:01,532 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 10:24:01,532 DEBUG pyicloud.base: Requested 2FA code via trusted device push
2026-08-15 10:24:01,532 DEBUG pyicloud.session: PUT https://idmsa.apple.com/appleauth/auth/verify/phone
2026-08-15 10:24:02,219 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "PUT /appleauth/auth/verify/phone HTTP/1.1" 200 None
2026-08-15 10:24:02,220 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:24:02,220 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 10:24:02,221 DEBUG pyicloud.base: Requested 2FA code via SMS (phone id 1)
2026-08-15 10:24:02,221 DEBUG pyicloud.session: POST https://setup.icloud.com/setup/ws/1/accountLogin
2026-08-15 10:24:02,222 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): setup.icloud.com:443
2026-08-15 10:24:02,779 DEBUG urllib3.connectionpool: https://setup.icloud.com:443 "POST /setup/ws/1/accountLogin HTTP/1.1" 200 2011
2026-08-15 10:24:02,780 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:24:02,780 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 10:24:02,780 DEBUG pyicloud.base: 2FA is required
2026-08-15 10:24:02,780 INFO findmy2mqtt.apple: Apple login succeeded for jamo
2026-08-15 10:24:02,780 INFO findmy2mqtt.apple: Two-factor authentication is required.
2026-08-15 10:24:02,782 DEBUG pyicloud.hsa2_bridge: Bootstrapping trusted-device bridge: auth_endpoint=https://idmsa.apple.com/appleauth/auth websocket_host=websocket.push.apple.com topic=com.apple.idmsauthwidget source_app_id=1159
2026-08-15 10:24:02,782 DEBUG pyicloud.hsa2_bridge: Opening trusted-device websocket: host=websocket.push.apple.com bootstrapPayloadLen=342
2026-08-15 10:24:03,764 DEBUG pyicloud.hsa2_bridge: Trusted-device bridge connected; received push token (80 bytes)
2026-08-15 10:24:03,764 DEBUG pyicloud.hsa2_bridge: Sent trusted-device webFilterMessage for topic=com.apple.idmsauthwidget
2026-08-15 10:24:03,765 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 0 with sessionUUID=daa4fa04... ptknLen=160
2026-08-15 10:24:03,765 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/0
2026-08-15 10:24:04,431 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/0 HTTP/1.1" 200 None
2026-08-15 10:24:04,433 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:24:04,435 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
[b]HIER HIER HIER HIER [/b]
2026-08-15 10:24:34,455 DEBUG pyicloud.hsa2_bridge: Trusted-device websocket transport error during bootstrap.
Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1128, in start
    push_payload = self._wait_for_bridge_push(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1449, in _wait_for_bridge_push
    message = websocket.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 979, in read_message
    first_byte, second_byte = self._read_exact(2)
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 937, in _read_exact
    chunk = self._socket.recv(max(4096, size - len(self._buffer)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out
2026-08-15 10:24:34,461 DEBUG pyicloud.base: Trusted-device bridge bootstrap failed; falling back to SMS when available.
Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1128, in start
    push_payload = self._wait_for_bridge_push(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1449, in _wait_for_bridge_push
    message = websocket.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 979, in read_message
    first_byte, second_byte = self._read_exact(2)
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 937, in _read_exact
    chunk = self._socket.recv(max(4096, size - len(self._buffer)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/base.py", line 1002, in request_2fa_code
    self._trusted_device_bridge_state = self._trusted_device_bridge.start(
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1181, in start
    raise PyiCloudTrustedDevicePromptException(
pyicloud.exceptions.PyiCloudTrustedDevicePromptException: Failed to bootstrap the trusted-device bridge prompt.
2026-08-15 10:24:34,465 DEBUG pyicloud.session: PUT https://idmsa.apple.com/appleauth/auth/verify/phone
2026-08-15 10:24:34,468 DEBUG urllib3.connectionpool: Resetting dropped connection: idmsa.apple.com
2026-08-15 10:24:35,475 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "PUT /appleauth/auth/verify/phone HTTP/1.1" 200 None
2026-08-15 10:24:35,477 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 10:24:35,480 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
Verification code requested via: sms
Trusted-device prompt failed; falling back to SMS.
Apple verification code from the latest request: 2026-08-15 10:24:35,481 ERROR findmy2mqtt: empty verification code
2026-08-15 10:24:35,481 ERROR findmy2mqtt: Detailed error
Traceback (most recent call last):
  File "/opt/findmy2mqtt/findmy2mqtt.py", line 40, in main
    result = execute_command(args, config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/lib/cli.py", line 224, in execute_command
    interactive_auth(config, find_account(config, args.account))
  File "/opt/findmy2mqtt/lib/apple.py", line 179, in interactive_auth
    raise RuntimeError("empty verification code")
RuntimeError: empty verification code
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 15 August 2026, 11:42:22
das liegt scheinbar daran, dass du Enter gedrückt hast während der Wartezeit. Richtig? Wenn du das nochmal startest und wartest bis der code kommt, sollte es aber eigentlich gehen. Ein zu frühes Enter habe ich bislang nicht abgefangen. Ich baus mal ein, aber es sollte jetzt eigentlich auch schon gehen, wenn man nichts drückt bis der code kommt
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 15 August 2026, 12:04:59
Nein, das funktioniert auch nicht.
Asuuserdem kommt die Zeile Apple verification code (Enter = request new code): " nicht.
Schaum mal da wo ich den code 428295 eingebe.

jamo@inuc:~$ sudo findmy2mqtt --verbose auth jamo
2026-08-15 12:01:21,773 DEBUG pyicloud.session: Using session file /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:21,773 INFO pyicloud.session: Session file does not exist
2026-08-15 12:01:21,773 DEBUG pyicloud.base: Authenticating as jamo@emaildomain.com
2026-08-15 12:01:21,773 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/authorize/signin
2026-08-15 12:01:21,776 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): idmsa.apple.com:443
2026-08-15 12:01:23,069 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/authorize/signin?frame_id=4488e946-9890-11f1-9367-1c697a6923d0&skVersion=7&iframeid=4488e946-9890-11f1-9367-1c697a6923d0&client_id=d39ba9916b7251055b22c7f910e2ea796ee65e98b2ddecea8f5dde8d9d1a815d&response_type=code&redirect_uri=https%3A%2F%2Fwww.icloud.com&response_mode=web_message&state=4488e946-9890-11f1-9367-1c697a6923d0&authVersion=latest HTTP/1.1" 200 None
2026-08-15 12:01:23,073 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:23,074 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:01:23,076 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/signin/init
2026-08-15 12:01:23,290 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/signin/init HTTP/1.1" 200 None
2026-08-15 12:01:23,292 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:23,293 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:01:23,333 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/signin/complete
2026-08-15 12:01:24,542 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/signin/complete?isRememberMeEnabled=true HTTP/1.1" 409 None
2026-08-15 12:01:24,544 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:24,546 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:01:24,546 DEBUG pyicloud.base: 2FA required to complete authentication.
2026-08-15 12:01:24,546 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth
2026-08-15 12:01:24,859 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth HTTP/1.1" 200 None
2026-08-15 12:01:24,861 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:24,861 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:01:24,862 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/verify/trusteddevice
2026-08-15 12:01:25,340 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/verify/trusteddevice HTTP/1.1" 200 None
2026-08-15 12:01:25,342 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:25,344 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:01:25,344 DEBUG pyicloud.base: Requested 2FA code via trusted device push
2026-08-15 12:01:25,344 DEBUG pyicloud.session: PUT https://idmsa.apple.com/appleauth/auth/verify/phone
2026-08-15 12:01:26,036 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "PUT /appleauth/auth/verify/phone HTTP/1.1" 200 None
2026-08-15 12:01:26,039 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:26,040 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:01:26,040 DEBUG pyicloud.base: Requested 2FA code via SMS (phone id 1)
2026-08-15 12:01:26,041 DEBUG pyicloud.session: POST https://setup.icloud.com/setup/ws/1/accountLogin
2026-08-15 12:01:26,043 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): setup.icloud.com:443
2026-08-15 12:01:26,578 DEBUG urllib3.connectionpool: https://setup.icloud.com:443 "POST /setup/ws/1/accountLogin HTTP/1.1" 200 2012
2026-08-15 12:01:26,582 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:26,584 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:01:26,585 DEBUG pyicloud.base: 2FA is required
2026-08-15 12:01:26,585 INFO findmy2mqtt.apple: Apple login succeeded for jamo
2026-08-15 12:01:26,585 INFO findmy2mqtt.apple: Two-factor authentication is required.
2026-08-15 12:01:26,589 DEBUG pyicloud.hsa2_bridge: Bootstrapping trusted-device bridge: auth_endpoint=https://idmsa.apple.com/appleauth/auth websocket_host=websocket.push.apple.com topic=com.apple.idmsauthwidget source_app_id=1159
2026-08-15 12:01:26,592 DEBUG pyicloud.hsa2_bridge: Opening trusted-device websocket: host=websocket.push.apple.com bootstrapPayloadLen=340
2026-08-15 12:01:27,530 DEBUG pyicloud.hsa2_bridge: Trusted-device bridge connected; received push token (80 bytes)
2026-08-15 12:01:27,531 DEBUG pyicloud.hsa2_bridge: Sent trusted-device webFilterMessage for topic=com.apple.idmsauthwidget
2026-08-15 12:01:27,531 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 0 with sessionUUID=8908df4e... ptknLen=160
2026-08-15 12:01:27,531 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/0
2026-08-15 12:01:28,226 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/0 HTTP/1.1" 200 None
2026-08-15 12:01:28,228 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:28,230 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
428295

2026-08-15 12:01:58,258 DEBUG pyicloud.hsa2_bridge: Trusted-device websocket transport error during bootstrap.
Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1128, in start
    push_payload = self._wait_for_bridge_push(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1449, in _wait_for_bridge_push
    message = websocket.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 979, in read_message
    first_byte, second_byte = self._read_exact(2)
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 937, in _read_exact
    chunk = self._socket.recv(max(4096, size - len(self._buffer)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out
2026-08-15 12:01:58,262 DEBUG pyicloud.base: Trusted-device bridge bootstrap failed; falling back to SMS when available.
Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1128, in start
    push_payload = self._wait_for_bridge_push(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1449, in _wait_for_bridge_push
    message = websocket.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 979, in read_message
    first_byte, second_byte = self._read_exact(2)
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 937, in _read_exact
    chunk = self._socket.recv(max(4096, size - len(self._buffer)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/base.py", line 1002, in request_2fa_code
    self._trusted_device_bridge_state = self._trusted_device_bridge.start(
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1181, in start
    raise PyiCloudTrustedDevicePromptException(
pyicloud.exceptions.PyiCloudTrustedDevicePromptException: Failed to bootstrap the trusted-device bridge prompt.
2026-08-15 12:01:58,266 DEBUG pyicloud.session: PUT https://idmsa.apple.com/appleauth/auth/verify/phone
2026-08-15 12:01:58,268 DEBUG urllib3.connectionpool: Resetting dropped connection: idmsa.apple.com
2026-08-15 12:01:59,362 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "PUT /appleauth/auth/verify/phone HTTP/1.1" 200 None
2026-08-15 12:01:59,363 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:59,364 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
Verification code requested via: sms
Trusted-device prompt failed; falling back to SMS.
Apple verification code from the latest request: 2026-08-15 12:01:59,364 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/verify/phone/securitycode
2026-08-15 12:01:59,807 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/verify/phone/securitycode HTTP/1.1" 400 None
2026-08-15 12:01:59,809 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:01:59,811 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:01:59,811 ERROR pyicloud.base: Code verification failed.
2026-08-15 12:01:59,811 WARNING findmy2mqtt.apple: Apple rejected the verification code; requesting a new code (1/3).
2026-08-15 12:01:59,811 DEBUG pyicloud.hsa2_bridge: Bootstrapping trusted-device bridge: auth_endpoint=https://idmsa.apple.com/appleauth/auth websocket_host=websocket.push.apple.com topic=com.apple.idmsauthwidget source_app_id=1159
2026-08-15 12:01:59,812 DEBUG pyicloud.hsa2_bridge: Opening trusted-device websocket: host=websocket.push.apple.com bootstrapPayloadLen=342
2026-08-15 12:02:00,838 DEBUG pyicloud.hsa2_bridge: Trusted-device bridge connected; received push token (80 bytes)
2026-08-15 12:02:00,839 DEBUG pyicloud.hsa2_bridge: Sent trusted-device webFilterMessage for topic=com.apple.idmsauthwidget
2026-08-15 12:02:00,839 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 0 with sessionUUID=59947e21... ptknLen=160
2026-08-15 12:02:00,839 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/0
2026-08-15 12:02:01,509 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/0 HTTP/1.1" 200 None
2026-08-15 12:02:01,512 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:02:01,514 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:02:31,543 DEBUG pyicloud.hsa2_bridge: Trusted-device websocket transport error during bootstrap.
Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1128, in start
    push_payload = self._wait_for_bridge_push(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1449, in _wait_for_bridge_push
    message = websocket.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 979, in read_message
    first_byte, second_byte = self._read_exact(2)
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 937, in _read_exact
    chunk = self._socket.recv(max(4096, size - len(self._buffer)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out
2026-08-15 12:02:31,545 DEBUG pyicloud.base: Trusted-device bridge bootstrap failed; falling back to SMS when available.
Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1128, in start
    push_payload = self._wait_for_bridge_push(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1449, in _wait_for_bridge_push
    message = websocket.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 979, in read_message
    first_byte, second_byte = self._read_exact(2)
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 937, in _read_exact
    chunk = self._socket.recv(max(4096, size - len(self._buffer)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/base.py", line 1002, in request_2fa_code
    self._trusted_device_bridge_state = self._trusted_device_bridge.start(
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1181, in start
    raise PyiCloudTrustedDevicePromptException(
pyicloud.exceptions.PyiCloudTrustedDevicePromptException: Failed to bootstrap the trusted-device bridge prompt.
2026-08-15 12:02:31,546 DEBUG pyicloud.session: PUT https://idmsa.apple.com/appleauth/auth/verify/phone
2026-08-15 12:02:31,576 ERROR findmy2mqtt: Request failed to iCloud
2026-08-15 12:02:31,578 ERROR findmy2mqtt: Detailed error
Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1128, in start
    push_payload = self._wait_for_bridge_push(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1449, in _wait_for_bridge_push
    message = websocket.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 979, in read_message
    first_byte, second_byte = self._read_exact(2)
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 937, in _read_exact
    chunk = self._socket.recv(max(4096, size - len(self._buffer)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/base.py", line 1002, in request_2fa_code
    self._trusted_device_bridge_state = self._trusted_device_bridge.start(
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1181, in start
    raise PyiCloudTrustedDevicePromptException(
pyicloud.exceptions.PyiCloudTrustedDevicePromptException: Failed to bootstrap the trusted-device bridge prompt.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 788, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/urllib3/connection.py", line 571, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1394, in getresponse
    response.begin()
  File "/usr/lib/python3.11/http/client.py", line 323, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 292, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/requests/adapters.py", line 696, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 842, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/urllib3/util/retry.py", line 498, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 788, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 534, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/urllib3/connection.py", line 571, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1394, in getresponse
    response.begin()
  File "/usr/lib/python3.11/http/client.py", line 323, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 292, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/session.py", line 304, in _request
    response: Response = super().request(
                         ^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/requests/sessions.py", line 651, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/requests/sessions.py", line 784, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/requests/adapters.py", line 711, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/findmy2mqtt/findmy2mqtt.py", line 40, in main
    result = execute_command(args, config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/lib/cli.py", line 224, in execute_command
    interactive_auth(config, find_account(config, args.account))
  File "/opt/findmy2mqtt/lib/apple.py", line 171, in interactive_auth
    if not _request_2fa_code(api, account):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/lib/apple.py", line 110, in _request_2fa_code
    if requestCode():
       ^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/base.py", line 1020, in request_2fa_code
    return self._request_sms_2fa_code(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/base.py", line 915, in _request_sms_2fa_code
    self.session.put(
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/requests/sessions.py", line 726, in put
    return self.request("PUT", url, data=data, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/session.py", line 206, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/session.py", line 339, in _request
    self._raise_request_exception(err)
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/session.py", line 350, in _raise_request_exception
    raise PyiCloudAPIResponseException("Request failed to iCloud") from err
pyicloud.exceptions.PyiCloudAPIResponseException: Request failed to iCloud
jamo@inuc:~$
jamo@inuc:~$
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 15 August 2026, 12:25:55
ich hab da jetzt Änderungen in den dev branch commitet. mach da mal ein git pull + install und teste nochmal
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 15 August 2026, 12:44:32
Das hat jetzt geklappt, aber irgendwie bin ich in eine Schleife reingekommen.
Es wurden 3 requests gemacht und ich habe 3 mal den code eingeben müssen.
Siehe Log.
Und die Zeile "Apple verification code (Enter = request new code): ", wo ich gestern den code eingeben musste, habe ich nicht gesehen, aber dafür deine neue Zeile "Requesting a new Apple verification code. This can take up to 30 seconds; wait for the code prompt before pressing Enter."
jamo@inuc:~$ sudo findmy2mqtt --verbose auth jamo
2026-08-15 12:36:34,126 DEBUG pyicloud.session: Using session file /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:34,127 DEBUG pyicloud.base: Checking session token validity
2026-08-15 12:36:34,127 DEBUG pyicloud.base: Invalid authentication token, will log in from scratch.
2026-08-15 12:36:34,127 DEBUG pyicloud.base: Authenticating as jamo@emaildomain.com
2026-08-15 12:36:34,127 DEBUG pyicloud.session: POST https://setup.icloud.com/setup/ws/1/accountLogin
2026-08-15 12:36:34,130 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): setup.icloud.com:443
2026-08-15 12:36:34,671 DEBUG urllib3.connectionpool: https://setup.icloud.com:443 "POST /setup/ws/1/accountLogin HTTP/1.1" 200 2012
2026-08-15 12:36:34,676 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:34,679 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:36:34,680 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/authorize/signin
2026-08-15 12:36:34,685 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): idmsa.apple.com:443
2026-08-15 12:36:35,236 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/authorize/signin?frame_id=e25f8afe-9894-11f1-80a6-1c697a6923d0&skVersion=7&iframeid=e25f8afe-9894-11f1-80a6-1c697a6923d0&client_id=d39ba9916b7251055b22c7f910e2ea796ee65e98b2ddecea8f5dde8d9d1a815d&response_type=code&redirect_uri=https%3A%2F%2Fwww.icloud.com&response_mode=web_message&state=e25f8afe-9894-11f1-80a6-1c697a6923d0&authVersion=latest HTTP/1.1" 200 None
2026-08-15 12:36:35,240 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:35,242 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:36:35,244 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/signin/init
2026-08-15 12:36:35,438 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/signin/init HTTP/1.1" 200 None
2026-08-15 12:36:35,441 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:35,443 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:36:35,483 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/signin/complete
2026-08-15 12:36:36,639 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/signin/complete?isRememberMeEnabled=true HTTP/1.1" 409 None
2026-08-15 12:36:36,642 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:36,645 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:36:36,645 DEBUG pyicloud.base: 2FA required to complete authentication.
2026-08-15 12:36:36,645 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth
2026-08-15 12:36:36,928 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth HTTP/1.1" 200 None
2026-08-15 12:36:36,931 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:36,933 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:36:36,936 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/verify/trusteddevice
2026-08-15 12:36:37,434 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/verify/trusteddevice HTTP/1.1" 200 None
2026-08-15 12:36:37,436 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:37,438 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:36:37,439 DEBUG pyicloud.base: Requested 2FA code via trusted device push
2026-08-15 12:36:37,439 DEBUG pyicloud.session: PUT https://idmsa.apple.com/appleauth/auth/verify/phone
2026-08-15 12:36:38,127 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "PUT /appleauth/auth/verify/phone HTTP/1.1" 200 None
2026-08-15 12:36:38,130 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:38,132 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:36:38,133 DEBUG pyicloud.base: Requested 2FA code via SMS (phone id 1)
2026-08-15 12:36:38,134 DEBUG pyicloud.session: POST https://setup.icloud.com/setup/ws/1/accountLogin
2026-08-15 12:36:38,510 DEBUG urllib3.connectionpool: https://setup.icloud.com:443 "POST /setup/ws/1/accountLogin HTTP/1.1" 200 2011
2026-08-15 12:36:38,513 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:38,514 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:36:38,514 DEBUG pyicloud.base: 2FA is required
2026-08-15 12:36:38,514 INFO findmy2mqtt.apple: Apple login succeeded for jamo
2026-08-15 12:36:38,514 INFO findmy2mqtt.apple: Two-factor authentication is required.
Requesting a new Apple verification code. This can take up to 30 seconds; wait for the code prompt before pressing Enter.
2026-08-15 12:36:38,515 DEBUG pyicloud.hsa2_bridge: Bootstrapping trusted-device bridge: auth_endpoint=https://idmsa.apple.com/appleauth/auth websocket_host=websocket.push.apple.com topic=com.apple.idmsauthwidget source_app_id=1159
2026-08-15 12:36:38,516 DEBUG pyicloud.hsa2_bridge: Opening trusted-device websocket: host=websocket.push.apple.com bootstrapPayloadLen=340
2026-08-15 12:36:39,278 DEBUG pyicloud.hsa2_bridge: Trusted-device bridge connected; received push token (80 bytes)
2026-08-15 12:36:39,278 DEBUG pyicloud.hsa2_bridge: Sent trusted-device webFilterMessage for topic=com.apple.idmsauthwidget
2026-08-15 12:36:39,278 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 0 with sessionUUID=4100d66d... ptknLen=160
2026-08-15 12:36:39,278 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/0
2026-08-15 12:36:39,872 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/0 HTTP/1.1" 200 None
2026-08-15 12:36:39,872 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:36:39,873 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
375160
2026-08-15 12:37:09,902 DEBUG pyicloud.hsa2_bridge: Trusted-device websocket transport error during bootstrap.
Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1128, in start
    push_payload = self._wait_for_bridge_push(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1449, in _wait_for_bridge_push
    message = websocket.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 979, in read_message
    first_byte, second_byte = self._read_exact(2)
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 937, in _read_exact
    chunk = self._socket.recv(max(4096, size - len(self._buffer)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out
2026-08-15 12:37:09,906 DEBUG pyicloud.base: Trusted-device bridge bootstrap failed; falling back to SMS when available.
Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1128, in start
    push_payload = self._wait_for_bridge_push(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1449, in _wait_for_bridge_push
    message = websocket.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 979, in read_message
    first_byte, second_byte = self._read_exact(2)
                              ^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 937, in _read_exact
    chunk = self._socket.recv(max(4096, size - len(self._buffer)))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1296, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1169, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/base.py", line 1002, in request_2fa_code
    self._trusted_device_bridge_state = self._trusted_device_bridge.start(
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/findmy2mqtt/venv/lib/python3.11/site-packages/pyicloud/hsa2_bridge.py", line 1181, in start
    raise PyiCloudTrustedDevicePromptException(
pyicloud.exceptions.PyiCloudTrustedDevicePromptException: Failed to bootstrap the trusted-device bridge prompt.
2026-08-15 12:37:09,909 DEBUG pyicloud.session: PUT https://idmsa.apple.com/appleauth/auth/verify/phone
2026-08-15 12:37:09,912 DEBUG urllib3.connectionpool: Resetting dropped connection: idmsa.apple.com
2026-08-15 12:37:10,987 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "PUT /appleauth/auth/verify/phone HTTP/1.1" 200 None
2026-08-15 12:37:10,989 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:37:10,990 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
Verification code requested via: sms
Trusted-device prompt failed; falling back to SMS.
Apple verification code from the latest request: 366320
2026-08-15 12:37:44,739 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/verify/phone/securitycode
2026-08-15 12:37:44,743 DEBUG urllib3.connectionpool: Resetting dropped connection: idmsa.apple.com
2026-08-15 12:37:45,495 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/verify/phone/securitycode HTTP/1.1" 400 None
2026-08-15 12:37:45,497 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:37:45,498 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:37:45,498 ERROR pyicloud.base: Code verification failed.
2026-08-15 12:37:45,498 WARNING findmy2mqtt.apple: Apple rejected the verification code; requesting a new code (1/3).
Requesting a new Apple verification code. This can take up to 30 seconds; wait for the code prompt before pressing Enter.
2026-08-15 12:37:45,499 DEBUG pyicloud.hsa2_bridge: Bootstrapping trusted-device bridge: auth_endpoint=https://idmsa.apple.com/appleauth/auth websocket_host=websocket.push.apple.com topic=com.apple.idmsauthwidget source_app_id=1159
2026-08-15 12:37:45,499 DEBUG pyicloud.hsa2_bridge: Opening trusted-device websocket: host=websocket.push.apple.com bootstrapPayloadLen=338
2026-08-15 12:37:46,340 DEBUG pyicloud.hsa2_bridge: Trusted-device bridge connected; received push token (80 bytes)
2026-08-15 12:37:46,341 DEBUG pyicloud.hsa2_bridge: Sent trusted-device webFilterMessage for topic=com.apple.idmsauthwidget
2026-08-15 12:37:46,341 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 0 with sessionUUID=3e4c56e1... ptknLen=160
2026-08-15 12:37:46,341 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/0
2026-08-15 12:37:46,926 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/0 HTTP/1.1" 200 None
2026-08-15 12:37:46,928 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:37:46,930 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:37:51,526 DEBUG pyicloud.hsa2_bridge: Acknowledged trusted-device push message id=3645107103 topic=com.apple.idmsauthwidget
2026-08-15 12:37:51,526 DEBUG pyicloud.hsa2_bridge: Received trusted-device bridge payload: sessionUUID=3e4c56e1... nextStep=2 ruiURLKey=None
Verification code requested via: trusted_device
Apple verification code from the latest request: 223980
2026-08-15 12:38:03,530 DEBUG pyicloud.hsa2_bridge: Starting trusted-device bridge code verification: sessionUUID=3e4c56e1... nextStep=2 txnid=2300_5452528...
2026-08-15 12:38:03,590 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 2 with sessionUUID=3e4c56e1...
2026-08-15 12:38:03,590 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/2
2026-08-15 12:38:03,973 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/2 HTTP/1.1" 200 None
2026-08-15 12:38:03,975 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:38:03,977 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:38:05,653 DEBUG pyicloud.hsa2_bridge: Acknowledged trusted-device push message id=542266544 topic=com.apple.idmsauthwidget
2026-08-15 12:38:05,653 DEBUG pyicloud.hsa2_bridge: Decoded trusted-device bridge payload: sessionUUID=3e4c56e1... nextStep=4 txnid=2300_5169397... ec=0 has_data=True has_encryptedCode=False
2026-08-15 12:38:05,653 DEBUG pyicloud.hsa2_bridge: Received trusted-device bridge payload: sessionUUID=3e4c56e1... nextStep=4 txnid=2300_5169397...
2026-08-15 12:38:05,653 DEBUG pyicloud.hsa2_bridge: Processing trusted-device bridge step 4 payload for sessionUUID=3e4c56e1...
2026-08-15 12:38:05,709 DEBUG pyicloud.hsa2_bridge: Trusted-device bridge prover rejected the step-4 confirmation for sessionUUID=3e4c56e1...
2026-08-15 12:38:05,710 ERROR pyicloud.base: Code verification failed.
2026-08-15 12:38:05,710 WARNING findmy2mqtt.apple: Apple rejected the verification code; requesting a new code (2/3).
Requesting a new Apple verification code. This can take up to 30 seconds; wait for the code prompt before pressing Enter.
2026-08-15 12:38:05,710 DEBUG pyicloud.hsa2_bridge: Bootstrapping trusted-device bridge: auth_endpoint=https://idmsa.apple.com/appleauth/auth websocket_host=websocket.push.apple.com topic=com.apple.idmsauthwidget source_app_id=1159
2026-08-15 12:38:05,710 DEBUG pyicloud.hsa2_bridge: Opening trusted-device websocket: host=websocket.push.apple.com bootstrapPayloadLen=342
2026-08-15 12:38:06,373 DEBUG pyicloud.hsa2_bridge: Trusted-device bridge connected; received push token (80 bytes)
2026-08-15 12:38:06,373 DEBUG pyicloud.hsa2_bridge: Sent trusted-device webFilterMessage for topic=com.apple.idmsauthwidget
2026-08-15 12:38:06,374 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 0 with sessionUUID=a7a6c0e1... ptknLen=160
2026-08-15 12:38:06,374 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/0
2026-08-15 12:38:06,985 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/0 HTTP/1.1" 200 None
2026-08-15 12:38:06,987 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:38:06,989 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:38:27,549 DEBUG pyicloud.hsa2_bridge: Acknowledged trusted-device push message id=2421707769 topic=com.apple.idmsauthwidget
2026-08-15 12:38:27,549 DEBUG pyicloud.hsa2_bridge: Received trusted-device bridge payload: sessionUUID=a7a6c0e1... nextStep=2 ruiURLKey=None
Verification code requested via: trusted_device
Apple verification code from the latest request: 771335
2026-08-15 12:38:34,100 DEBUG pyicloud.hsa2_bridge: Starting trusted-device bridge code verification: sessionUUID=a7a6c0e1... nextStep=2 txnid=2300_5453585...
2026-08-15 12:38:34,158 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 2 with sessionUUID=a7a6c0e1...
2026-08-15 12:38:34,158 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/2
2026-08-15 12:38:34,505 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/2 HTTP/1.1" 200 None
2026-08-15 12:38:34,507 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:38:34,509 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:38:35,584 DEBUG pyicloud.hsa2_bridge: Acknowledged trusted-device push message id=327485396 topic=com.apple.idmsauthwidget
2026-08-15 12:38:35,585 DEBUG pyicloud.hsa2_bridge: Decoded trusted-device bridge payload: sessionUUID=a7a6c0e1... nextStep=4 txnid=2300_5359112... ec=0 has_data=True has_encryptedCode=False
2026-08-15 12:38:35,585 DEBUG pyicloud.hsa2_bridge: Received trusted-device bridge payload: sessionUUID=a7a6c0e1... nextStep=4 txnid=2300_5359112...
2026-08-15 12:38:35,585 DEBUG pyicloud.hsa2_bridge: Processing trusted-device bridge step 4 payload for sessionUUID=a7a6c0e1...
2026-08-15 12:38:35,615 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge step 4 with sessionUUID=a7a6c0e1...
2026-08-15 12:38:35,615 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/4
2026-08-15 12:38:36,016 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/4 HTTP/1.1" 200 None
2026-08-15 12:38:36,018 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:38:36,020 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:38:37,529 DEBUG pyicloud.hsa2_bridge: Acknowledged trusted-device push message id=3981355170 topic=com.apple.idmsauthwidget
2026-08-15 12:38:37,529 DEBUG pyicloud.hsa2_bridge: Decoded trusted-device bridge payload: sessionUUID=a7a6c0e1... nextStep=4 txnid=2300_6154945... ec=0 has_data=False has_encryptedCode=True
2026-08-15 12:38:37,530 DEBUG pyicloud.hsa2_bridge: Received trusted-device bridge final payload: sessionUUID=a7a6c0e1... nextStep=4 txnid=2300_6154945...
2026-08-15 12:38:37,530 DEBUG pyicloud.hsa2_bridge: Decrypting trusted-device bridge code for sessionUUID=a7a6c0e1...
2026-08-15 12:38:37,530 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/code/validate
2026-08-15 12:38:38,133 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/code/validate HTTP/1.1" 409 None
2026-08-15 12:38:38,135 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:38:38,136 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:38:38,136 DEBUG pyicloud.hsa2_bridge: Posting trusted-device bridge completion step 4 with sessionUUID=a7a6c0e1... verifyStatus=409
2026-08-15 12:38:38,136 DEBUG pyicloud.session: POST https://idmsa.apple.com/appleauth/auth/bridge/step/4
2026-08-15 12:38:38,674 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "POST /appleauth/auth/bridge/step/4 HTTP/1.1" 200 None
2026-08-15 12:38:38,675 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:38:38,675 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:38:38,676 DEBUG pyicloud.base: Code verification successful.
2026-08-15 12:38:38,676 DEBUG pyicloud.session: GET https://idmsa.apple.com/appleauth/auth/2sv/trust
2026-08-15 12:38:39,056 DEBUG urllib3.connectionpool: https://idmsa.apple.com:443 "GET /appleauth/auth/2sv/trust HTTP/1.1" 204 0
2026-08-15 12:38:39,058 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:38:39,061 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:38:39,061 DEBUG pyicloud.session: POST https://setup.icloud.com/setup/ws/1/accountLogin
2026-08-15 12:38:39,064 DEBUG urllib3.connectionpool: Resetting dropped connection: setup.icloud.com
2026-08-15 12:38:39,614 DEBUG urllib3.connectionpool: https://setup.icloud.com:443 "POST /setup/ws/1/accountLogin HTTP/1.1" 200 2015
2026-08-15 12:38:39,651 DEBUG pyicloud.session: Saved session data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.session
2026-08-15 12:38:39,654 DEBUG pyicloud.session: Saved cookies data to file: /var/lib/findmy2mqtt/sessions/jamo/jamoemaildomaincom.cookiejar
2026-08-15 12:38:39,654 DEBUG pyicloud.base: Session trust successful.
2026-08-15 12:38:39,655 INFO findmy2mqtt.apple: 2FA completed for jamo
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 15 August 2026, 13:18:04
das sieht richtig aus. die exceptions siehst du ja nur wegen --verbose. mach das mal ohne. dann sollte alles gut sein
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 15 August 2026, 13:55:36
DANKE, Super! Kommen die AirTags auch noch irgendwann?

Danke vielmals und noch ein schönes Wochenende!
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 15 August 2026, 14:02:34
Hier übrigens noch ein Codeschnipsel, mit dem man sich aus latitude/longitude die Adresse reverse e extrahieren kann. Ist damals für die Blitzer eingestellt worden
https://forum.fhem.de/index.php/topic,90014.msg884277.html#msg884277

Die sub getBlitzerOrte($$$$){ } setzt im device $Blitzerdev die Adresse, also Stadt/Strasse/etc
Dazu braucht man noch die sub getBlitzerOrteCallback, auch weiter unten im Codebeispiel vom link.

Also beides in die 99_MyUtils.pm kopieren, und dann getBlitzerOrte z.B. mit getBlitzerOrte(47.11234,12.6789,"1","devicename") aufrufen. Nach Aufruf der sub steht dann im device "devicename" die Adresse.


Auch noch eine vereinfachte Variante zur Distanzberechnung:
##########################################################
# Calculate distance between two geocoordinates
##########################################################
sub calcDistkm {
  my($latNew,$lonNew,$latOld,$lonOld) = @_;
  #Entfernung zur Home-Koordinate (Luftlinie)
  #Berechnung nach: https://www.kompf.de gps distcalc.html
  # Verbesserte Methode
  #my $lat = ($latNew + $latOld) / 2 * 0.01745;
  #my $dx  = 111.3 * cos($lat) * abs($lonNew - $lonOld);
  #my $dy  = 111.3 * abs($latNew - $latOld);
  if ($latNew && $lonNew && $latOld && $lonOld) {
    #Einfache Variante
    my $dx =  71.5 * abs($lonNew - $lonOld);
    my $dy = 111.3 * abs($latNew - $latOld);

    my $distance = sprintf("%.2f",sqrt($dx * $dx + $dy * $dy));
    return $distance;
  } else {return -9999};
}
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 15 August 2026, 14:04:02
Airtags sind leider ein richtiges Problem, weil Apple die ganz anders behandelt. PyiCloud unterstützt das leider nicht. Es gibt noch andere Libs, die beides können, aber dort ist der Funktionsumfang total eingeschränkt. Insbesondere kann man da nichts senden, also kein locate etc ausführen. Ich will auch nicht zwei getrennte Verbindungen aufbauen. Ich muss das erstmal untersuchen, welche Option es da gibt, das zu integrieren. Ich hab ja bewusst auf PyiCloud zurückgegriffen, weil ich den Overhead gering halten will. Es ging mir ja vor allem darum eine einfach (!) einzurichtende Verbindung herzustellen. Da gibts einfach nichts, was irgendwie brauchbar erscheint. Deswegen ja die Idee eine echte MQTT Bridge davor zu setzen nebst installer etc, damit das jeder ganz einfach einrichten kann. Ich hab das bei mir nun schon in FTUI umgesetzt, dass ich mein Handy direkt darüber orten kann ohne erst ein anderes apple gerät holen zu müssen. Das war die Hauptintention, aber Airtags wären in der Tat nice...
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 15 August 2026, 14:06:46
Zitat von: Jamo am 15 August 2026, 14:02:34Hier übrigens noch ein Codeschnipsel, mit dem man sich aus latitude/longitude die Adresse reverse e extrahieren kann. Ist damals für die Blitzer eingestellt worden
https://forum.fhem.de/index.php/topic,90014.msg884277.html#msg884277

Die sub getBlitzerOrte($$$$){ } setzt im device $Blitzerdev die Adresse, also Stadt/Strasse/etc
Dazu braucht man noch die sub getBlitzerOrteCallback, auch weiter unten im Codebeispiel vom link.
Das ist auch gut, damit könnte man theoretisch sogar recht easy ein einfaches DOIF erstellen, was erkennt, wenn jemand nach hause kommt. Man müsste ja nur die Distanz entsprechend validieren. Für die Einbindung einer Karte müßten lon/lat ja schon genügen.
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: CQuadrat am 15 August 2026, 14:37:51
Ich prüfe, ob jemand zuhause ist, über die Entfernung. Dazu folgendes Codeschnipsel für die 99_myUtils:
sub myDistance ($$) {
  my ($lat,$lon) = @_;
  $lat = $lat*pi/180;
  $lon = $lon*pi/180;
  my $lat_B29 = AttrVal("global","latitude",0)*pi/180 ;
  my $lon_B29 = AttrVal("global","longitude",0)*pi/180;
  my $earthRadius = 6371.0;

  my $distance = great_circle_distance($lon, pi/2 - $lat, $lon_B29, pi/2 - $lat_B29, $earthRadius);
  return $distance;
}
Im global-Device müssen dann natürlich die Koordinaten von zuhause gesetzt sein.

Und dann kann man das über ein Userreading im Apple-Device einfach berechnen:
attr MQTT2_findmy2mqttiPhone userReadings distance:state_longitude.* { my $distance = myDistance(ReadingsNum($name,"state_latitude",0),ReadingsNum($name,"state_longitude",0)) }

Mit weiteren Devices lässt sich dann einfach über die ermittelte Entfernung auf An- und Abwesenheit prüfen.


Nachtrag:
In der 99_myUtils benötigt man dann ggf. noch ein paar mathematische Perl-Pakete:
use Math::Trig ':pi';
use Math::Trig 'great_circle_distance';
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 15 August 2026, 14:54:20
dann kann man das aber auch direkt komplett umsetzen @CQuadrat ;D

defmod DOIF.FindMy.AndreasiPhone.Distance DOIF ([FindMy.AndreasiPhone:distance:d] >= 0){\
my $new = ReadingsNum("$DEVICE","distance",0);;\
my $d1 = ReadingsNum("$SELF","distance_1",0);;\
my $d2 = ReadingsNum("$SELF","distance_2",0);;\
my $position = "away";;\
\
if ($new < 0.05) { \
$position = "home";;\
} elsif ($new <= 0.25) { \
$position = "nearby";;\
} elsif ($new < $d1 && $d1 < $d2) {\
$position = "home comming";;\
} \
\
fhem("setreading $SELF distance_3 $d2");;\
fhem("setreading $SELF distance_2 $d1");;\
fhem("setreading $SELF distance_1 $new");;\
fhem("setreading $SELF position $position");;\
}
attr DOIF.FindMy.AndreasiPhone.Distance do always
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: CQuadrat am 17 August 2026, 10:56:46
So wie ich es sehe, muss ich als Passwort mein Apple-Account-Passwort verwenden.

Apple bietet aber auch die Möglichkeit, Anwendungsspezifische Passwörter zu vergeben. Ist denn vorgesehen, dass die Authentifizierung auch damit realisiert wird?
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 17 August 2026, 11:43:50
richtig. es erfordert deinen apple login. das passwort wird aber nicht direkt im klartext und dann auch nur im keyvaluestore von fhem gespeichert.

pyicloud meldet sich an der iCloud-Webanwendung an und durchläuft danach Apples 2FA-Verfahren. Anwendungsspezifische Passwörter sind vor allem für Dienste wie iCloud Mail, Kontakte und Kalender vorgesehen, nicht für den verwendeten ,,Wo ist?"-Webdienst. Ich kann das der Apple Doku nicht entnehmen, dass das auch für Wo ist? funktioniert: https://support.apple.com/de-at/102654 . man müsste erstmal rausfinden, ob das überhaupt für wo ist funktioniert. wäre mir auch lieber. Mit 2FA ist das aber hinnehmbar - jedenfalls für mich
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: ironalf am 21 August 2026, 17:01:12
Zitat von: Jamo am 15 August 2026, 14:02:34Hier übrigens noch ein Codeschnipsel, mit dem man sich aus latitude/longitude die Adresse reverse e extrahieren kann. Ist damals für die Blitzer eingestellt worden
https://forum.fhem.de/index.php/topic,90014.msg884277.html#msg884277

Die sub getBlitzerOrte($$$$){ } setzt im device $Blitzerdev die Adresse, also Stadt/Strasse/etc
Dazu braucht man noch die sub getBlitzerOrteCallback, auch weiter unten im Codebeispiel vom link.

Also beides in die 99_MyUtils.pm kopieren, und dann getBlitzerOrte z.B. mit getBlitzerOrte(47.11234,12.6789,"1","devicename") aufrufen. Nach Aufruf der sub steht dann im device "devicename" die Adresse.


Ich erhalte nur den Ort aber keine Strasse(01Ort Bocholt Bocholt).
{getBlitzerOrte(51.839126525965206,6.618721170591489,"1","fm_xxxxxxx")}
sub getBlitzerOrte und sub getBlitzerOrteCallback sind vorhanden.
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 22 August 2026, 13:53:15
Deswegen heisst die sub ja auch 'getBlitzerORTE...'
Ich habe die sub um PLZ, Strasse und Hausnummer ergänzt.

sub getBlitzerOrteCallback($) {
    my ($param, $err, $data) = @_;
    my $hash = $param->{hash};
    my $BlitzerDev = $hash->{blitzerdev};
my $num = $hash->{num};

    if($err ne "")      # wenn ein Fehler bei der HTTP Abfrage aufgetreten ist
    {
        Log3 "[getBlitzerOrte]", 3, "error while requesting ".$param->{url}." - $err";   # Eintrag fürs Log
    }
#Log 1,"[getBlitzerOrte] $BlitzerDev ".$param->{data}." ".$param->{url}." ".$param->{httpheader}." ".$param->{code};
#Log 1,"$data";
my $Ort = "";
my $postcode     = ' ';
my $road         = ' ';
my $house_number = ' ';
my ($Ort) = $data =~ m/suburb":"([^"]+)"/;
if ((!defined $Ort) or ($Ort eq "")){
#Log 1, "[getBlitzerOrteCallback] search city_district";
        ($Ort) = $data =~ m/city_district":"([^"]+)"/;
#Log 1, "[getBlitzerOrteCallback] $Ort";
    }
if ((!defined $Ort) or ($Ort eq "")){
#Log 1, "[getBlitzerOrteCallback] search town $data";
        ($Ort) = $data =~ m/town":"([^"]+)"/;
#Log 1, "[getBlitzerOrteCallback] $Ort";
    }
if ((!defined $Ort) or ($Ort eq "")){
#Log 1, "[getBlitzerOrteCallback] search village $data";
        ($Ort) = $data =~ m/village":"([^"]+)"/;
#Log 1, "[getBlitzerOrteCallback] $Ort";
    }
    if ((!defined $Ort) or ($Ort eq "")){
#Log 1, "[getBlitzerOrteCallback] $Ort";
Log 5, "[getBlitzerOrteCallback] ".$param->{url};
Log 5, "[getBlitzerOrteCallback] $data";
        $Ort = ".";
    }
    my ($building) = $data =~ m/building":"([^"]+)"/;
    if ((!defined $building) or ($building eq "")){
        $building = ".";
    }
    ($postcode) = $data =~ m/postcode":"([^"]+)"/;
    if ((!defined $postcode) or ($postcode eq "")){
        $postcode = '';
    }
    ($road) = $data =~ m/road":"([^"]+)"/;
    if ((!defined $road) or ($road eq '')){
        ($road) = $data =~ m/path":"([^"]+)"/;
    }
    if ((!defined $road) or ($road eq '')){
        ($road) = $data =~ m/bridleway":"([^"]+)"/;
    }   
    if ((!defined $road) or ($road eq '')){
        ($road) = $data =~ m/pedestrian":"([^"]+)"/;
    }
    if ((!defined $road) or ($road eq '')){
        ($road) = $data =~ m/footway":"([^"]+)"/;
    }
    if ((!defined $road) or ($road eq '')){
        ($road) = $data =~ m/square":"([^"]+)"/;
    }
    if ((!defined $road) or ($road eq '')){
        ($road) = $data =~ m/neighbourhood":"([^"]+)"/;
    }
    if ((!defined $road) or ($road eq '')){
        ($road) = $data =~ m/city_block":"([^"]+)"/;
    }
    if ((!defined $road) or ($road eq '')){
        $road = '';
    }
    ($house_number) = $data =~ m/house_number":"([^"]+)"/;
    if ((!defined $house_number) or ($house_number eq "")){
        $house_number = '';
    }
    Log 5,"[getBlitzerOrteCallback] $Ort $building";
    #Log 1,"[getBlitzerOrte] ".$decoded_json->{address}->{suburb}->[0];
    fhem("setreading $BlitzerDev ".$num."PLZ $postcode Ort $Ort Strasse $road Hausnummer $house_number");
    fhem("setreading $BlitzerDev ".$num."Building $building");
}
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: ironalf am 23 August 2026, 12:01:45
Danke dir für die schnelle Anpassung der sub :D
Ich musste nur eine kleine Änderung vornehemen:
fhem("setreading $BlitzerDev ".$num."PLZ $postcode Ort $Ort Strasse $road Hausnummer $house_Number"); > fhem("setreading $BlitzerDev ".$num."PLZ $postcode Ort $Ort Strasse $road Hausnummer $house_number")
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Jamo am 23 August 2026, 12:15:35
Zitat von: ironalf am 23 August 2026, 12:01:45Danke dir für die schnelle Anpassung der sub :D
Ich musste nur eine kleine Änderung vornehemen:
fhem("setreading $BlitzerDev ".$num."PLZ $postcode Ort $Ort Strasse $road Hausnummer $house_Number"); > fhem("setreading $BlitzerDev ".$num."PLZ $postcode Ort $Ort Strasse $road Hausnummer $house_number")
Danke, habs verbessert!
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: KyleK am 24 September 2026, 11:18:50
Hallo,

bei mir funktioniert findmy2mqtt seit ein paar Tagen nicht mehr.
ich bekomme jetzt beim Versuch, mich zu authentifizieren folgende Fehlermeldung:
2026-09-24 11:13:18,058 ERROR findmy2mqtt: You must accept the updated terms of service to continue. Set --accept-terms to accept them

Das scheint eine Option von pyicloud zu sein, weil findmy2mqtt besitzt diesen Schalter nicht.
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: Guybrush am 24 September 2026, 20:37:53
Ich schau mir das an. Findmy2mqtt ist nur ein wrapper. Wenn das daran liegt bau ich das als Option aber ein, das man das per mqtt dann auch sieht/machen kann
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: KyleK am 25 September 2026, 09:48:13
ich konnte das Problem lokal lösen, indem ich folgende Änderung vorgenommen hab:
diff --git a/lib/apple.py b/lib/apple.py
index 42f88fe..91d824f 100644
--- a/lib/apple.py
+++ b/lib/apple.py
@@ -64,6 +64,7 @@ def create_api(
         # bewusst seltener und dient nur als Fallback.
         refresh_interval=max(config.pollInterval * 2, 60),
         authenticate=authenticate,
+        accept_terms=True
     )
Titel: Aw: Apples Wo Ist? Integration in FHEM
Beitrag von: ironalf am 27 September 2026, 10:35:02
Apple hat die iCloud-Nutzungsbedingungen geändert und die müssen erst akzeptiert werden.
Entweder auf dem Gerät oder bei iCloud anmelden.