跳转到主要内容

连接到GogoGate2和iSmartGate集线器的库

项目描述

Python gogogate2-api 构建状态 覆盖率状态 PyPI

控制GogoGate2和iSmartGate设备的Python库

安装

pip install gogogate2-api

命令中的使用

$ gogogate2 --help
Usage: gogogate2 [OPTIONS] COMMAND [ARGS]...

  Interact with the device API.

Options:
  --host TEXT      [required]
  --username TEXT  [required]
  --password TEXT  Omit for interactive prompt. Use '-' to read from stdin.
  --version        Show the version and exit.
  --help           Show this message and exit.

Commands:
  close  Close the door.
  info   Get info from device.
  open   Open the door.


$ ismartgate --help
Usage: ismartgate [OPTIONS] COMMAND [ARGS]...

  Interact with the device API.

Options:
  --host TEXT      [required]
  --username TEXT  [required]
  --password TEXT  Omit for interactive prompt. Use '-' to read from stdin.
  --version        Show the version and exit.
  --help           Show this message and exit.

Commands:
  close  Close the door.
  info   Get info from device.
  open   Open the door.

代码中的使用

from gogogate2_api import GogoGate2Api, ISmartGateApi

# GogoGate2 API
gogogate2_api = GogoGate2Api("10.10.0.23", "admin", "password")

# Get info about device and all doors.
await gogogate2_api.async_info()

# Open/close door.
await gogogate2_api.async_open_door(1)
await gogogate2_api.async_close_door(1)


# iSmartGate API
ismartgate_api = ISmartGateApi("10.10.0.24", "admin", "password")

# Get info about device and all doors.
await ismartgate_api.async_info()

# Open/close door.
await ismartgate_api.async_open_door(1)
await ismartgate_api.async_close_door(1)

构建

项目构建、测试和代码检查全部通过一个脚本完成。您只需要几个依赖项。

依赖项

  • 路径中的python3。
  • python3的venv模块。

构建脚本将设置venv、依赖项、测试和代码检查并将项目打包。

./scripts/build.sh

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪一个,请了解有关安装包的更多信息。

源分发

gogogate2_api-3.0.1.tar.gz (12.5 kB 查看哈希值)

上传时间

构建分发

gogogate2_api-3.0.1-py3-none-any.whl (12.7 kB 查看哈希值)

上传时间 Python 3

支持者