微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📍

Apple生态设备智能管家

icloud-findmy · vv1.0.0
效率 安全 S 级 作者 liamnichols 公开目录收录
下载 1.9k 安装 394 收藏 9.3k 浏览 8.7k
原始页面

简介

基于成熟开源项目pyicloud的文档型Skill,指导Claude通过iCloud CLI安全查询Apple设备位置与电池状态,实现家庭设备智能管理。

原始描述

Query Find My locations and battery status for family devices via iCloud.

中文使用说明 来自收录源

核心用法

iCloud Find My Skill是一个纯文档型指导工具,它教会Claude Agent如何通过pyicloud命令行工具访问Apple iCloud的Find My服务。用户需先通过pipx安装pyicloud,使用Apple ID完成一次性2FA认证(会话有效期1-2个月),之后即可查询所有家庭共享设备的实时位置、电池电量及充电状态。Skill提供了完整的命令模板和输出解析技巧,包括使用grep提取特定设备信息、用Python解析位置字典、格式化电池百分比等实用模式。

显著优点

架构安全:作为纯文档型Skill,本身不执行任何代码,完全依赖用户本地安装的可审计开源工具pyicloud,消除了代码注入风险。生态原生:直接调用Apple官方iCloud API,非逆向工程或私有接口,合规性与稳定性有保障。隐私设计:强制2FA认证、会话本地存储、数据零上传第三方,所有敏感信息仅在Apple生态内流转。实用场景丰富:支持电池预警(出行前检查)、位置上下文("附近"查询)、到家/离家检测、低电量提醒等主动智能场景。安装隔离:通过pipx安装实现Python环境隔离,不污染系统依赖。

潜在缺点与局限性

平台限制:仅支持macOS,iCloud API在其他平台存在兼容性问题。认证摩擦:2FA流程虽安全但增加使用门槛,且每1-2个月需重新认证。输出解析复杂:返回数据为Python字典字符串格式,需借助grep/sed/Python进行额外解析,非结构化JSON。实时性局限:位置更新频率约1-5分钟,电池数据可能缓存,不适合高精度实时追踪。命名陷阱:设备名称含Unicode特殊字符(如弯引号),大小写敏感,易导致匹配失败。网络依赖:设备离线、Find My或定位服务关闭时将无法获取数据。

适合的目标群体

Apple生态深度用户:已启用家庭共享、拥有多台Apple设备的家庭。效率自动化爱好者:希望将设备状态查询集成到个人工作流或日历提醒中的用户。智能家居玩家:需要基于位置触发自动化规则(如到家开灯、离家布防)的进阶用户。家长/设备管理员:需要关注家庭成员设备电量、确保联系畅通的场景。隐私敏感型用户:倾向数据本地处理、拒绝第三方云服务的位置查询方案。

使用风险

凭证管理风险:Apple ID密码需在命令行输入,虽有一次性特性,但用户可能在共享环境或历史记录中泄露。建议配置完成后立即清理shell历史。会话过期中断:自动化脚本若未处理认证过期场景,可能在关键时刻失效。需建立会话健康检查机制。依赖维护风险:pyicloud作为社区项目,若Apple API变更而维护滞后,可能导致功能中断。建议关注项目更新动态。位置精度误判:horizontalAccuracy字段反映定位误差范围,直接用于地理围栏可能产生误判,需结合误差半径处理。家庭共享边界:仅能查看已加入家庭共享的成员设备,且成员可随时关闭共享,存在权限动态变化风险。

技能正文


name: icloud-findmy description: Query Find My locations and battery status for family devices via iCloud. homepage: https://github.com/picklepete/pyicloud metadata: {"clawdbot":{"emoji":"📍","requires":{"bins":["icloud"]},"install":[{"id":"pipx","kind":"shell","command":"brew install pipx && pipx install pyicloud","bins":["icloud"],"label":"Install PyiCloud (pipx)"}]}}

iCloud Find My

Access Find My device locations and battery status via the iCloud CLI (pyicloud).

Setup

  1. Install pyicloud:
brew install pipx
pipx install pyicloud
  1. Authenticate (one-time):

Ask the user for their Apple ID, then run:

icloud --username their.email@example.com --with-family --list

They'll need to enter their password and complete 2FA. The session will be saved and lasts 1-2 months.

  1. Store Apple ID:

Add the Apple ID to your TOOLS.md or workspace config so you remember it for future queries:

## iCloud Find My
Apple ID: their.email@example.com

Usage

List all devices

icloud --username APPLE_ID --with-family --list

Output format:

------------------------------
Name           - Liam's iPhone
Display Name   - iPhone 15 Pro
Location       - {'latitude': 52.248, 'longitude': 0.761, 'timeStamp': 1767810759054, ...}
Battery Level  - 0.72
Battery Status - NotCharging
Device Class   - iPhone
------------------------------

Parsing tips:

  • Devices are separated by ------------------------------
  • Location is a Python dict (use eval() or parse with regex)
  • Battery Level is 0.0-1.0 (multiply by 100 for percentage)
  • Battery Status: "Charging" or "NotCharging"
  • Location fields: latitude, longitude, timeStamp (milliseconds), horizontalAccuracy

Get specific device

Find a specific device by grepping the output:

icloud --username APPLE_ID --with-family --list | grep -A 10 "iPhone"

Parse location

Extract and format location data:

icloud --username APPLE_ID --with-family --list | \
  grep -A 10 "Device Name" | \
  grep "Location" | \
  sed "s/Location.*- //"

Then parse the Python dict string with Python or extract coordinates with regex.

Parse battery

icloud --username APPLE_ID --with-family --list | \
  grep -A 10 "Device Name" | \
  grep "Battery Level"

Device Names

Device names come from iCloud and may include:

  • Fancy Unicode apostrophes (U+2019 ') instead of ASCII '
  • No apostrophes at all (e.g., "Lindas iPhone")

Use case-insensitive matching and normalize apostrophes if needed.

Session Management

  • Sessions last 1-2 months
  • Stored in user's home directory
  • When expired, re-run the authentication step
  • PyiCloud validates automatically on each request

Common Patterns

Check battery before going out:

# Get battery for specific device
icloud --username ID --with-family --list | \
  grep -B 2 -A 5 "iPhone" | \
  grep "Battery Level"

Get current location:

# Extract location dict and parse coordinates
icloud --username ID --with-family --list | \
  grep -A 10 "iPhone" | \
  grep "Location" | \
  sed "s/.*- //" | \
  python3 -c "import sys; loc = eval(sys.stdin.read()); print(f\"{loc['latitude']}, {loc['longitude']}\")"

Check if device is charging:

icloud --username ID --with-family --list | \
  grep -A 10 "iPhone" | \
  grep "Battery Status"

Proactive Use Cases

  • Battery warnings: Check battery levels before calendar events (going out)
  • Location context: Answer "near me" queries by checking user's current location
  • Home/away detection: Check if user is at home based on coordinates
  • Low battery alerts: Warn if battery <30% and not charging

Troubleshooting

Authentication errors:

  • Session expired - re-authenticate
  • Wrong Apple ID - check stored ID
  • 2FA required - complete 2FA flow

No location available:

  • Device offline
  • Find My disabled
  • Location Services off

Device not found:

  • Check exact device name with --list
  • Names are case-sensitive
  • May have Unicode apostrophes

Notes

  • Requires macOS (iCloud API quirks)
  • Family Sharing must be enabled to see family devices
  • Location updates every ~1-5 minutes when device is active
  • Battery readings may be cached (check timestamp)

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

productivityautomationmobilefamily-sharinglocation-servicesapple-ecosystem

同类 Skill