Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
7
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Python SDK project called
catlink_sdk managed with Poetry and Python 3.11. It provides a Python interface for interacting with CatLink smart pet devices (litter boxes, feeders, etc.).
# Install dependencies poetry install # Add a new dependency poetry add <package-name> # Add a development dependency poetry add --group dev <package-name> # Update dependencies poetry update # Show installed packages poetry show
# Run Python scripts with Poetry's virtual environment poetry run python <script.py> # Activate virtual environment poetry shell # Run tests (once test framework is added) poetry run pytest
# Build the package poetry build # Publish to PyPI (requires configuration) poetry publish
pyproject.toml - Poetry configuration and project metadata.gitignore - Git ignore patterns for Python projectscatlink_sdk/ - Main SDK package
auth.py - Authentication handlingclient.py - Main client classconstants.py - API constants and device typesmodels/ - Device model classes
device.py - Base device classlitterbox.py - Litter box specific functionalityfeeder.py - Feeder device functionalityscooper.py - Scooper device functionalityconfig.py - Device configuration modelsvendors/catlink/ - Reference implementation from Home Assistant integrationimport asyncio from catlink_sdk import CatLinkClient, AdditionalDeviceConfig async def main(): # Initialize client client = CatLinkClient(phone="1234567890", password="password") # Optional: Configure device-specific settings device_configs = { "device_id_here": AdditionalDeviceConfig( empty_weight=5.0, # Empty litter box weight in kg max_samples_litter=24 # Number of weight samples to track ) } # Authenticate and get devices await client.authenticate() devices = await client.get_devices(device_configs) # Control a litter box or scooper for device in devices: if device.type in ["SCOOPER", "LITTER_BOX_599"]: await device.set_mode("auto") await device.execute_action("Cleaning") # Access device-specific properties print(f"Litter weight: {device.litter_weight} kg") print(f"Is occupied: {device.occupied}") print(f"Temperature: {device.temperature}°C") # Control a feeder for device in devices: if device.type == "FEEDER": await device.dispense_food(amount=10) # Dispense 10g of food # Close session await client.close() asyncio.run(main())
SDK 现在已经支持之前缺失的所有 36 个参数!包括:
atmosphere_model - 氛围灯模式light_color_model - 灯光颜色模式light_color - 当前灯光颜色indicator_light - 指示灯状态panel_tone - 面板提示音warning_tone - 警告音设置timing_settings - 定时清理配置数组near_enable_timing - 近场定时启用all_timing_toggle - 全部定时开关timer_times - 定时清理次数clear_times - 清理操作次数master - 主设备标识sharers - 共享用户列表firmware_version - 固件版本timezone_id - 时区IDgmt - GMT偏移real_model - 真实型号default_status - 默认状态current_message_type - 当前消息类型auto_update_pet_weight - 自动更新宠物体重pro_model - Pro型号标识support_weight_calibration - 支持重量校准high_edition - 高版本标识toilet_slice_flag - 厕所切片标志deodorization_status - 除臭状态box_installed - 垃圾盒安装状态sand_type - 猫砂类型support_box_testing - 支持垃圾盒测试error_alert_flag - 错误提醒标志quiet_enable - 静音模式启用ccare_temp_entrance - Ccare临时入口ccare_countdown_timestamp - Ccare倒计时时间戳show_buy_btn - 是否显示购买按钮good_url - 产品URLmall_code - 商城代码# 获取设备的所有新属性 device = await client.get_device("device_id") # 灯光控制 print(f"灯光颜色: {device.light_color}") print(f"指示灯状态: {device.indicator_light}") # 定时功能 if device.timing_settings: for timing in device.timing_settings: print(f"定时清理: {timing['timingHour']}:{timing['timingMin']}") # 设备信息 print(f"固件版本: {device.firmware_version}") print(f"是否Pro型号: {device.pro_model}") print(f"猫砂类型: {device.sand_type}") # 用户管理 if device.sharers: print(f"共享用户数: {len(device.sharers)}")