Skip to content

Commit

Permalink
Kickoff
Browse files Browse the repository at this point in the history
  • Loading branch information
majamassarini committed Nov 11, 2021
0 parents commit 3842f0b
Show file tree
Hide file tree
Showing 76 changed files with 5,479 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[run]
command_line = -m unittest discover
omit = *tests*,*__init__.py

[report]
omit = *tests*,*__init__.py
16 changes: 16 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[flake8]
# postponed evaluation of annotations seems not being working
ignore = F821

# line break before binary operator - introduced by back (W503)
# doctests are not well formatted, lines are too long and are not fixed by black, ignore them (W501)
extend-ignore = W503,E501

# black setting is 88
max-line-length = 90
max-doc-length = 120

per-file-ignores =
__init__.py:F401,E402
knx_plugin/trigger/custom_clima.py:W505
knx_plugin/trigger/dpt_value_lux/balance.py:W505
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.pyc
*.bak
.settings
.project
.pydevproject
.idea
.workspace.xml
build/
dist/
*egg-info
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
env:
- CODECOV_TOKEN='aaa'
language: python
python:
- "3.8"
before_install:
- python --version
- pip install -U pip
- pip install -U pytest
- pip install codecov
- pip install -r requirements.txt
install:
- python setup.py install
# command to run tests
script:
- python -m coverage run
after_success:
- codecov
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020-present Maja Massarini

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# automate-knx-plugin
[![Build Status](https://app.travis-ci.com/majamassarini/automate-knx-plugin.svg?branch=main)](https://app.travis-ci.com/majamassarini/automate-knx-plugin)
[![codecov](https://codecov.io/gh/majamassarini/automate-knx-plugin/branch/main/graph/badge.svg?token=...)](https://codecov.io/gh/majamassarini/automate-knx-plugin)
[![Documentation Status](https://readthedocs.org/projects/automate-knx-plugin/badge/?version=latest)](https://automate-knx-plugin.readthedocs.io/en/latest/?badge=latest)

The **KNX** plugin for the [automate-home project](https://maja-massarini-automate-home.readthedocs-hosted.com/en/latest/?).
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
25 changes: 25 additions & 0 deletions docs/source/clients.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Clients
=======

A client is used by a :meth:`knx_plugin.gateway.definition.Gateway` to connect the **KNX bus** through a *KNX gateway device*.

Abstract
--------

.. autoclass:: knx_plugin.client.Client

USB HID
-------

The connected *knx gateway device* is a **USB HID device**.

.. autoclass:: knx_plugin.client.usbhid.Client
:no-members:

KNXNET IP
---------

The connected *knx gateway device* is a **KNXNET IP device**.

.. autoclass:: knx_plugin.client.knxnet_ip.Client
:no-members:
11 changes: 11 additions & 0 deletions docs/source/command/dpt_switch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DPT Switch
==========


OnOff
-----
.. autoclass:: knx_plugin.command.dpt_switch.OnOff

OffOn
-----
.. autoclass:: knx_plugin.command.dpt_switch.OffOn
11 changes: 11 additions & 0 deletions docs/source/command/dpt_updown.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DPT UpDown
==========


UpDown
------
.. autoclass:: knx_plugin.command.dpt_updown.UpDown

Up
--
.. autoclass:: knx_plugin.command.dpt_updown.Up
27 changes: 27 additions & 0 deletions docs/source/commands.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Commands
********

Commands are entities **capable of forge** messages for the KNX bus interpreting changes in *Appliance* state.

Commands *compare* an *old Appliance state* with a *new one* and create messages to be sent to the Appliance's device.

Commands are designed to read *Appliance's attributes*: :meth:`home.appliance.attribute.mixin`

.. autoclass:: knx_plugin.message.Command

.. toctree::
:maxdepth: 4

command/dpt_switch
command/dpt_updown


DPT_Brightness
--------------

.. autoclass:: knx_plugin.command.dpt_brightness.Brightness

Custom Clima
------------

.. autoclass:: knx_plugin.command.custom_clima.Setup
67 changes: 67 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath('../../../home/'))
sys.path.insert(0, os.path.abspath('../../../knx-stack/'))
sys.path.insert(0, os.path.abspath('../../../../git/knx-stack/'))
print(sys.path)


# -- Project information -----------------------------------------------------

project = 'knx-plugin'
copyright = '2021, Maja Massarini'
author = 'Maja Massarini'

# The full version, including alpha/beta/rc tags
release = '0.9'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
]
autodoc_inherit_docstrings = True
autodoc_default_options = {
'member-order': 'bysource',
'members': True,
'undoc-members': True,
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
23 changes: 23 additions & 0 deletions docs/source/gateways.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Gateway
=======

It is the **home instance** gateway to the **Knx bus**.
Connects triggers and commands to the **KNX bus**.
It depends on the physical connecting device, it could be both a USB HID device or a KNXNET IP device.

Abstract
--------

.. autoclass:: knx_plugin.gateway.Gateway

USB HID
^^^^^^^

.. autoclass:: knx_plugin.gateway.usbhid.Gateway

KNXNET IP
^^^^^^^^^

.. autoclass:: knx_plugin.gateway.knxnet_ip.Gateway
:no-members:

Loading

0 comments on commit 3842f0b

Please sign in to comment.