运行在python 3上的abode alarm python库。

abodep的Python项目详细描述


Python居Build StatusCoverage Status

用于abode警报api的瘦python库。 仅与Python 3+兼容

免责声明:

在麻省理工学院的许可下发布-请参阅许可文件以了解更多详细信息。

“Abode”是Abode Systems Inc.拥有的商标,有关详细信息,请参见www.goabode.com。 我决不属于这所房子。

感谢abode提供了一个相对简单的反向工程api。希望将来你能 打开供官方使用。

不建议API调用速度超过60秒,因为它可能会压倒Abode的服务器。利用云推动 尽可能多的事件通知功能。请负责任地使用本模块。

安装

来自PYPI:

pip3 install abodepy

命令行用法

简单的命令行实现参数:

$ abodepy --help
  usage: AbodePy: Command Line Utility [-h] -u USERNAME -p PASSWORD [--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] [--listen]
                                       [--debug] [--quiet]

  optional arguments:
    -h, --help            show this help message and exit
    -u USERNAME, --username USERNAME
                          Username
    -p PASSWORD, --password PASSWORD
                          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) an automation (manual quick-action) by
                          automation_id
    --listen              Block and listen for device_id
    --debug               Enable debug logging
    --quiet               Output only warnings and errors

您可以获得当前的报警模式:

$ abodepy -u USERNAME -p PASSWORD --mode

  Mode: standby

要设置报警模式,请选择“待机”、“主页”或“离开”:

$ abodepy -u USERNAME -p PASSWORD --arm home

  Mode set to: home

设备及其当前状态的完整列表:

$ abodepy -u USERNAME -p PASSWORD --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的特定设备的当前状态:

$ abodepy -u USERNAME -p PASSWORD --device ZW:xxxxxxxx

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

此外,多个使用设备ID的特定设备:

$ abodepy -u USERNAME -p PASSWORD --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

您可以打开或关闭设备,也可以通过传递多个参数来锁定和解锁设备:

$ abodepy -u USERNAME -p PASSWORD --lock ZW:xxxxxxxx --switchOn ZW:xxxxxxxx

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

您还可以阻止和侦听所有模式,并在事件发生时更改它们:

$ abodepy -u USERNAME -p PASSWORD --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)退出收听模式。

要获取自动操作列表:

$ abodepy -u USERNAME -p PASSWORD --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

要激活或停用自动化,请执行以下操作:

$ abodepy -u USERNAME -p PASSWORD --activate 1

  Activated automation with id: 1

触发手动(快速)自动化:

$ abodepy -u USERNAME -p PASSWORD --trigger 7

  Triggered automation with id: 1

设置

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

$ abodepy -u USERNAME -p PASSWORD --set beeper_mute=1

  Setting beeper_mute changed to 1
SettingValid Values
ircamera_resolution_t0 for 320x240x3, 2 for 640x480x3
ircamera_gray_t0 for disabled, 1 for enabled
beeper_mute0 for disabled, 1 for enabled
away_entry_delay0, 10, 20, 30, 60, 120, 180, 240
away_exit_delay30, 60, 120, 180, 240
home_entry_delay0, 10, 20, 30, 60, 120, 180, 240
home_exit_delay0, 10, 20, 30, 60, 120, 180, 240
door_chimenone, normal, loud
warning_beepnone, normal, loud
entry_beep_awaynone, normal, loud
exit_beep_awaynone, normal, loud
entry_beep_homenone, normal, loud
exit_beep_homenone, normal, loud
confirm_sndnone, normal, loud
alarm_len0, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900
final_beep0, 3, 4, 5, 6, 7, 8, 9, 10
entry(Siren) 0 for disabled, 1 for enabled
tamper(Siren) 0 for disabled, 1 for enabled
confirm(Siren) 0 for disabled, 1 for enabled

开发和测试

安装核心依赖项:

$ sudo apt-get install python3-pip python3-dev python3-venv

从github签出,然后创建一个虚拟环境:

$ git clone https://github.com/MisterWil/abodepy.git
$ cd abodepy
$ python3 -m venv venv

激活虚拟环境:

$ source venv/bin/activate

安装要求:

$ pip install -r requirements.txt -r requirements_test.txt

在“可编辑模式”下本地安装abodepy:

$ pip3 install -e .

在提交之前运行带有tox的完整测试套件:

$ tox

或者,您可以只运行测试:

$ tox -e py35

库使用

待办事项

类说明

待办事项

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
ArrayList Java中的搜索字符串   另一个web应用程序的java访问会话   另一个应用程序中的活动和服务之间的java通信   java根据Json字符串类型将Json字符串转换为对象   eclipse如何解决java中的错误异常。lang.NoSuchMethodError:'java。字符串javax。摆动JOptionPane。showInputDialog(java.lang.String)'   线程“main”java中的安卓异常。lang.NoClassDefFoundError:org/codehaus/jackson/JsonParseException   java如何在安卓 emulator上显示Mat图像?使用NDK   Java在本地读取测试源文件,但在服务器上读取失败   java dowhile循环用于计算输入数字中的数字。故障排除代码   JAva初学者在编写获取成本的方法时遇到困难   java是shell游戏。我如何让物体移动,特别是在特定的曲线上,但顺序是随机的?   java如何区分两个同名的JButton   java为什么我在Spring Boot中需要一个接口?   java将文件路径插入数据库将删除\   使用InterfaceType初始化java对象   java如何部署一个分为Angular、Spring Boot和MySQL的项目?   java如何使用Symja解决不等式?