跳转到主要内容

与Abode家庭安全系统交互的库

项目描述

https://img.shields.io/pypi/v/jaraco.abode.svg https://img.shields.io/pypi/pyversions/jaraco.abode.svg tests Ruff https://readthedocs.org/projects/jaracoabode/badge/?version=latest https://img.shields.io/badge/skeleton-2024-informational

Abode报警API的Python库。

免责声明

“Abode”是Abode Systems, Inc.拥有的商标;更多信息请访问www.goabode.com。

感谢Abode提供了相对简单的API以便进行逆向工程。也许未来Abode会将其开放给官方使用。

不建议API调用时间少于60秒,因为这可能会压倒Abode的服务器。尽可能多地利用云推送事件通知功能。请负责任地使用此模块。

命令行用法

简单的命令行实现参数

$ abode --help
usage: abode [-h] [-u USERNAME] [-p PASSWORD] [--mfa MFA] [--cache pickle_file]
             [--mode] [--arm mode] [--set setting=value] [--devices]
             [--device device_id] [--json device_id] [--on device_id] [--off device_id]
             [--lock device_id] [--unlock device_id] [--automations]
             [--activate automation_id] [--deactivate automation_id]
             [--trigger automation_id] [--capture device_id] [--stream device_id]
             [--image device_id=location/image.jpg] [--listen] [--debug] [--quiet]

options:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME
                        Username
  -p PASSWORD, --password PASSWORD
                        Password
  --mfa MFA             Multifactor authentication code
  --cache pickle_file   Create/update/use a pickle cache for the username and password.
  --mode                Output current alarm mode
  --arm mode            Arm alarm to mode
  --set setting=value   Set setting to a value
  --devices             Output all devices
  --device device_id    Output one device for device_id
  --json device_id      Output the json for device_id
  --on device_id        Switch on a given device_id
  --off device_id       Switch off a given device_id
  --lock device_id      Lock a given device_id
  --unlock device_id    Unlock a given device_id
  --automations         Output all automations
  --activate automation_id
                        Activate (enable) an automation by automation_id
  --deactivate automation_id
                        Deactivate (disable) an automation by automation_id
  --trigger automation_id
                        Trigger (apply) a manual (quick) automation by automation_id
  --capture device_id   Trigger a new image capture for the given device_id
  --stream device_id    Start a new KVS video stream for the given device_id
  --image device_id=location/image.jpg
                        Save an image from a camera (if available) to the given path
  --listen              Block and listen for device_id
  --debug               Enable debug logging
  --quiet               Output only warnings and errors

第一次调用,只需登录

$ abode --username happy-customer@example.com
Password for happy-customer@example.com:
2022-10-18 20:30:18 INFO (MainThread) [jaraco.abode] Updating all devices...
2022-10-18 20:30:18 INFO (MainThread) [jaraco.abode] Login successful
2022-10-18 20:30:19 INFO (MainThread) [jaraco.abode] Logout successful

每次调用时传递--username或在环境中设置环境变量ABODE_USERNAME

获取当前的报警模式

$ abode --mode

  Mode: standby

将报警模式设置为“待机”、“家庭”或“外出”之一

$ abode --arm home

  Mode set to: home

列出所有设备和它们的当前状态

$ abode --devices

  Device Name: Glass Break Sensor, Device ID: RF:xxxxxxxx, Device Type: GLASS, Device Status: Online
  Device Name: Keypad, Device ID: RF:xxxxxxxx, Device Type: Keypad, Device Status: Online
  Device Name: Remote, Device ID: RF:xxxxxxxx, Device Type: Remote Controller, Device Status: Online
  Device Name: Garage Entry Door, Device ID: RF:xxxxxxxx, Device Type: Door Contact, Device Status: Closed
  Device Name: Front Door, Device ID: RF:xxxxxxxx, Device Type: Door Contact, Device Status: Closed
  Device Name: Back Door, Device ID: RF:xxxxxxxx, Device Type: Door Contact, Device Status: Closed
  Device Name: Status Indicator, Device ID: ZB:xxxxxxxx, Device Type: Status Display, Device Status: Online
  Device Name: Downstairs Motion Camera, Device ID: ZB:xxxxxxxx, Device Type: Motion Camera, Device Status: Online
  Device Name: Back Door Deadbolt, Device ID: ZW:xxxxxxxx, Device Type: Door Lock, Device Status: LockClosed
  Device Name: Front Door Deadbolt, Device ID: ZW:xxxxxxxx, Device Type: Door Lock, Device Status: LockClosed
  Device Name: Garage Door Deadbolt, Device ID: ZW:xxxxxxxx, Device Type: Door Lock, Device Status: LockClosed
  Device Name: Alarm area_1, Device ID: area_1, Device Type: Alarm, Device Status: standby

使用设备ID查询特定设备的当前状态

$ abode --device ZW:xxxxxxxx

  Device Name: Garage Door Deadbolt, Device ID: ZW:xxxxxxxx, Device Type: Door Lock, Device Status: LockClosed

通过设备ID查询多个特定设备

$ abode --device ZW:xxxxxxxx --device RF:xxxxxxxx

  Device Name: Garage Door Deadbolt, Device ID: ZW:xxxxxxxx, Device Type: Door Lock, Device Status: LockClosed
  Device Name: Back Door, Device ID: RF:xxxxxxxx, Device Type: Door Contact, Device Status: Closed

通过传递多个参数开关设备,或锁定和解锁设备

$ abode --lock ZW:xxxxxxxx --switchOn ZW:xxxxxxxx

  Locked device with id: ZW:xxxxxxxx
  Switched on device with id: ZW:xxxxxxxx

拦截并监听所有模式和更改事件

$ abode --listen

  No devices specified, adding all devices to listener...
  Listening for device updates...
  Device Name: Alarm area_1, Device ID: area_1, Status: standby, At: 2017-05-27 11:13:08
  Device Name: Garage Door Deadbolt, Device ID: ZW:xxxxxxxx, Status: LockOpen, At: 2017-05-27 11:13:31
  Device Name: Garage Entry Door, Device ID: RF:xxxxxxxx, Status: Open, At: 2017-05-27 11:13:34
  Device Name: Garage Entry Door, Device ID: RF:xxxxxxxx, Status: Closed, At: 2017-05-27 11:13:39
  Device Name: Garage Door Deadbolt, Device ID: ZW:xxxxxxxx, Status: LockClosed, At: 2017-05-27 11:13:41
  Device Name: Alarm area_1, Device ID: area_1, Status: home, At: 2017-05-27 11:13:59
  Device update listening stopped.

如果您指定了一个或多个设备与--device参数以及--listen命令,则只有这些设备将监听更改事件。

通过按键盘中断(CTRL+C)退出监听模式。

获取自动化列表

$ abode --automations

  Deadbolts Lock Home (ID: 6) - status - active
  Auto Home (ID: 3) - location - active
  Lock Garage Quick Action (ID: 7) - manual - active
  Deadbolts Lock Away (ID: 5) - status - active
  Autostandby (ID: 4) - schedule - active
  Auto Away (ID: 2) - location - active
  Sleep Mode (ID: 1) - schedule - active

激活或停用自动化

$ abode --activate 1

  Activated automation with id: 1

触发手动(快速)自动化

$ abode --trigger 7

  Triggered automation with id: 1

设置

使用 abode.set_setting(setting, value) 或通过命令行更改设置

$ abode --set beeper_mute=1

  Setting beeper_mute changed to 1

设置

有效值

ircamera_resolution_t

0 为 320x240x3,2 为 640x480x3

ircamera_gray_t

0 为禁用,1 为启用

beeper_mute

0 为禁用,1 为启用

away_entry_delay

0, 10, 20, 30, 60, 120, 180, 240

away_exit_delay

30, 60, 120, 180, 240

home_entry_delay

0, 10, 20, 30, 60, 120, 180, 240

home_exit_delay

0, 10, 20, 30, 60, 120, 180, 240

door_chime

无,正常,响亮

warning_beep

无,正常,响亮

entry_beep_away

无,正常,响亮

exit_beep_away

无,正常,响亮

entry_beep_home

无,正常,响亮

exit_beep_home

无,正常,响亮

confirm_snd

无,正常,响亮

alarm_len

0, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900

final_beep

0, 3, 4, 5, 6, 7, 8, 9, 10

entry

(警报器)0 为禁用,1 为启用

tamper

(警报器)0 为禁用,1 为启用

confirm

(警报器)0 为禁用,1 为启用

由以下机构支持