跳转到主要内容

为Sonoff DIY设备提供的异步Python客户端。

项目描述

Python: 为Sonoff DIY设备提供的异步客户端

GitHub Release Project Stage Project Maintenance License

Build Status Code Coverage Code Quality

Buy me a coffee

Support my work on Patreon

为Sonoff DIY设备提供的异步Python客户端。

关于

此软件包允许您以编程方式控制和监视Sonoff DIY设备。它主要创建用于允许第三方程序自动化Sonoff DIY设备的行为。

一个很好的例子可能是Home Assistant,它允许您编写自动化,当孩子们回家时打开家长控制。

安装

pip install sonoffdiy

使用

import asyncio

from sonoffdiy import SonoffDIY


async def main(loop):
    """Show example on controlling your Sonoff DIY device."""
    async with SonoffDIY("10.10.10.197", device_id="100090bc7b", loop=loop) as diy:
        info = await diy.update_info()
        print(info)

        if not info.on:
            await diy.turn_on()
        else:
            await diy.turn_off()


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main(loop))

变更日志 & 发布

此存储库使用GitHub的发布功能维护变更日志。日志格式基于Keep a Changelog

发布基于语义版本,并使用MAJOR.MINOR.PATCH格式。简而言之,版本号将根据以下规则递增

  • MAJOR:不兼容或主要更改。
  • MINOR:向后兼容的新功能和增强。
  • PATCH:向后兼容的修复和包更新。

贡献

这是一个活跃的开源项目。我们始终欢迎希望使用或贡献代码的人。

我们已为贡献指南设置了一个单独的文档。

感谢您的参与! :heart_eyes

设置开发环境

如果您想贡献,已包含一个Makefile以确保快速开始。

make venv
source ./venv/bin/activate
make dev

现在您可以开始开发了,不带参数运行 make 命令以查看所有可用的 make 目标(包括描述)。

$ make
Asynchronous Python client for Sonoff DIY devices.

Usage:
  make help                            Shows this message.
  make dev                             Set up a development environment.
  make lint                            Run all linters.
  make lint-black                      Run linting using black & blacken-docs.
  make lint-flake8                     Run linting using flake8 (pycodestyle/pydocstyle).
  make lint-pylint                     Run linting using PyLint.
  make lint-mypy                       Run linting using MyPy.
  make test                            Run tests quickly with the default Python.
  make coverage                        Check code coverage quickly with the default Python.
  make install                         Install the package to the active Python's site-packages.
  make clean                           Removes build, test, coverage and Python artifacts.
  make clean-all                       Removes all venv, build, test, coverage and Python artifacts.
  make clean-build                     Removes build artifacts.
  make clean-pyc                       Removes Python file artifacts.
  make clean-test                      Removes test and coverage artifacts.
  make clean-venv                      Removes Python virtual environment artifacts.
  make dist                            Builds source and wheel package.
  make release                         Release build on PyP
  make tox                             Run tests on every Python version with tox.
  make venv                            Create Python venv environment.

作者及贡献者

此存储库的原始设置由 Franck Nijhof 完成。

要查看所有作者和贡献者的完整列表,请查看贡献者页面

许可证

MIT 许可证

版权所有 (c) 2019 Franck Nijhof

任何人可免费获得此软件及其相关文档副本("软件"),在不受限制的情况下处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本,并允许向软件提供者提供软件的人这样做,但须遵守以下条件

上述版权声明和本许可声明应包含在软件的所有副本或实质性部分中。

软件按“现状”提供,不提供任何明示或暗示的保证,包括但不限于适销性、针对特定目的的适用性和非侵权性。在任何情况下,作者或版权所有者不应对任何索赔、损害或其他责任负责,无论这些责任是根据合同、侵权或其他原因产生的,无论这些责任是否与软件或软件的使用或其他操作有关。

项目详情


下载文件

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

源代码发行版

sonoffdiy-0.1.0.tar.gz (8.6 kB 查看哈希值)

上传时间 源代码

构建发行版

sonoffdiy-0.1.0-py3-none-any.whl (8.9 kB 查看哈希值)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面