pax_global_header 0000666 0000000 0000000 00000000064 14777250235 0014526 g ustar 00root root 0000000 0000000 52 comment=6573097e653513cb198739b6eb3d26fbdbe5476e
devolo_plc_api-1.5.1/ 0000775 0000000 0000000 00000000000 14777250235 0014511 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/.coveragerc 0000664 0000000 0000000 00000000163 14777250235 0016632 0 ustar 00root root 0000000 0000000 [run]
source = devolo_plc_api
omit =
devolo_plc_api/device_api/*_pb2.py
devolo_plc_api/plcnet_api/*_pb2.py
devolo_plc_api-1.5.1/.github/ 0000775 0000000 0000000 00000000000 14777250235 0016051 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14777250235 0020234 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/.github/ISSUE_TEMPLATE/bug_report.md 0000664 0000000 0000000 00000001023 14777250235 0022722 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**Used device**
Device and firmware version you used to trigger the bug.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Additional context**
Add any other context about the problem here.
devolo_plc_api-1.5.1/.github/ISSUE_TEMPLATE/feature_request.md 0000664 0000000 0000000 00000001123 14777250235 0023756 0 ustar 00root root 0000000 0000000 ---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
devolo_plc_api-1.5.1/.github/dependabot.yml 0000664 0000000 0000000 00000000401 14777250235 0020674 0 ustar 00root root 0000000 0000000 version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
target-branch: "main"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
target-branch: "main"
devolo_plc_api-1.5.1/.github/pull_request_template.md 0000664 0000000 0000000 00000000460 14777250235 0023012 0 ustar 00root root 0000000 0000000 ## Proposed change
## Checklist
- [ ] Changelog is updated.
devolo_plc_api-1.5.1/.github/workflows/ 0000775 0000000 0000000 00000000000 14777250235 0020106 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/.github/workflows/convert_todos_to_issues.yml 0000664 0000000 0000000 00000000763 14777250235 0025624 0 ustar 00root root 0000000 0000000 name: "TODOs to issues"
on:
push:
branches:
- development
jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@master"
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@master"
with:
REPO: ${{ github.repository }}
BEFORE: ${{ github.event.before }}
SHA: ${{ github.sha }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
LABEL: "# TODO:"
COMMENT_MARKER: "#"
id: "todo"
devolo_plc_api-1.5.1/.github/workflows/pythonpackage.yml 0000664 0000000 0000000 00000005303 14777250235 0023467 0 ustar 00root root 0000000 0000000 name: Python package
on: [push]
jobs:
format:
name: Check formatting
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Set up Python
uses: actions/setup-python@v5.5.0
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --no-binary=mypy mypy
- name: Check formatting
uses: pre-commit/action@v3.0.1
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Set up Python
uses: actions/setup-python@v5.5.0
with:
python-version: "3.9"
- name: Lint with ruff
run: |
python -m pip install --upgrade pip
python -m pip install ruff
ruff check --output-format=github devolo_plc_api scripts
ruff check --output-format=github --exit-zero tests
- name: Lint with mypy
run: |
python -m pip install . mypy types-protobuf
mypy devolo_plc_api
mypy tests || true
test:
name: Test with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.5.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
check-latest: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[test]
- name: Test with pytest
run: |
pytest --cov=devolo_plc_api --cov-report=xml
- name: Preserve coverage
uses: actions/upload-artifact@v4.6.2
if: matrix.python-version == '3.9'
with:
name: coverage
path: coverage.xml
coverage:
name: Upload coverage
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Set up Python
uses: actions/setup-python@v5.5.0
with:
python-version: "3.9"
- name: Download coverage
uses: actions/download-artifact@v4.2.1
with:
name: coverage
- name: Coveralls
uses: coverallsapp/github-action@v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Clean up coverage
uses: geekyeggo/delete-artifact@v5.1.0
with:
name: coverage
devolo_plc_api-1.5.1/.github/workflows/pythonpublish.yml 0000664 0000000 0000000 00000001164 14777250235 0023543 0 ustar 00root root 0000000 0000000 name: Upload Python Package
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- name: Set up Python
uses: actions/setup-python@v5.5.0
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
python -m twine upload dist/*
devolo_plc_api-1.5.1/.gitignore 0000664 0000000 0000000 00000003675 14777250235 0016514 0 ustar 00root root 0000000 0000000 # Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# ruff
.ruff_cache/
# Pyre type checker
.pyre/
### VisualStudioCode ###
.vscode/
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
### PyCharm ###
.idea
### Testfile ###
test.py
devolo_plc_api-1.5.1/.pre-commit-config.yaml 0000664 0000000 0000000 00000001437 14777250235 0020777 0 ustar 00root root 0000000 0000000 repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: "25.1.0"
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: "6.0.1"
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
hooks:
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/abravalheri/validate-pyproject
rev: "v0.24.1"
hooks:
- id: validate-pyproject
- repo: local
hooks:
- id: stubgen
name: check API stub files
entry: scripts/stubgen.py
description: check if stub files of the APIs are up-to-date
language: script
types: [python]
devolo_plc_api-1.5.1/LICENSE 0000664 0000000 0000000 00000104515 14777250235 0015524 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
devolo_plc_api-1.5.1/README.md 0000664 0000000 0000000 00000007443 14777250235 0016000 0 ustar 00root root 0000000 0000000 # devolo PLC API
[](https://github.com/2Fake/devolo_plc_api/actions?query=workflow%3A%22Python+package%22)
[](https://pypi.org/project/devolo-plc-api/)
[](https://codeclimate.com/github/2Fake/devolo_plc_api)
[](https://coveralls.io/github/2Fake/devolo_plc_api?branch=development)
This project implements parts of the devolo PLC devices API in Python. Communication to the devices is formatted in protobuf and the IDLs were kindly provided by devolo. Nevertheless, we might miss updates to the IDLs. If you discover a breakage, please feel free to [report an issue](https://github.com/2Fake/devolo_plc_api/issues).
## System requirements
Defining the system requirements with exact versions typically is difficult. But there is a tested environment:
* Linux
* Python 3.9.22
* pip 25.0.1
* ifaddr 0.2.0
* httpx 0.28.1
* protobuf 5.28.3
* segno 1.6.1
* tenacity 9.0.0
* zeroconf 0.146.1
Other versions and even other operating systems might work. Feel free to tell us about your experience. If you want to run our unit tests, you also need:
* pytest 7.4.4
* pytest-asyncio 0.26.0
* pytest-httpx 0.35.0
* syrupy 4.9.1
## Versioning
In our versioning we follow [Semantic Versioning](https://semver.org/).
## Installing for usage
The Python Package Index takes care for you. Just use pip.
```bash
pip install devolo-plc-api
```
## Installing for development
First, you need to get the sources.
```bash
git clone git@github.com:2Fake/devolo_plc_api.git
```
Then you need to take care of the requirements.
```bash
cd devolo_plc_api
python setup.py install
```
If you want to run out tests, install the extra requirements and start pytest.
```bash
pip install -e .[test]
pytest
```
## Usage
All features we currently support on device basis are shown in our examples. If you want to use the package asynchronously, please check [example_async.py](https://github.com/2Fake/devolo_plc_api/blob/master/example_async.py). If you want to use it synchronously, please check [example_sync.py](https://github.com/2Fake/devolo_plc_api/blob/master/example_sync.py).
If you don't know the IP addresses of your devices, you can discover them. You will get a dictionary with the device's serial number as key. The connections to the devices will be already established, but you will have to take about disconnecting.
```python
from devolo_plc_api.network import async_discover_network
devices = await async_discover_network()
await asyncio.gather(*[device.async_connect() for device in _devices.values()])
# Do your magic
await asyncio.gather(*[device.async_disconnect() for device in devices.values()])
```
Or in a synchronous setup:
```python
from devolo_plc_api.network import discover_network
devices = discover_network()
for device in _devices.values():
device.connect()
# Do your magic
[device.disconnect() for device in devices.values()]
```
## Supported device
The following devolo devices were queried with at least one call to verify functionality:
* Magic 2 WiFi next
* Magic 2 WiFi 2-1
* Magic 2 LAN triple
* Magic 2 DinRail
* Magic 2 LAN 1-1
* Magic 1 WiFi mini
* Magic 1 WiFi 2-1
* Magic 1 LAN 1-1
* Repeater 5400
* Repeater 3000
* Repeater 1200
* Repeater ac+
* Repeater ac
* dLAN 1200+ WiFi ac
* dLAN 550+ Wifi
* dLAN 550 WiFi
However, other devices might work, some might have a limited functionality. Also firmware version will matter. If you discover something weird, [we want to know](https://github.com/2Fake/devolo_plc_api/issues).
devolo_plc_api-1.5.1/devolo_plc_api/ 0000775 0000000 0000000 00000000000 14777250235 0017470 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/devolo_plc_api/__init__.py 0000664 0000000 0000000 00000000561 14777250235 0021603 0 ustar 00root root 0000000 0000000 """The devolo PLC API."""
from importlib.metadata import PackageNotFoundError, version
from .device import Device
from .helpers import wifi_qr_code
try:
__version__ = version("devolo_plc_api")
except PackageNotFoundError:
# package is not installed - e.g. pulled and run locally
__version__ = "0.0.0"
__all__ = ["Device", "__version__", "wifi_qr_code"]
devolo_plc_api-1.5.1/devolo_plc_api/clients/ 0000775 0000000 0000000 00000000000 14777250235 0021131 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/devolo_plc_api/clients/__init__.py 0000664 0000000 0000000 00000000157 14777250235 0023245 0 ustar 00root root 0000000 0000000 """Clients used to communicate with devolo devices."""
from .protobuf import Protobuf
__all__ = ["Protobuf"]
devolo_plc_api-1.5.1/devolo_plc_api/clients/protobuf.py 0000664 0000000 0000000 00000007273 14777250235 0023354 0 ustar 00root root 0000000 0000000 """Google Protobuf client."""
from __future__ import annotations
import asyncio
import logging
from abc import ABC, abstractmethod
from hashlib import sha256
from http import HTTPStatus
from typing import Any, Callable
from httpx import (
AsyncClient,
ConnectError,
ConnectTimeout,
DigestAuth,
HTTPStatusError,
ReadTimeout,
RemoteProtocolError,
Response,
)
from tenacity import before_sleep_log, retry, retry_if_exception_type, stop_after_attempt, wait_exponential
from devolo_plc_api.exceptions import DevicePasswordProtected, DeviceUnavailable
TIMEOUT = 10.0
class Protobuf(ABC):
"""Google Protobuf client as ground work."""
@abstractmethod
def __init__(self) -> None:
"""Initialize the client."""
self._logger = logging.getLogger(f"{self.__class__.__module__}.{self.__class__.__name__}")
self.password: str
self._ip: str
self._path: str
self._port: int
self._session: AsyncClient
self._user: str
self._version: str
def __getattr__(self, attr: str) -> Callable[..., Any]:
"""Catch attempts to call methods synchronously."""
def method(*args: Any, **kwargs: Any) -> Any:
return asyncio.run(getattr(self, async_method)(*args, **kwargs))
async_method = f"async_{attr}"
if hasattr(self.__class__, async_method):
return method
raise AttributeError(f"{self.__class__.__name__} object has no attribute {attr}") # noqa: EM102, TRY003
@property
def url(self) -> str:
"""The base URL to query."""
return f"http://{self._ip}:{self._port}/{self._path}/{self._version}/"
async def _async_get(self, sub_url: str, timeout: float = TIMEOUT) -> Response:
"""Query URL asynchronously."""
url = f"{self.url}{sub_url}"
self._logger.debug("Getting from %s", url)
return await self._async_request("GET", url, None, timeout)
async def _async_post(self, sub_url: str, content: bytes, timeout: float = TIMEOUT) -> Response:
"""Post data asynchronously."""
url = f"{self.url}{sub_url}"
self._logger.debug("Posting to %s", url)
return await self._async_request("POST", url, content, timeout)
@retry(
stop=stop_after_attempt(3),
wait=wait_exponential(multiplier=5),
retry=retry_if_exception_type(DeviceUnavailable),
reraise=True,
before_sleep=before_sleep_log(logging.getLogger("devolo_plc_api.clients.protobuf.Protobuf"), logging.DEBUG),
)
async def _async_request(self, method: str, url: str, content: bytes | None, timeout: float = TIMEOUT) -> Response:
"""Request data asynchronously."""
try:
response = await self._session.request(
method,
url,
auth=DigestAuth(self._user, self.password),
content=content,
timeout=timeout,
)
if response.status_code == HTTPStatus.UNAUTHORIZED:
self.password = sha256(self.password.encode("utf-8")).hexdigest()
response = await self._session.request(
method,
url,
auth=DigestAuth(self._user, self.password),
content=content,
timeout=timeout,
)
response.raise_for_status()
except HTTPStatusError as e:
if e.response.status_code == HTTPStatus.UNAUTHORIZED:
raise DevicePasswordProtected from None
raise
except (ConnectTimeout, ConnectError, ReadTimeout, RemoteProtocolError):
raise DeviceUnavailable from None
else:
return response
devolo_plc_api-1.5.1/devolo_plc_api/device.py 0000664 0000000 0000000 00000027041 14777250235 0021305 0 ustar 00root root 0000000 0000000 """Representation of your devolo device."""
from __future__ import annotations
import asyncio
import logging
from contextlib import suppress
from datetime import date
from ipaddress import ip_address, ip_network
from struct import unpack_from
from typing import TYPE_CHECKING, cast
from httpx import AsyncClient
from ifaddr import get_adapters
from zeroconf import DNSQuestionType, ServiceInfo, ServiceStateChange, Zeroconf
from zeroconf.asyncio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconf
from .device_api import SERVICE_TYPE as DEVICEAPI, DeviceApi
from .exceptions import DeviceNotFound
from .plcnet_api import DEVICES_WITHOUT_PLCNET, SERVICE_TYPE as PLCNETAPI, PlcNetApi
from .zeroconf import ZeroconfServiceInfo
if TYPE_CHECKING:
from types import TracebackType
from typing_extensions import Self
class Device:
"""
Representing object for your devolo PLC device. It stores all properties and functionalities discovered during setup.
:param ip: IP address of the device to communicate with.
:param plcnetapi: Reuse externally gathered data for the plcnet API
:param deviceapi: Reuse externally gathered data for the device API
:param zeroconf_instance: Zeroconf instance to be potentially reused.
"""
MDNS_TIMEOUT = 300
def __init__(
self,
ip: str,
zeroconf_instance: AsyncZeroconf | Zeroconf | None = None,
) -> None:
"""Initialize the device."""
self.ip = ip
self.mac = ""
self.mt_number = "0"
self.product = ""
self.technology = ""
self.serial_number = "0"
self.device: DeviceApi | None = None
self.plcnet: PlcNetApi | None = None
self._background_tasks: set[asyncio.Task] = set()
self._browser: AsyncServiceBrowser | None = None
self._connected = False
self._info: dict[str, ZeroconfServiceInfo] = {PLCNETAPI: ZeroconfServiceInfo(), DEVICEAPI: ZeroconfServiceInfo()}
self._logger = logging.getLogger(f"{self.__class__.__module__}.{self.__class__.__name__}")
self._multicast = False
self._password = ""
self._session_instance: AsyncClient | None = None
self._zeroconf_instance = zeroconf_instance
logging.captureWarnings(capture=True)
self._loop: asyncio.AbstractEventLoop
self._session: AsyncClient
self._zeroconf: AsyncZeroconf
def __del__(self) -> None:
"""Warn user, if the connection was not properly closed."""
if self._connected and self._session_instance is None:
self._logger.warning("Please disconnect properly from the device.")
async def __aenter__(self) -> Self:
"""Connect to a device asynchronously when entering a context manager."""
await self.async_connect()
return self
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None:
"""Disconnect to a device asynchronously when entering a context manager."""
await self.async_disconnect()
def __enter__(self) -> Self:
"""Connect to a device synchronously when leaving a context manager."""
self.connect()
return self
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None:
"""Disconnect to a device synchronously when leaving a context manager."""
self.disconnect()
@property
def firmware_date(self) -> date:
"""Date the firmware was built."""
return date.fromisoformat(self._info[DEVICEAPI].properties.get("FirmwareDate", "1970-01-01")[:10])
@property
def firmware_version(self) -> str:
"""Firmware version currently installed."""
return self._info[DEVICEAPI].properties.get("FirmwareVersion", "")
@property
def hostname(self) -> str:
"""mDNS hostname of the device.""" # noqa: D403
return self._info[DEVICEAPI].hostname
@property
def password(self) -> str:
"""The currently set device password."""
return self._password
@password.setter
def password(self, password: str) -> None:
"""Change the currently set device password."""
self._password = password
if self.device:
self.device.password = password
if self.plcnet:
self.plcnet.password = password
async def async_connect(self, session_instance: AsyncClient | None = None) -> None:
"""
Connect to a device asynchronous.
:param: session_instance: Session client instance to be potentially reused.
"""
self._session_instance = session_instance
self._session = self._session_instance or AsyncClient()
if not self._zeroconf_instance:
self._zeroconf = AsyncZeroconf(interfaces=await self._get_relevant_interfaces())
elif isinstance(self._zeroconf_instance, Zeroconf):
self._zeroconf = AsyncZeroconf(zc=self._zeroconf_instance)
else:
self._zeroconf = self._zeroconf_instance
await self._get_zeroconf_info()
if not self._info[DEVICEAPI].properties and not self._info[PLCNETAPI].properties:
await self._retry_zeroconf_info()
if not self.device and not self.plcnet:
raise DeviceNotFound(self.ip)
self._connected = True
def connect(self) -> None:
"""Connect to a device synchronous."""
self._loop = asyncio.get_event_loop()
self._loop.run_until_complete(self.async_connect())
async def async_disconnect(self) -> None:
"""Disconnect from a device asynchronous."""
if self._connected:
if self._browser:
await self._browser.async_cancel()
if not self._zeroconf_instance:
await self._zeroconf.async_close()
if not self._session_instance:
await self._session.aclose()
self._connected = False
def disconnect(self) -> None:
"""Disconnect from a device synchronous."""
self._loop.run_until_complete(self.async_disconnect())
async def _get_relevant_interfaces(self) -> list[str]:
"""Get the IP address of the relevant interface to reduce traffic."""
interface: list[str] = []
for adapter in get_adapters():
interface.extend(
cast("str", ip.ip)
for ip in adapter.ips
if ip.is_IPv4 and ip_address(self.ip) in ip_network(f"{ip.ip}/{ip.network_prefix}", strict=False)
)
interface.extend(
cast("str", ip.ip[0])
for ip in adapter.ips
if ip.is_IPv6 and ip_address(self.ip) in ip_network(f"{ip.ip[0]}/{ip.network_prefix}", strict=False)
)
return interface
async def _get_device_info(self) -> None:
"""Get information from the devolo Device API."""
service_type = DEVICEAPI
if self._info[service_type].properties:
self.mt_number = self._info[service_type].properties.get("MT", "0")
self.product = self._info[service_type].properties.get("Product", "")
self.serial_number = self._info[service_type].properties["SN"]
self.device = DeviceApi(
ip=str(ip_address(self._info[service_type].address)),
session=self._session,
info=self._info[service_type],
)
self.device.password = self.password
async def _get_plcnet_info(self) -> None:
"""Get information from the devolo PlcNet API."""
service_type = PLCNETAPI
if self._info[service_type].properties:
self.mac = self._info[service_type].properties["PlcMacAddress"]
self.technology = self._info[service_type].properties.get("PlcTechnology", "")
self.plcnet = PlcNetApi(
ip=str(ip_address(self._info[service_type].address)),
session=self._session,
info=self._info[service_type],
)
self.plcnet.password = self.password
async def _get_zeroconf_info(self) -> None:
"""Browse for the desired mDNS service types and query them."""
service_types = [DEVICEAPI, PLCNETAPI]
counter = 0
self._logger.debug("Browsing for %s", service_types)
addr = None if self._multicast else self.ip
question_type = DNSQuestionType.QM if self._multicast else DNSQuestionType.QU
if self._browser:
await self._browser.async_cancel()
self._browser = None
self._browser = AsyncServiceBrowser(
zeroconf=self._zeroconf.zeroconf,
type_=service_types,
handlers=[self._state_change],
addr=addr,
question_type=question_type,
)
while (
not self._info[DEVICEAPI].properties
or (not self._info[PLCNETAPI].properties and self.mt_number not in DEVICES_WITHOUT_PLCNET)
) and counter < self.MDNS_TIMEOUT:
counter += 1
await asyncio.sleep(0.01)
async def _retry_zeroconf_info(self) -> None:
"""Retry getting the zeroconf info using multicast."""
self._logger.debug("Having trouble getting results via unicast messages. Switching to multicast for this device.")
self._multicast = True
await self._get_zeroconf_info()
def _state_change(self, zeroconf: Zeroconf, service_type: str, name: str, state_change: ServiceStateChange) -> None:
"""Evaluate the query result."""
if state_change == ServiceStateChange.Removed:
return
task = asyncio.create_task(self._get_service_info(zeroconf, service_type, name))
self._background_tasks.add(task)
task.add_done_callback(self._background_tasks.remove)
async def _get_service_info(self, zeroconf: Zeroconf, service_type: str, name: str) -> None:
"""Get service information, if IP matches."""
service_info = AsyncServiceInfo(service_type, name)
update = {
DEVICEAPI: self._get_device_info,
PLCNETAPI: self._get_plcnet_info,
}
with suppress(RuntimeError):
if not self._multicast:
await service_info.async_request(zeroconf, timeout=1000, question_type=DNSQuestionType.QU, addr=self.ip)
else:
await service_info.async_request(zeroconf, timeout=1000, question_type=DNSQuestionType.QM)
if not service_info.addresses or self.ip not in service_info.parsed_addresses():
return # No need to continue, if there are no relevant service information
self._logger.debug("Updating service info of %s for %s", service_type, service_info.server_key)
if info := self.info_from_service(service_info):
self._info[service_type] = info
await update[service_type]()
@staticmethod
def info_from_service(service_info: ServiceInfo) -> ZeroconfServiceInfo | None:
"""Return prepared info from mDNS entries."""
properties = {}
total_length = len(service_info.text)
offset = 0
while offset < total_length:
(parsed_length,) = unpack_from("!B", service_info.text, offset)
key_value = service_info.text[offset + 1 : offset + 1 + parsed_length].decode("UTF-8").split("=")
properties[key_value[0]] = key_value[1]
offset += parsed_length + 1
return ZeroconfServiceInfo(
address=service_info.addresses[0],
hostname=service_info.server or "",
port=service_info.port,
properties=properties,
)
devolo_plc_api-1.5.1/devolo_plc_api/device_api/ 0000775 0000000 0000000 00000000000 14777250235 0021560 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/devolo_plc_api/device_api/__init__.py 0000664 0000000 0000000 00000002474 14777250235 0023700 0 ustar 00root root 0000000 0000000 """The devolo device API."""
import re
from .deviceapi import DeviceApi
from .multiap_pb2 import WifiMultiApGetResponse
from .support_pb2 import SupportInfoDump
from .updatefirmware_pb2 import UpdateFirmwareCheck
from .wifinetwork_pb2 import (
WIFI_BAND_2G,
WIFI_BAND_5G,
WIFI_VAP_GUEST_AP,
WIFI_VAP_MAIN_AP,
WIFI_VAP_STATION,
WifiConnectedStationsGet,
WifiGuestAccessGet,
WifiNeighborAPsGet,
WifiRepeatedAPsGet,
)
CONFIGLAYER_FORMAT = re.compile(rb"(([A-Z][A-Z0-9._]+)=(.+?))(?=(([A-Z][A-Z0-9._]+)=(.+))|$)", re.DOTALL)
SERVICE_TYPE = "_dvl-deviceapi._tcp.local."
UPDATE_AVAILABLE = UpdateFirmwareCheck.UPDATE_AVAILABLE
UPDATE_NOT_AVAILABLE = UpdateFirmwareCheck.UPDATE_NOT_AVAILABLE
RepeatedAPInfo = WifiRepeatedAPsGet.RepeatedAPInfo
ConnectedStationInfo = WifiConnectedStationsGet.ConnectedStationInfo
NeighborAPInfo = WifiNeighborAPsGet.NeighborAPInfo
SupportInfoItem = SupportInfoDump.SupportInfoItem
__all__ = [
"CONFIGLAYER_FORMAT",
"SERVICE_TYPE",
"UPDATE_AVAILABLE",
"UPDATE_NOT_AVAILABLE",
"WIFI_BAND_2G",
"WIFI_BAND_5G",
"WIFI_VAP_GUEST_AP",
"WIFI_VAP_MAIN_AP",
"WIFI_VAP_STATION",
"ConnectedStationInfo",
"DeviceApi",
"NeighborAPInfo",
"RepeatedAPInfo",
"SupportInfoItem",
"WifiGuestAccessGet",
"WifiMultiApGetResponse",
]
devolo_plc_api-1.5.1/devolo_plc_api/device_api/deviceapi.py 0000664 0000000 0000000 00000030312 14777250235 0024062 0 ustar 00root root 0000000 0000000 """Implementation of the devolo device API."""
from __future__ import annotations
import functools
from typing import TYPE_CHECKING, Callable, TypeVar
from devolo_plc_api.clients import Protobuf
from devolo_plc_api.exceptions import FeatureNotSupported
from .factoryreset_pb2 import FactoryResetStart
from .ledsettings_pb2 import LedSettingsGet, LedSettingsSet, LedSettingsSetResponse
from .multiap_pb2 import WifiMultiApGetResponse
from .restart_pb2 import RestartResponse, UptimeGetResponse
from .support_pb2 import SupportInfoDump, SupportInfoDumpResponse
from .updatefirmware_pb2 import UpdateFirmwareCheck, UpdateFirmwareStart
from .wifinetwork_pb2 import (
WifiConnectedStationsGet,
WifiGuestAccessGet,
WifiGuestAccessSet,
WifiGuestAccessSetResponse,
WifiNeighborAPsGet,
WifiRepeatedAPsGet,
WifiRepeaterWpsClonePbcStart,
WifiResult,
WifiWpsPbcStart,
)
if TYPE_CHECKING:
from httpx import AsyncClient
from typing_extensions import Concatenate, ParamSpec
from devolo_plc_api.zeroconf import ZeroconfServiceInfo
_ReturnT = TypeVar("_ReturnT")
_P = ParamSpec("_P")
LONG_RUNNING = 30.0
def _feature(
feature: str,
) -> Callable[[Callable[Concatenate[DeviceApi, _P], _ReturnT]], Callable[Concatenate[DeviceApi, _P], _ReturnT]]:
"""Filter unsupported features before querying the device."""
def feature_decorator(method: Callable[Concatenate[DeviceApi, _P], _ReturnT]) -> Callable[..., _ReturnT]:
@functools.wraps(method)
def wrapper(deviceapi: DeviceApi, *args: _P.args, **kwargs: _P.kwargs) -> _ReturnT:
if feature in deviceapi.features:
return method(deviceapi, *args, **kwargs)
raise FeatureNotSupported(method.__name__)
return wrapper
return feature_decorator
class DeviceApi(Protobuf):
"""
Implementation of the devolo device API.
:param ip: IP address of the device to communicate with
:param session: HTTP client session
:param info: Information collected from the mDNS query
"""
def __init__(self, ip: str, session: AsyncClient, info: ZeroconfServiceInfo) -> None:
"""Initialize the device API."""
super().__init__()
self._ip = ip
# HC gateway has no Path, it has a path.
self._path = info.properties.get("Path") or info.properties.get("path")
self._port = info.port
self._session = session
self._user = "devolo"
self._version = info.properties["Version"]
features: str = info.properties.get("Features", "")
self.features = features.split(",") if features else ["reset", "update", "led", "intmtg"]
self.password = ""
@_feature("led")
async def async_get_led_setting(self) -> bool:
"""
Get LED setting asynchronously. This feature only works on devices, that announce the led feature.
return: LED settings
"""
self._logger.debug("Getting LED settings.")
led_setting = LedSettingsGet()
response = await self._async_get("LedSettingsGet")
led_setting.ParseFromString(await response.aread())
return led_setting.state == led_setting.LED_ON
@_feature("led")
async def async_set_led_setting(self, enable: bool) -> bool:
"""
Set LED setting asynchronously. This feature only works on devices, that announce the led feature.
:param enable: True to enable the LEDs, False to disable the LEDs
:return: True, if LED state was successfully changed, otherwise False
"""
self._logger.debug("Setting LED settings.")
led_setting = LedSettingsSet()
led_setting.state = led_setting.LED_ON if enable else led_setting.LED_OFF
query = await self._async_post("LedSettingsSet", content=led_setting.SerializeToString())
response = LedSettingsSetResponse()
response.ParseFromString(await query.aread())
return response.result == response.SUCCESS
@_feature("multiap")
async def async_get_wifi_multi_ap(self) -> WifiMultiApGetResponse:
"""
Get MultiAP details asynchronously. This feature only works on devices, that announce the multiap feature.
return: MultiAP details
"""
self._logger.debug("Getting MultiAP details.")
query = await self._async_get("WifiMultiApGet")
response = WifiMultiApGetResponse()
response.ParseFromString(await query.aread())
return response
@_feature("repeater0")
async def async_get_wifi_repeated_access_points(self) -> list[WifiRepeatedAPsGet.RepeatedAPInfo]:
"""
Get repeated wifi access point asynchronously. This feature only works on repeater devices, that announce the
repeater0 feature.
:return: Repeated access points in the neighborhood including connection rate data
"""
self._logger.debug("Getting repeated access points.")
repeated_aps = WifiRepeatedAPsGet()
response = await self._async_get("WifiRepeatedAPsGet")
repeated_aps.ParseFromString(await response.aread())
return list(repeated_aps.repeated_aps)
@_feature("repeater0")
async def async_start_wps_clone(self) -> bool:
"""
Start WPS clone mode. This feature only works on repeater devices, that announce the repeater0 feature.
:return: True, if the wifi settings were successfully cloned, otherwise False
"""
self._logger.debug("Starting WPS clone.")
wps_clone = WifiRepeaterWpsClonePbcStart()
response = await self._async_get("WifiRepeaterWpsClonePbcStart")
wps_clone.ParseFromString(await response.aread())
return wps_clone.result == WifiResult.WIFI_SUCCESS
@_feature("reset")
async def async_factory_reset(self) -> bool:
"""
Factory-reset the device. This feature only works on devices, that announce the reset feature.
:return: True if reset is started, otherwise False
"""
self._logger.debug("Resetting the device.")
reset = FactoryResetStart()
response = await self._async_get("FactoryResetStart")
reset.ParseFromString(await response.aread())
return reset.result == reset.SUCCESS
@_feature("restart")
async def async_restart(self) -> bool:
"""
Restart the device. This feature only works on devices, that announce the restart feature.
:return: True if restart is started, otherwise False
"""
self._logger.debug("Restarting the device.")
query = await self._async_post("Restart", content=b"")
response = RestartResponse()
response.ParseFromString(await query.aread())
return response.result == response.SUCCESS
@_feature("restart")
async def async_uptime(self) -> int:
"""
Get the uptime of the device. This feature only works on devices, that announce the restart feature. It can only be
used as a strict monotonically increasing number and therefore has no unit.
:return: The uptime without unit
"""
self._logger.debug("Get uptime.")
uptime = UptimeGetResponse()
response = await self._async_get("UptimeGet")
uptime.ParseFromString(await response.aread())
return uptime.uptime
@_feature("support")
async def async_get_support_info(self) -> SupportInfoDump:
"""
Get support info from the device. This feature only works on devices, that announce the support feature.
:return: The support info
"""
self._logger.debug("Get uptime.")
support_info = SupportInfoDumpResponse()
response = await self._async_get("SupportInfoDump", timeout=LONG_RUNNING)
support_info.ParseFromString(await response.aread())
return support_info.info
@_feature("update")
async def async_check_firmware_available(self) -> UpdateFirmwareCheck:
"""
Check asynchronously, if a firmware update is available for the device.
:return: Result and new firmware version, if newer one is available
"""
self._logger.debug("Checking for new firmware.")
update_firmware_check = UpdateFirmwareCheck()
response = await self._async_get("UpdateFirmwareCheck", timeout=LONG_RUNNING)
update_firmware_check.ParseFromString(await response.aread())
return update_firmware_check
@_feature("update")
async def async_start_firmware_update(self) -> bool:
"""
Start firmware update asynchronously, if a firmware update is available for the device. Important: The response does
not tell you anything about the success of the update itself.
:return: True, if the firmware update was started, False if there is no update
"""
self._logger.debug("Updating firmware.")
update_firmware = UpdateFirmwareStart()
query = await self._async_get("UpdateFirmwareStart")
update_firmware.ParseFromString(await query.aread())
return update_firmware.result == update_firmware.UPDATE_STARTED
@_feature("wifi1")
async def async_get_wifi_connected_station(self) -> list[WifiConnectedStationsGet.ConnectedStationInfo]:
"""
Get wifi stations connected to the device asynchronously. This feature only works on devices, that announce the wifi1
feature.
:return: All connected wifi stations including connection rate data
"""
self._logger.debug("Getting connected wifi stations.")
wifi_connected = WifiConnectedStationsGet()
response = await self._async_get("WifiConnectedStationsGet")
wifi_connected.ParseFromString(await response.aread())
return list(wifi_connected.connected_stations)
@_feature("wifi1")
async def async_get_wifi_guest_access(self) -> WifiGuestAccessGet:
"""
Get details about wifi guest access asynchronously. This feature only works on devices, that announce the wifi1
feature.
:return: Details about the wifi guest access
"""
self._logger.debug("Getting wifi guest access status.")
wifi_guest = WifiGuestAccessGet()
response = await self._async_get("WifiGuestAccessGet")
wifi_guest.ParseFromString(await response.aread())
return wifi_guest
@_feature("wifi1")
async def async_set_wifi_guest_access(self, enable: bool, duration: int = 0) -> bool:
"""
Enable wifi guest access asynchronously. This feature only works on devices, that announce the wifi1 feature.
:param enable: True to enable, False to disable wifi guest access
:param duration: Duration in minutes to enable the guest wifi. 0 is infinite.
:return: True, if the state of the wifi guest access was successfully changed, otherwise False
"""
self._logger.debug("Setting wifi guest access status.")
wifi_guest = WifiGuestAccessSet()
wifi_guest.enable = enable
wifi_guest.duration = duration
query = await self._async_post("WifiGuestAccessSet", content=wifi_guest.SerializeToString())
response = WifiGuestAccessSetResponse()
response.ParseFromString(await query.aread())
return response.result == WifiResult.WIFI_SUCCESS
@_feature("wifi1")
async def async_get_wifi_neighbor_access_points(self) -> list[WifiNeighborAPsGet.NeighborAPInfo]:
"""
Get wifi access point in the neighborhood asynchronously. This feature only works on devices, that announce the wifi1
feature.
:return: Visible access points in the neighborhood including connection rate data
"""
self._logger.debug("Getting neighbored access points.")
wifi_neighbor_aps = WifiNeighborAPsGet()
response = await self._async_get("WifiNeighborAPsGet", timeout=LONG_RUNNING)
wifi_neighbor_aps.ParseFromString(await response.aread())
return list(wifi_neighbor_aps.neighbor_aps)
@_feature("wifi1")
async def async_start_wps(self) -> bool:
"""
Start WPS push button configuration.
:return: True, if the WPS was successfully started, otherwise False
"""
self._logger.debug("Starting WPS.")
wps = WifiWpsPbcStart()
response = await self._async_get("WifiWpsPbcStart")
wps.ParseFromString(await response.aread())
return wps.result == WifiResult.WIFI_SUCCESS
devolo_plc_api-1.5.1/devolo_plc_api/device_api/deviceapi.pyi 0000664 0000000 0000000 00000005403 14777250235 0024236 0 ustar 00root root 0000000 0000000 """
@generated by stubgen. Do not edit manually!
isort:skip_file
"""
from __future__ import annotations
from .multiap_pb2 import WifiMultiApGetResponse
from .support_pb2 import SupportInfoDump
from .updatefirmware_pb2 import UpdateFirmwareCheck
from .wifinetwork_pb2 import WifiConnectedStationsGet, WifiGuestAccessGet, WifiNeighborAPsGet, WifiRepeatedAPsGet
from devolo_plc_api.clients import Protobuf
from devolo_plc_api.zeroconf import ZeroconfServiceInfo as ZeroconfServiceInfo
from httpx import AsyncClient as AsyncClient
LONG_RUNNING: float
class DeviceApi(Protobuf):
features: list[str]
password: str
def __init__(self, ip: str, session: AsyncClient, info: ZeroconfServiceInfo) -> None: ...
async def async_get_led_setting(self) -> bool: ...
async def async_set_led_setting(self, enable: bool) -> bool: ...
async def async_get_wifi_multi_ap(self) -> WifiMultiApGetResponse: ...
async def async_get_wifi_repeated_access_points(self) -> list[WifiRepeatedAPsGet.RepeatedAPInfo]: ...
async def async_start_wps_clone(self) -> bool: ...
async def async_factory_reset(self) -> bool: ...
async def async_restart(self) -> bool: ...
async def async_uptime(self) -> int: ...
async def async_get_support_info(self) -> SupportInfoDump: ...
async def async_check_firmware_available(self) -> UpdateFirmwareCheck: ...
async def async_start_firmware_update(self) -> bool: ...
async def async_get_wifi_connected_station(self) -> list[WifiConnectedStationsGet.ConnectedStationInfo]: ...
async def async_get_wifi_guest_access(self) -> WifiGuestAccessGet: ...
async def async_set_wifi_guest_access(self, enable: bool, duration: int = 0) -> bool: ...
async def async_get_wifi_neighbor_access_points(self) -> list[WifiNeighborAPsGet.NeighborAPInfo]: ...
async def async_start_wps(self) -> bool: ...
def get_led_setting(self) -> bool: ...
def set_led_setting(self, enable: bool) -> bool: ...
def get_wifi_multi_ap(self) -> WifiMultiApGetResponse: ...
def get_wifi_repeated_access_points(self) -> list[WifiRepeatedAPsGet.RepeatedAPInfo]: ...
def start_wps_clone(self) -> bool: ...
def factory_reset(self) -> bool: ...
def restart(self) -> bool: ...
def uptime(self) -> int: ...
def get_support_info(self) -> SupportInfoDump: ...
def check_firmware_available(self) -> UpdateFirmwareCheck: ...
def start_firmware_update(self) -> bool: ...
def get_wifi_connected_station(self) -> list[WifiConnectedStationsGet.ConnectedStationInfo]: ...
def get_wifi_guest_access(self) -> WifiGuestAccessGet: ...
def set_wifi_guest_access(self, enable: bool, duration: int = 0) -> bool: ...
def get_wifi_neighbor_access_points(self) -> list[WifiNeighborAPsGet.NeighborAPInfo]: ...
def start_wps(self) -> bool: ...
devolo_plc_api-1.5.1/devolo_plc_api/device_api/factoryreset_pb2.py 0000664 0000000 0000000 00000003242 14777250235 0025410 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: factoryreset.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12\x66\x61\x63toryreset.proto\x12\ndevice.api\"t\n\x11\x46\x61\x63toryResetStart\x12\x34\n\x06result\x18\x01 \x01(\x0e\x32$.device.api.FactoryResetStart.Result\")\n\x06Result\x12\x0b\n\x07SUCCESS\x10\x00\x12\x12\n\rUNKNOWN_ERROR\x10\xff\x01\x42\x16\n\x06\x64\x65viceB\x0c\x66\x61\x63toryresetb\x06proto3')
_FACTORYRESETSTART = DESCRIPTOR.message_types_by_name['FactoryResetStart']
_FACTORYRESETSTART_RESULT = _FACTORYRESETSTART.enum_types_by_name['Result']
FactoryResetStart = _reflection.GeneratedProtocolMessageType('FactoryResetStart', (_message.Message,), {
'DESCRIPTOR' : _FACTORYRESETSTART,
'__module__' : 'factoryreset_pb2'
# @@protoc_insertion_point(class_scope:device.api.FactoryResetStart)
})
_sym_db.RegisterMessage(FactoryResetStart)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006deviceB\014factoryreset'
_FACTORYRESETSTART._serialized_start=34
_FACTORYRESETSTART._serialized_end=150
_FACTORYRESETSTART_RESULT._serialized_start=109
_FACTORYRESETSTART_RESULT._serialized_end=150
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/device_api/factoryreset_pb2.pyi 0000664 0000000 0000000 00000003150 14777250235 0025557 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class FactoryResetStart(google.protobuf.message.Message):
"""
Perform a factory reset on delos devices
Use GET, no payload required
The result shows only the success of the triggering
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Result:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[FactoryResetStart._Result.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
SUCCESS: FactoryResetStart._Result.ValueType # 0
UNKNOWN_ERROR: FactoryResetStart._Result.ValueType # 255
class Result(_Result, metaclass=_ResultEnumTypeWrapper):
pass
SUCCESS: FactoryResetStart.Result.ValueType # 0
UNKNOWN_ERROR: FactoryResetStart.Result.ValueType # 255
RESULT_FIELD_NUMBER: builtins.int
result: global___FactoryResetStart.Result.ValueType
"""SUCCESS, if factory reset was triggered correct"""
def __init__(self,
*,
result: global___FactoryResetStart.Result.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result",b"result"]) -> None: ...
global___FactoryResetStart = FactoryResetStart
devolo_plc_api-1.5.1/devolo_plc_api/device_api/ledsettings_pb2.py 0000664 0000000 0000000 00000006305 14777250235 0025226 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: ledsettings.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11ledsettings.proto\x12\ndevice.api\"i\n\x0eLedSettingsGet\x12\x32\n\x05state\x18\x01 \x01(\x0e\x32#.device.api.LedSettingsGet.Ledstate\"#\n\x08Ledstate\x12\n\n\x06LED_ON\x10\x00\x12\x0b\n\x07LED_OFF\x10\x01\"i\n\x0eLedSettingsSet\x12\x32\n\x05state\x18\x01 \x01(\x0e\x32#.device.api.LedSettingsSet.Ledstate\"#\n\x08Ledstate\x12\n\n\x06LED_ON\x10\x00\x12\x0b\n\x07LED_OFF\x10\x01\"~\n\x16LedSettingsSetResponse\x12\x39\n\x06result\x18\x01 \x01(\x0e\x32).device.api.LedSettingsSetResponse.Result\")\n\x06Result\x12\x0b\n\x07SUCCESS\x10\x00\x12\x12\n\rUNKNOWN_ERROR\x10\xff\x01\x42\x0e\n\x06\x64\x65viceB\x04ledsb\x06proto3')
_LEDSETTINGSGET = DESCRIPTOR.message_types_by_name['LedSettingsGet']
_LEDSETTINGSSET = DESCRIPTOR.message_types_by_name['LedSettingsSet']
_LEDSETTINGSSETRESPONSE = DESCRIPTOR.message_types_by_name['LedSettingsSetResponse']
_LEDSETTINGSGET_LEDSTATE = _LEDSETTINGSGET.enum_types_by_name['Ledstate']
_LEDSETTINGSSET_LEDSTATE = _LEDSETTINGSSET.enum_types_by_name['Ledstate']
_LEDSETTINGSSETRESPONSE_RESULT = _LEDSETTINGSSETRESPONSE.enum_types_by_name['Result']
LedSettingsGet = _reflection.GeneratedProtocolMessageType('LedSettingsGet', (_message.Message,), {
'DESCRIPTOR' : _LEDSETTINGSGET,
'__module__' : 'ledsettings_pb2'
# @@protoc_insertion_point(class_scope:device.api.LedSettingsGet)
})
_sym_db.RegisterMessage(LedSettingsGet)
LedSettingsSet = _reflection.GeneratedProtocolMessageType('LedSettingsSet', (_message.Message,), {
'DESCRIPTOR' : _LEDSETTINGSSET,
'__module__' : 'ledsettings_pb2'
# @@protoc_insertion_point(class_scope:device.api.LedSettingsSet)
})
_sym_db.RegisterMessage(LedSettingsSet)
LedSettingsSetResponse = _reflection.GeneratedProtocolMessageType('LedSettingsSetResponse', (_message.Message,), {
'DESCRIPTOR' : _LEDSETTINGSSETRESPONSE,
'__module__' : 'ledsettings_pb2'
# @@protoc_insertion_point(class_scope:device.api.LedSettingsSetResponse)
})
_sym_db.RegisterMessage(LedSettingsSetResponse)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006deviceB\004leds'
_LEDSETTINGSGET._serialized_start=33
_LEDSETTINGSGET._serialized_end=138
_LEDSETTINGSGET_LEDSTATE._serialized_start=103
_LEDSETTINGSGET_LEDSTATE._serialized_end=138
_LEDSETTINGSSET._serialized_start=140
_LEDSETTINGSSET._serialized_end=245
_LEDSETTINGSSET_LEDSTATE._serialized_start=103
_LEDSETTINGSSET_LEDSTATE._serialized_end=138
_LEDSETTINGSSETRESPONSE._serialized_start=247
_LEDSETTINGSSETRESPONSE._serialized_end=373
_LEDSETTINGSSETRESPONSE_RESULT._serialized_start=332
_LEDSETTINGSSETRESPONSE_RESULT._serialized_end=373
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/device_api/ledsettings_pb2.pyi 0000664 0000000 0000000 00000007651 14777250235 0025404 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class LedSettingsGet(google.protobuf.message.Message):
"""
Get current LED settings
Use GET, no payload required
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Ledstate:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _LedstateEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[LedSettingsGet._Ledstate.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
LED_ON: LedSettingsGet._Ledstate.ValueType # 0
LED_OFF: LedSettingsGet._Ledstate.ValueType # 1
class Ledstate(_Ledstate, metaclass=_LedstateEnumTypeWrapper):
pass
LED_ON: LedSettingsGet.Ledstate.ValueType # 0
LED_OFF: LedSettingsGet.Ledstate.ValueType # 1
STATE_FIELD_NUMBER: builtins.int
state: global___LedSettingsGet.Ledstate.ValueType
def __init__(self,
*,
state: global___LedSettingsGet.Ledstate.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["state",b"state"]) -> None: ...
global___LedSettingsGet = LedSettingsGet
class LedSettingsSet(google.protobuf.message.Message):
"""
Set new LED settings
Use http POST with this message
Backend will answer with LedSettingsSetResponse
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Ledstate:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _LedstateEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[LedSettingsSet._Ledstate.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
LED_ON: LedSettingsSet._Ledstate.ValueType # 0
LED_OFF: LedSettingsSet._Ledstate.ValueType # 1
class Ledstate(_Ledstate, metaclass=_LedstateEnumTypeWrapper):
pass
LED_ON: LedSettingsSet.Ledstate.ValueType # 0
LED_OFF: LedSettingsSet.Ledstate.ValueType # 1
STATE_FIELD_NUMBER: builtins.int
state: global___LedSettingsSet.Ledstate.ValueType
def __init__(self,
*,
state: global___LedSettingsSet.Ledstate.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["state",b"state"]) -> None: ...
global___LedSettingsSet = LedSettingsSet
class LedSettingsSetResponse(google.protobuf.message.Message):
"""
This will be returned after LedSettingsSet
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Result:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[LedSettingsSetResponse._Result.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
SUCCESS: LedSettingsSetResponse._Result.ValueType # 0
UNKNOWN_ERROR: LedSettingsSetResponse._Result.ValueType # 255
class Result(_Result, metaclass=_ResultEnumTypeWrapper):
pass
SUCCESS: LedSettingsSetResponse.Result.ValueType # 0
UNKNOWN_ERROR: LedSettingsSetResponse.Result.ValueType # 255
RESULT_FIELD_NUMBER: builtins.int
result: global___LedSettingsSetResponse.Result.ValueType
"""contains the result of setting the LED state"""
def __init__(self,
*,
result: global___LedSettingsSetResponse.Result.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result",b"result"]) -> None: ...
global___LedSettingsSetResponse = LedSettingsSetResponse
devolo_plc_api-1.5.1/devolo_plc_api/device_api/multiap_pb2.py 0000664 0000000 0000000 00000002224 14777250235 0024350 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: multiap.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rmultiap.proto\x12\ndevice.api\"W\n\x16WifiMultiApGetResponse\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x15\n\rcontroller_id\x18\x02 \x01(\t\x12\x15\n\rcontroller_ip\x18\x03 \x01(\tB\x11\n\x06\x64\x65viceB\x07Multiapb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'multiap_pb2', globals())
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006deviceB\007Multiap'
_WIFIMULTIAPGETRESPONSE._serialized_start=29
_WIFIMULTIAPGETRESPONSE._serialized_end=116
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/device_api/multiap_pb2.pyi 0000664 0000000 0000000 00000004205 14777250235 0024522 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.message
import sys
if sys.version_info >= (3, 8):
import typing as typing_extensions
else:
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
@typing_extensions.final
class WifiMultiApGetResponse(google.protobuf.message.Message):
"""Details about MultiAP as returned by the 'WifiMultiApGet' endpoint."""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
ENABLED_FIELD_NUMBER: builtins.int
CONTROLLER_ID_FIELD_NUMBER: builtins.int
CONTROLLER_IP_FIELD_NUMBER: builtins.int
enabled: builtins.bool
"""Describes if the MultiAP functionality is enabled in the device."""
controller_id: builtins.str
"""The id of the mesh controller, in form of its MAC address,
if a mesh controller is known to the device.
If the device is not aware of a mesh controller, e.g. because
none has been elected yet, it is left empty.
The MAC address is represented as a string of 12 hexadecimal
digits (digits 0-9, letters A-F or a-f) displayed as six pairs of
digits separated by colons.
"""
controller_ip: builtins.str
"""The IP address of the known mesh controller, if the implementation
provides it.
If the device is not aware of a mesh controller or doesn't
know its IP, it is left empty.
The IP can be an IPv4 in dot-separated decimal format, or an IPv6
in colon-separated hexadecimal format. In case multiple IPs are
known, the value can be a comma-separated string of either formats.
Also, an IP can optionally be prefixed with an identifier separated
from the IP with a semicolon.
"""
def __init__(
self,
*,
enabled: builtins.bool = ...,
controller_id: builtins.str = ...,
controller_ip: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["controller_id", b"controller_id", "controller_ip", b"controller_ip", "enabled", b"enabled"]) -> None: ...
global___WifiMultiApGetResponse = WifiMultiApGetResponse
devolo_plc_api-1.5.1/devolo_plc_api/device_api/restart_pb2.py 0000664 0000000 0000000 00000004200 14777250235 0024355 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: restart.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rrestart.proto\x12\ndevice.api\"\x80\x01\n\x0fRestartResponse\x12\x32\n\x06result\x18\x01 \x01(\x0e\x32\".device.api.RestartResponse.Result\x12\x0e\n\x06uptime\x18\x02 \x01(\x03\")\n\x06Result\x12\x0b\n\x07SUCCESS\x10\x00\x12\x12\n\rUNKNOWN_ERROR\x10\xff\x01\"#\n\x11UptimeGetResponse\x12\x0e\n\x06uptime\x18\x02 \x01(\x03\x42\x11\n\x06\x64\x65viceB\x07restartb\x06proto3')
_RESTARTRESPONSE = DESCRIPTOR.message_types_by_name['RestartResponse']
_UPTIMEGETRESPONSE = DESCRIPTOR.message_types_by_name['UptimeGetResponse']
_RESTARTRESPONSE_RESULT = _RESTARTRESPONSE.enum_types_by_name['Result']
RestartResponse = _reflection.GeneratedProtocolMessageType('RestartResponse', (_message.Message,), {
'DESCRIPTOR' : _RESTARTRESPONSE,
'__module__' : 'restart_pb2'
# @@protoc_insertion_point(class_scope:device.api.RestartResponse)
})
_sym_db.RegisterMessage(RestartResponse)
UptimeGetResponse = _reflection.GeneratedProtocolMessageType('UptimeGetResponse', (_message.Message,), {
'DESCRIPTOR' : _UPTIMEGETRESPONSE,
'__module__' : 'restart_pb2'
# @@protoc_insertion_point(class_scope:device.api.UptimeGetResponse)
})
_sym_db.RegisterMessage(UptimeGetResponse)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006deviceB\007restart'
_RESTARTRESPONSE._serialized_start=30
_RESTARTRESPONSE._serialized_end=158
_RESTARTRESPONSE_RESULT._serialized_start=117
_RESTARTRESPONSE_RESULT._serialized_end=158
_UPTIMEGETRESPONSE._serialized_start=160
_UPTIMEGETRESPONSE._serialized_end=195
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/device_api/restart_pb2.pyi 0000664 0000000 0000000 00000006005 14777250235 0024533 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class RestartResponse(google.protobuf.message.Message):
"""
Response to calling the "Restart" endpoint to perform a restart of a devolo device.
The result code shows only the success of the triggering.
The current uptime of the device is returned so that it can be compared
to an uptime retrieved at a later time to check for a successful restart.
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Result:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[RestartResponse._Result.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
SUCCESS: RestartResponse._Result.ValueType # 0
"""The restart can and will be triggered."""
UNKNOWN_ERROR: RestartResponse._Result.ValueType # 255
"""For some unknown error a restart cannot be triggered at this time."""
class Result(_Result, metaclass=_ResultEnumTypeWrapper):
pass
SUCCESS: RestartResponse.Result.ValueType # 0
"""The restart can and will be triggered."""
UNKNOWN_ERROR: RestartResponse.Result.ValueType # 255
"""For some unknown error a restart cannot be triggered at this time."""
RESULT_FIELD_NUMBER: builtins.int
UPTIME_FIELD_NUMBER: builtins.int
result: global___RestartResponse.Result.ValueType
"""SUCCESS, if restart can and will be triggered"""
uptime: builtins.int
"""Current uptime of the device. No unit is attached to the value."""
def __init__(self,
*,
result: global___RestartResponse.Result.ValueType = ...,
uptime: builtins.int = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result",b"result","uptime",b"uptime"]) -> None: ...
global___RestartResponse = RestartResponse
class UptimeGetResponse(google.protobuf.message.Message):
"""
Response to calling the "UptimeGet" endpoint.
The current uptime of the device is returned.
No unit (like seconds or millisenconds or ticks) is attached to the value.
You can only use the uptime value as a strict monotonically increasing number,
that increases in regular intervals since the device started.
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
UPTIME_FIELD_NUMBER: builtins.int
uptime: builtins.int
"""Current uptime of the device. No unit is attached to the value."""
def __init__(self,
*,
uptime: builtins.int = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["uptime",b"uptime"]) -> None: ...
global___UptimeGetResponse = UptimeGetResponse
devolo_plc_api-1.5.1/devolo_plc_api/device_api/support_pb2.py 0000664 0000000 0000000 00000005725 14777250235 0024422 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: support.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rsupport.proto\x12\ndevice.api\"\x80\x01\n\x0fSupportInfoDump\x12:\n\x05items\x18\x01 \x03(\x0b\x32+.device.api.SupportInfoDump.SupportInfoItem\x1a\x31\n\x0fSupportInfoItem\x12\r\n\x05label\x18\x01 \x01(\t\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\x0c\"\xb1\x01\n\x17SupportInfoDumpResponse\x12:\n\x06result\x18\x01 \x01(\x0e\x32*.device.api.SupportInfoDumpResponse.Result\x12)\n\x04info\x18\x03 \x01(\x0b\x32\x1b.device.api.SupportInfoDump\")\n\x06Result\x12\x0b\n\x07SUCCESS\x10\x00\x12\x12\n\rUNKNOWN_ERROR\x10\xff\x01J\x04\x08\x02\x10\x03\x42\x11\n\x06\x64\x65viceB\x07supportb\x06proto3')
_SUPPORTINFODUMP = DESCRIPTOR.message_types_by_name['SupportInfoDump']
_SUPPORTINFODUMP_SUPPORTINFOITEM = _SUPPORTINFODUMP.nested_types_by_name['SupportInfoItem']
_SUPPORTINFODUMPRESPONSE = DESCRIPTOR.message_types_by_name['SupportInfoDumpResponse']
_SUPPORTINFODUMPRESPONSE_RESULT = _SUPPORTINFODUMPRESPONSE.enum_types_by_name['Result']
SupportInfoDump = _reflection.GeneratedProtocolMessageType('SupportInfoDump', (_message.Message,), {
'SupportInfoItem' : _reflection.GeneratedProtocolMessageType('SupportInfoItem', (_message.Message,), {
'DESCRIPTOR' : _SUPPORTINFODUMP_SUPPORTINFOITEM,
'__module__' : 'support_pb2'
# @@protoc_insertion_point(class_scope:device.api.SupportInfoDump.SupportInfoItem)
})
,
'DESCRIPTOR' : _SUPPORTINFODUMP,
'__module__' : 'support_pb2'
# @@protoc_insertion_point(class_scope:device.api.SupportInfoDump)
})
_sym_db.RegisterMessage(SupportInfoDump)
_sym_db.RegisterMessage(SupportInfoDump.SupportInfoItem)
SupportInfoDumpResponse = _reflection.GeneratedProtocolMessageType('SupportInfoDumpResponse', (_message.Message,), {
'DESCRIPTOR' : _SUPPORTINFODUMPRESPONSE,
'__module__' : 'support_pb2'
# @@protoc_insertion_point(class_scope:device.api.SupportInfoDumpResponse)
})
_sym_db.RegisterMessage(SupportInfoDumpResponse)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006deviceB\007support'
_SUPPORTINFODUMP._serialized_start=30
_SUPPORTINFODUMP._serialized_end=158
_SUPPORTINFODUMP_SUPPORTINFOITEM._serialized_start=109
_SUPPORTINFODUMP_SUPPORTINFOITEM._serialized_end=158
_SUPPORTINFODUMPRESPONSE._serialized_start=161
_SUPPORTINFODUMPRESPONSE._serialized_end=338
_SUPPORTINFODUMPRESPONSE_RESULT._serialized_start=291
_SUPPORTINFODUMPRESPONSE_RESULT._serialized_end=332
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/device_api/support_pb2.pyi 0000664 0000000 0000000 00000010715 14777250235 0024566 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import collections.abc
import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import sys
import typing
if sys.version_info >= (3, 10):
import typing as typing_extensions
else:
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class SupportInfoDump(google.protobuf.message.Message):
"""
The SupportInfoDump is a collection of SupportInfoItems.
Each SupportInfoItem is a pair of a unique label and any content.
The label describes the type of support info that is contained in
the content field. It can be used by the client to form a file name
for a file that the content is stored in.
Labels must be unique within the collection of SupportInfoItems.
The content can be any data that should be delivered to support for
the given label and is mostly opaque to the client.
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class SupportInfoItem(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
LABEL_FIELD_NUMBER: builtins.int
CONTENT_FIELD_NUMBER: builtins.int
label: builtins.str
"""Label describing the content. Defined labels: configlayer, delosconfig, pib, syslog"""
content: builtins.bytes
"""Any type of support info content."""
def __init__(
self,
*,
label: builtins.str = ...,
content: builtins.bytes = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["content", b"content", "label", b"label"]) -> None: ...
ITEMS_FIELD_NUMBER: builtins.int
@property
def items(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___SupportInfoDump.SupportInfoItem]:
"""A list of label-content pairs that make up multiple support info items for this device."""
def __init__(
self,
*,
items: collections.abc.Iterable[global___SupportInfoDump.SupportInfoItem] | None = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["items", b"items"]) -> None: ...
global___SupportInfoDump = SupportInfoDump
class SupportInfoDumpResponse(google.protobuf.message.Message):
"""
Response to calling the "SupportInfoDump" endpoint to collect support info data from a device.
The response is made up of a result code, in case something went wrong, and a SupportInfoDump
which contains the collection of support info items that the client needs to store in a file
to be sent to devolo support.
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Result:
ValueType = typing.NewType("ValueType", builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[SupportInfoDumpResponse._Result.ValueType], builtins.type): # noqa: F821
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
SUCCESS: SupportInfoDumpResponse._Result.ValueType # 0
"""Successful operation, support items are returned."""
UNKNOWN_ERROR: SupportInfoDumpResponse._Result.ValueType # 255
"""Some error occured, returned info is unreliable."""
class Result(_Result, metaclass=_ResultEnumTypeWrapper): ...
SUCCESS: SupportInfoDumpResponse.Result.ValueType # 0
"""Successful operation, support items are returned."""
UNKNOWN_ERROR: SupportInfoDumpResponse.Result.ValueType # 255
"""Some error occured, returned info is unreliable."""
RESULT_FIELD_NUMBER: builtins.int
INFO_FIELD_NUMBER: builtins.int
result: global___SupportInfoDumpResponse.Result.ValueType
"""The return code of the opration, success or error."""
@property
def info(self) -> global___SupportInfoDump:
"""The collected support information."""
def __init__(
self,
*,
result: global___SupportInfoDumpResponse.Result.ValueType = ...,
info: global___SupportInfoDump | None = ...,
) -> None: ...
def HasField(self, field_name: typing_extensions.Literal["info", b"info"]) -> builtins.bool: ...
def ClearField(self, field_name: typing_extensions.Literal["info", b"info", "result", b"result"]) -> None: ...
global___SupportInfoDumpResponse = SupportInfoDumpResponse
devolo_plc_api-1.5.1/devolo_plc_api/device_api/updatefirmware_pb2.py 0000664 0000000 0000000 00000005224 14777250235 0025717 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: updatefirmware.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14updatefirmware.proto\x12\ndevice.api\"\xb9\x01\n\x13UpdateFirmwareCheck\x12\x36\n\x06result\x18\x01 \x01(\x0e\x32&.device.api.UpdateFirmwareCheck.Result\x12\x1c\n\x14new_firmware_version\x18\x02 \x01(\t\"L\n\x06Result\x12\x14\n\x10UPDATE_AVAILABLE\x10\x00\x12\x18\n\x14UPDATE_NOT_AVAILABLE\x10\x01\x12\x12\n\rUNKNOWN_ERROR\x10\xff\x01\"\x99\x01\n\x13UpdateFirmwareStart\x12\x36\n\x06result\x18\x01 \x01(\x0e\x32&.device.api.UpdateFirmwareStart.Result\"J\n\x06Result\x12\x12\n\x0eUPDATE_STARTED\x10\x00\x12\x18\n\x14UPDATE_NOT_AVAILABLE\x10\x01\x12\x12\n\rUNKNOWN_ERROR\x10\xff\x01\x42\x10\n\x06\x64\x65viceB\x06updateb\x06proto3')
_UPDATEFIRMWARECHECK = DESCRIPTOR.message_types_by_name['UpdateFirmwareCheck']
_UPDATEFIRMWARESTART = DESCRIPTOR.message_types_by_name['UpdateFirmwareStart']
_UPDATEFIRMWARECHECK_RESULT = _UPDATEFIRMWARECHECK.enum_types_by_name['Result']
_UPDATEFIRMWARESTART_RESULT = _UPDATEFIRMWARESTART.enum_types_by_name['Result']
UpdateFirmwareCheck = _reflection.GeneratedProtocolMessageType('UpdateFirmwareCheck', (_message.Message,), {
'DESCRIPTOR' : _UPDATEFIRMWARECHECK,
'__module__' : 'updatefirmware_pb2'
# @@protoc_insertion_point(class_scope:device.api.UpdateFirmwareCheck)
})
_sym_db.RegisterMessage(UpdateFirmwareCheck)
UpdateFirmwareStart = _reflection.GeneratedProtocolMessageType('UpdateFirmwareStart', (_message.Message,), {
'DESCRIPTOR' : _UPDATEFIRMWARESTART,
'__module__' : 'updatefirmware_pb2'
# @@protoc_insertion_point(class_scope:device.api.UpdateFirmwareStart)
})
_sym_db.RegisterMessage(UpdateFirmwareStart)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006deviceB\006update'
_UPDATEFIRMWARECHECK._serialized_start=37
_UPDATEFIRMWARECHECK._serialized_end=222
_UPDATEFIRMWARECHECK_RESULT._serialized_start=146
_UPDATEFIRMWARECHECK_RESULT._serialized_end=222
_UPDATEFIRMWARESTART._serialized_start=225
_UPDATEFIRMWARESTART._serialized_end=378
_UPDATEFIRMWARESTART_RESULT._serialized_start=304
_UPDATEFIRMWARESTART_RESULT._serialized_end=378
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/device_api/updatefirmware_pb2.pyi 0000664 0000000 0000000 00000006717 14777250235 0026100 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class UpdateFirmwareCheck(google.protobuf.message.Message):
"""
Check if new firmware available
Use GET, no payload required
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Result:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[UpdateFirmwareCheck._Result.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
UPDATE_AVAILABLE: UpdateFirmwareCheck._Result.ValueType # 0
UPDATE_NOT_AVAILABLE: UpdateFirmwareCheck._Result.ValueType # 1
UNKNOWN_ERROR: UpdateFirmwareCheck._Result.ValueType # 255
class Result(_Result, metaclass=_ResultEnumTypeWrapper):
pass
UPDATE_AVAILABLE: UpdateFirmwareCheck.Result.ValueType # 0
UPDATE_NOT_AVAILABLE: UpdateFirmwareCheck.Result.ValueType # 1
UNKNOWN_ERROR: UpdateFirmwareCheck.Result.ValueType # 255
RESULT_FIELD_NUMBER: builtins.int
NEW_FIRMWARE_VERSION_FIELD_NUMBER: builtins.int
result: global___UpdateFirmwareCheck.Result.ValueType
"""contains the result of checking the firmware update"""
new_firmware_version: typing.Text
"""Versionstring of the avaiable firmware"""
def __init__(self,
*,
result: global___UpdateFirmwareCheck.Result.ValueType = ...,
new_firmware_version: typing.Text = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["new_firmware_version",b"new_firmware_version","result",b"result"]) -> None: ...
global___UpdateFirmwareCheck = UpdateFirmwareCheck
class UpdateFirmwareStart(google.protobuf.message.Message):
"""
Start firmware update
Use GET, no payload required
Important: The response does not tell you anything about the success of the update itself
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Result:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[UpdateFirmwareStart._Result.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
UPDATE_STARTED: UpdateFirmwareStart._Result.ValueType # 0
UPDATE_NOT_AVAILABLE: UpdateFirmwareStart._Result.ValueType # 1
UNKNOWN_ERROR: UpdateFirmwareStart._Result.ValueType # 255
class Result(_Result, metaclass=_ResultEnumTypeWrapper):
pass
UPDATE_STARTED: UpdateFirmwareStart.Result.ValueType # 0
UPDATE_NOT_AVAILABLE: UpdateFirmwareStart.Result.ValueType # 1
UNKNOWN_ERROR: UpdateFirmwareStart.Result.ValueType # 255
RESULT_FIELD_NUMBER: builtins.int
result: global___UpdateFirmwareStart.Result.ValueType
"""contains the result of *triggering* the firmware update"""
def __init__(self,
*,
result: global___UpdateFirmwareStart.Result.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result",b"result"]) -> None: ...
global___UpdateFirmwareStart = UpdateFirmwareStart
devolo_plc_api-1.5.1/devolo_plc_api/device_api/wifinetwork_pb2.py 0000664 0000000 0000000 00000036550 14777250235 0025256 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: wifinetwork.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11wifinetwork.proto\x12\ndevice.api\"E\n\x19WifiDeviceModeGetResponse\x12(\n\x04mode\x18\x01 \x01(\x0e\x32\x1a.device.api.WifiDeviceMode\"\xa9\x01\n\x11WifiDeviceModeSet\x12(\n\x04mode\x18\x01 \x01(\x0e\x32\x1a.device.api.WifiDeviceMode\x12\x30\n\tfh_params\x18\x02 \x01(\x0b\x32\x1d.device.api.WifiParametersSet\x12\x38\n\tbh_params\x18\x03 \x01(\x0b\x32%.device.api.WifiRepeaterParametersSet\"C\n\x19WifiDeviceModeSetResponse\x12&\n\x06result\x18\x01 \x01(\x0e\x32\x16.device.api.WifiResult\".\n\x11WifiParametersSet\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\"C\n\x19WifiParametersSetResponse\x12&\n\x06result\x18\x01 \x01(\x0e\x32\x16.device.api.WifiResult\"w\n\x12WifiGuestAccessSet\x12\x0e\n\x06\x65nable\x18\x01 \x01(\x08\x12\x10\n\x08\x64uration\x18\x02 \x01(\r\x12\x0c\n\x04ssid\x18\x03 \x01(\t\x12\x0b\n\x03key\x18\x04 \x01(\t\x12$\n\x03wpa\x18\x05 \x01(\x0e\x32\x17.device.api.WifiWpaMode\"D\n\x1aWifiGuestAccessSetResponse\x12&\n\x06result\x18\x01 \x01(\x0e\x32\x16.device.api.WifiResult\"\x82\x01\n\x12WifiGuestAccessGet\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x1a\n\x12remaining_duration\x18\x02 \x01(\r\x12\x0c\n\x04ssid\x18\x03 \x01(\t\x12\x0b\n\x03key\x18\x04 \x01(\t\x12$\n\x03wpa\x18\x05 \x01(\x0e\x32\x17.device.api.WifiWpaMode\"\xe9\x01\n\x12WifiNeighborAPsGet\x12\x43\n\x0cneighbor_aps\x18\x01 \x03(\x0b\x32-.device.api.WifiNeighborAPsGet.NeighborAPInfo\x1a\x8d\x01\n\x0eNeighborAPInfo\x12\x13\n\x0bmac_address\x18\x01 \x01(\t\x12\x0c\n\x04ssid\x18\x02 \x01(\t\x12\"\n\x04\x62\x61nd\x18\x03 \x01(\x0e\x32\x14.device.api.WifiBand\x12\x0f\n\x07\x63hannel\x18\x04 \x01(\r\x12\x0e\n\x06signal\x18\x05 \x01(\x05\x12\x13\n\x0bsignal_bars\x18\x06 \x01(\x05\"\xf7\x01\n\x12WifiRepeatedAPsGet\x12\x43\n\x0crepeated_aps\x18\x01 \x03(\x0b\x32-.device.api.WifiRepeatedAPsGet.RepeatedAPInfo\x1a\x9b\x01\n\x0eRepeatedAPInfo\x12\x13\n\x0bmac_address\x18\x01 \x01(\t\x12\x0c\n\x04ssid\x18\x02 \x01(\t\x12\"\n\x04\x62\x61nd\x18\x03 \x01(\x0e\x32\x14.device.api.WifiBand\x12\x0f\n\x07\x63hannel\x18\x04 \x01(\r\x12\x0c\n\x04rate\x18\x05 \x01(\r\x12\x0e\n\x06signal\x18\x06 \x01(\x05\x12\x13\n\x0bsignal_bars\x18\x07 \x01(\x05\"\x90\x02\n\x18WifiConnectedStationsGet\x12U\n\x12\x63onnected_stations\x18\x01 \x03(\x0b\x32\x39.device.api.WifiConnectedStationsGet.ConnectedStationInfo\x1a\x9c\x01\n\x14\x43onnectedStationInfo\x12\x13\n\x0bmac_address\x18\x01 \x01(\t\x12)\n\x08vap_type\x18\x02 \x01(\x0e\x32\x17.device.api.WifiVAPType\x12\"\n\x04\x62\x61nd\x18\x03 \x01(\x0e\x32\x14.device.api.WifiBand\x12\x0f\n\x07rx_rate\x18\x04 \x01(\r\x12\x0f\n\x07tx_rate\x18\x05 \x01(\r\"u\n\x19WifiRepeaterParametersSet\x12\x0c\n\x04ssid\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\x11\n\tcrossband\x18\x03 \x01(\x08\x12*\n\x0cprimary_band\x18\x04 \x01(\x0e\x32\x14.device.api.WifiBand\"K\n!WifiRepeaterParametersSetResponse\x12&\n\x06result\x18\x01 \x01(\x0e\x32\x16.device.api.WifiResult\"9\n\x0fWifiWpsPbcStart\x12&\n\x06result\x18\x01 \x01(\x0e\x32\x16.device.api.WifiResult\"F\n\x1cWifiRepeaterWpsClonePbcStart\x12&\n\x06result\x18\x01 \x01(\x0e\x32\x16.device.api.WifiResult*\xdb\x01\n\nWifiResult\x12\x10\n\x0cWIFI_SUCCESS\x10\x00\x12\x15\n\x11WIFI_INVALID_SSID\x10\x01\x12\x14\n\x10WIFI_INVALID_KEY\x10\x02\x12\x14\n\x10WIFI_IS_DISABLED\x10\x03\x12\x1e\n\x1aWIFI_INVALID_BACKHAUL_SSID\x10\x04\x12\x1d\n\x19WIFI_INVALID_BACKHAUL_KEY\x10\x05\x12 \n\x1cWIFI_UNSUPPORTED_DEVICE_MODE\x10\x06\x12\x17\n\x12WIFI_UNKNOWN_ERROR\x10\xff\x01*E\n\x08WifiBand\x12\x15\n\x11WIFI_BAND_UNKNOWN\x10\x00\x12\x10\n\x0cWIFI_BAND_2G\x10\x01\x12\x10\n\x0cWIFI_BAND_5G\x10\x02*f\n\x0bWifiVAPType\x12\x14\n\x10WIFI_VAP_UNKNOWN\x10\x00\x12\x14\n\x10WIFI_VAP_MAIN_AP\x10\x01\x12\x15\n\x11WIFI_VAP_GUEST_AP\x10\x02\x12\x14\n\x10WIFI_VAP_STATION\x10\x03*^\n\x0bWifiWpaMode\x12\x11\n\rWPA_NO_CHANGE\x10\x00\x12\x0c\n\x08WPA_NONE\x10\x01\x12\x0b\n\x07WPA_1_2\x10\x02\x12\t\n\x05WPA_2\x10\x03\x12\x0b\n\x07WPA_2_3\x10\x04\x12\t\n\x05WPA_3\x10\x05*?\n\x0eWifiDeviceMode\x12\x0f\n\x0bWDM_NO_CONF\x10\x00\x12\n\n\x06WDM_AP\x10\x02\x12\x10\n\x0cWDM_REPEATER\x10\x03\x42\x15\n\x06\x64\x65viceB\x0bwifinetworkb\x06proto3')
_WIFIRESULT = DESCRIPTOR.enum_types_by_name['WifiResult']
WifiResult = enum_type_wrapper.EnumTypeWrapper(_WIFIRESULT)
_WIFIBAND = DESCRIPTOR.enum_types_by_name['WifiBand']
WifiBand = enum_type_wrapper.EnumTypeWrapper(_WIFIBAND)
_WIFIVAPTYPE = DESCRIPTOR.enum_types_by_name['WifiVAPType']
WifiVAPType = enum_type_wrapper.EnumTypeWrapper(_WIFIVAPTYPE)
_WIFIWPAMODE = DESCRIPTOR.enum_types_by_name['WifiWpaMode']
WifiWpaMode = enum_type_wrapper.EnumTypeWrapper(_WIFIWPAMODE)
_WIFIDEVICEMODE = DESCRIPTOR.enum_types_by_name['WifiDeviceMode']
WifiDeviceMode = enum_type_wrapper.EnumTypeWrapper(_WIFIDEVICEMODE)
WIFI_SUCCESS = 0
WIFI_INVALID_SSID = 1
WIFI_INVALID_KEY = 2
WIFI_IS_DISABLED = 3
WIFI_INVALID_BACKHAUL_SSID = 4
WIFI_INVALID_BACKHAUL_KEY = 5
WIFI_UNSUPPORTED_DEVICE_MODE = 6
WIFI_UNKNOWN_ERROR = 255
WIFI_BAND_UNKNOWN = 0
WIFI_BAND_2G = 1
WIFI_BAND_5G = 2
WIFI_VAP_UNKNOWN = 0
WIFI_VAP_MAIN_AP = 1
WIFI_VAP_GUEST_AP = 2
WIFI_VAP_STATION = 3
WPA_NO_CHANGE = 0
WPA_NONE = 1
WPA_1_2 = 2
WPA_2 = 3
WPA_2_3 = 4
WPA_3 = 5
WDM_NO_CONF = 0
WDM_AP = 2
WDM_REPEATER = 3
_WIFIDEVICEMODEGETRESPONSE = DESCRIPTOR.message_types_by_name['WifiDeviceModeGetResponse']
_WIFIDEVICEMODESET = DESCRIPTOR.message_types_by_name['WifiDeviceModeSet']
_WIFIDEVICEMODESETRESPONSE = DESCRIPTOR.message_types_by_name['WifiDeviceModeSetResponse']
_WIFIPARAMETERSSET = DESCRIPTOR.message_types_by_name['WifiParametersSet']
_WIFIPARAMETERSSETRESPONSE = DESCRIPTOR.message_types_by_name['WifiParametersSetResponse']
_WIFIGUESTACCESSSET = DESCRIPTOR.message_types_by_name['WifiGuestAccessSet']
_WIFIGUESTACCESSSETRESPONSE = DESCRIPTOR.message_types_by_name['WifiGuestAccessSetResponse']
_WIFIGUESTACCESSGET = DESCRIPTOR.message_types_by_name['WifiGuestAccessGet']
_WIFINEIGHBORAPSGET = DESCRIPTOR.message_types_by_name['WifiNeighborAPsGet']
_WIFINEIGHBORAPSGET_NEIGHBORAPINFO = _WIFINEIGHBORAPSGET.nested_types_by_name['NeighborAPInfo']
_WIFIREPEATEDAPSGET = DESCRIPTOR.message_types_by_name['WifiRepeatedAPsGet']
_WIFIREPEATEDAPSGET_REPEATEDAPINFO = _WIFIREPEATEDAPSGET.nested_types_by_name['RepeatedAPInfo']
_WIFICONNECTEDSTATIONSGET = DESCRIPTOR.message_types_by_name['WifiConnectedStationsGet']
_WIFICONNECTEDSTATIONSGET_CONNECTEDSTATIONINFO = _WIFICONNECTEDSTATIONSGET.nested_types_by_name['ConnectedStationInfo']
_WIFIREPEATERPARAMETERSSET = DESCRIPTOR.message_types_by_name['WifiRepeaterParametersSet']
_WIFIREPEATERPARAMETERSSETRESPONSE = DESCRIPTOR.message_types_by_name['WifiRepeaterParametersSetResponse']
_WIFIWPSPBCSTART = DESCRIPTOR.message_types_by_name['WifiWpsPbcStart']
_WIFIREPEATERWPSCLONEPBCSTART = DESCRIPTOR.message_types_by_name['WifiRepeaterWpsClonePbcStart']
WifiDeviceModeGetResponse = _reflection.GeneratedProtocolMessageType('WifiDeviceModeGetResponse', (_message.Message,), {
'DESCRIPTOR' : _WIFIDEVICEMODEGETRESPONSE,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiDeviceModeGetResponse)
})
_sym_db.RegisterMessage(WifiDeviceModeGetResponse)
WifiDeviceModeSet = _reflection.GeneratedProtocolMessageType('WifiDeviceModeSet', (_message.Message,), {
'DESCRIPTOR' : _WIFIDEVICEMODESET,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiDeviceModeSet)
})
_sym_db.RegisterMessage(WifiDeviceModeSet)
WifiDeviceModeSetResponse = _reflection.GeneratedProtocolMessageType('WifiDeviceModeSetResponse', (_message.Message,), {
'DESCRIPTOR' : _WIFIDEVICEMODESETRESPONSE,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiDeviceModeSetResponse)
})
_sym_db.RegisterMessage(WifiDeviceModeSetResponse)
WifiParametersSet = _reflection.GeneratedProtocolMessageType('WifiParametersSet', (_message.Message,), {
'DESCRIPTOR' : _WIFIPARAMETERSSET,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiParametersSet)
})
_sym_db.RegisterMessage(WifiParametersSet)
WifiParametersSetResponse = _reflection.GeneratedProtocolMessageType('WifiParametersSetResponse', (_message.Message,), {
'DESCRIPTOR' : _WIFIPARAMETERSSETRESPONSE,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiParametersSetResponse)
})
_sym_db.RegisterMessage(WifiParametersSetResponse)
WifiGuestAccessSet = _reflection.GeneratedProtocolMessageType('WifiGuestAccessSet', (_message.Message,), {
'DESCRIPTOR' : _WIFIGUESTACCESSSET,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiGuestAccessSet)
})
_sym_db.RegisterMessage(WifiGuestAccessSet)
WifiGuestAccessSetResponse = _reflection.GeneratedProtocolMessageType('WifiGuestAccessSetResponse', (_message.Message,), {
'DESCRIPTOR' : _WIFIGUESTACCESSSETRESPONSE,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiGuestAccessSetResponse)
})
_sym_db.RegisterMessage(WifiGuestAccessSetResponse)
WifiGuestAccessGet = _reflection.GeneratedProtocolMessageType('WifiGuestAccessGet', (_message.Message,), {
'DESCRIPTOR' : _WIFIGUESTACCESSGET,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiGuestAccessGet)
})
_sym_db.RegisterMessage(WifiGuestAccessGet)
WifiNeighborAPsGet = _reflection.GeneratedProtocolMessageType('WifiNeighborAPsGet', (_message.Message,), {
'NeighborAPInfo' : _reflection.GeneratedProtocolMessageType('NeighborAPInfo', (_message.Message,), {
'DESCRIPTOR' : _WIFINEIGHBORAPSGET_NEIGHBORAPINFO,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiNeighborAPsGet.NeighborAPInfo)
})
,
'DESCRIPTOR' : _WIFINEIGHBORAPSGET,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiNeighborAPsGet)
})
_sym_db.RegisterMessage(WifiNeighborAPsGet)
_sym_db.RegisterMessage(WifiNeighborAPsGet.NeighborAPInfo)
WifiRepeatedAPsGet = _reflection.GeneratedProtocolMessageType('WifiRepeatedAPsGet', (_message.Message,), {
'RepeatedAPInfo' : _reflection.GeneratedProtocolMessageType('RepeatedAPInfo', (_message.Message,), {
'DESCRIPTOR' : _WIFIREPEATEDAPSGET_REPEATEDAPINFO,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiRepeatedAPsGet.RepeatedAPInfo)
})
,
'DESCRIPTOR' : _WIFIREPEATEDAPSGET,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiRepeatedAPsGet)
})
_sym_db.RegisterMessage(WifiRepeatedAPsGet)
_sym_db.RegisterMessage(WifiRepeatedAPsGet.RepeatedAPInfo)
WifiConnectedStationsGet = _reflection.GeneratedProtocolMessageType('WifiConnectedStationsGet', (_message.Message,), {
'ConnectedStationInfo' : _reflection.GeneratedProtocolMessageType('ConnectedStationInfo', (_message.Message,), {
'DESCRIPTOR' : _WIFICONNECTEDSTATIONSGET_CONNECTEDSTATIONINFO,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiConnectedStationsGet.ConnectedStationInfo)
})
,
'DESCRIPTOR' : _WIFICONNECTEDSTATIONSGET,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiConnectedStationsGet)
})
_sym_db.RegisterMessage(WifiConnectedStationsGet)
_sym_db.RegisterMessage(WifiConnectedStationsGet.ConnectedStationInfo)
WifiRepeaterParametersSet = _reflection.GeneratedProtocolMessageType('WifiRepeaterParametersSet', (_message.Message,), {
'DESCRIPTOR' : _WIFIREPEATERPARAMETERSSET,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiRepeaterParametersSet)
})
_sym_db.RegisterMessage(WifiRepeaterParametersSet)
WifiRepeaterParametersSetResponse = _reflection.GeneratedProtocolMessageType('WifiRepeaterParametersSetResponse', (_message.Message,), {
'DESCRIPTOR' : _WIFIREPEATERPARAMETERSSETRESPONSE,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiRepeaterParametersSetResponse)
})
_sym_db.RegisterMessage(WifiRepeaterParametersSetResponse)
WifiWpsPbcStart = _reflection.GeneratedProtocolMessageType('WifiWpsPbcStart', (_message.Message,), {
'DESCRIPTOR' : _WIFIWPSPBCSTART,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiWpsPbcStart)
})
_sym_db.RegisterMessage(WifiWpsPbcStart)
WifiRepeaterWpsClonePbcStart = _reflection.GeneratedProtocolMessageType('WifiRepeaterWpsClonePbcStart', (_message.Message,), {
'DESCRIPTOR' : _WIFIREPEATERWPSCLONEPBCSTART,
'__module__' : 'wifinetwork_pb2'
# @@protoc_insertion_point(class_scope:device.api.WifiRepeaterWpsClonePbcStart)
})
_sym_db.RegisterMessage(WifiRepeaterWpsClonePbcStart)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006deviceB\013wifinetwork'
_WIFIRESULT._serialized_start=1875
_WIFIRESULT._serialized_end=2094
_WIFIBAND._serialized_start=2096
_WIFIBAND._serialized_end=2165
_WIFIVAPTYPE._serialized_start=2167
_WIFIVAPTYPE._serialized_end=2269
_WIFIWPAMODE._serialized_start=2271
_WIFIWPAMODE._serialized_end=2365
_WIFIDEVICEMODE._serialized_start=2367
_WIFIDEVICEMODE._serialized_end=2430
_WIFIDEVICEMODEGETRESPONSE._serialized_start=33
_WIFIDEVICEMODEGETRESPONSE._serialized_end=102
_WIFIDEVICEMODESET._serialized_start=105
_WIFIDEVICEMODESET._serialized_end=274
_WIFIDEVICEMODESETRESPONSE._serialized_start=276
_WIFIDEVICEMODESETRESPONSE._serialized_end=343
_WIFIPARAMETERSSET._serialized_start=345
_WIFIPARAMETERSSET._serialized_end=391
_WIFIPARAMETERSSETRESPONSE._serialized_start=393
_WIFIPARAMETERSSETRESPONSE._serialized_end=460
_WIFIGUESTACCESSSET._serialized_start=462
_WIFIGUESTACCESSSET._serialized_end=581
_WIFIGUESTACCESSSETRESPONSE._serialized_start=583
_WIFIGUESTACCESSSETRESPONSE._serialized_end=651
_WIFIGUESTACCESSGET._serialized_start=654
_WIFIGUESTACCESSGET._serialized_end=784
_WIFINEIGHBORAPSGET._serialized_start=787
_WIFINEIGHBORAPSGET._serialized_end=1020
_WIFINEIGHBORAPSGET_NEIGHBORAPINFO._serialized_start=879
_WIFINEIGHBORAPSGET_NEIGHBORAPINFO._serialized_end=1020
_WIFIREPEATEDAPSGET._serialized_start=1023
_WIFIREPEATEDAPSGET._serialized_end=1270
_WIFIREPEATEDAPSGET_REPEATEDAPINFO._serialized_start=1115
_WIFIREPEATEDAPSGET_REPEATEDAPINFO._serialized_end=1270
_WIFICONNECTEDSTATIONSGET._serialized_start=1273
_WIFICONNECTEDSTATIONSGET._serialized_end=1545
_WIFICONNECTEDSTATIONSGET_CONNECTEDSTATIONINFO._serialized_start=1389
_WIFICONNECTEDSTATIONSGET_CONNECTEDSTATIONINFO._serialized_end=1545
_WIFIREPEATERPARAMETERSSET._serialized_start=1547
_WIFIREPEATERPARAMETERSSET._serialized_end=1664
_WIFIREPEATERPARAMETERSSETRESPONSE._serialized_start=1666
_WIFIREPEATERPARAMETERSSETRESPONSE._serialized_end=1741
_WIFIWPSPBCSTART._serialized_start=1743
_WIFIWPSPBCSTART._serialized_end=1800
_WIFIREPEATERWPSCLONEPBCSTART._serialized_start=1802
_WIFIREPEATERWPSCLONEPBCSTART._serialized_end=1872
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/device_api/wifinetwork_pb2.pyi 0000664 0000000 0000000 00000046230 14777250235 0025423 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import collections.abc
import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import sys
import typing
if sys.version_info >= (3, 10):
import typing as typing_extensions
else:
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class _WifiResult:
ValueType = typing.NewType("ValueType", builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _WifiResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_WifiResult.ValueType], builtins.type): # noqa: F821
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
WIFI_SUCCESS: _WifiResult.ValueType # 0
WIFI_INVALID_SSID: _WifiResult.ValueType # 1
WIFI_INVALID_KEY: _WifiResult.ValueType # 2
WIFI_IS_DISABLED: _WifiResult.ValueType # 3
WIFI_INVALID_BACKHAUL_SSID: _WifiResult.ValueType # 4
"""@since 1"""
WIFI_INVALID_BACKHAUL_KEY: _WifiResult.ValueType # 5
"""@since 1"""
WIFI_UNSUPPORTED_DEVICE_MODE: _WifiResult.ValueType # 6
"""@since 1"""
WIFI_UNKNOWN_ERROR: _WifiResult.ValueType # 255
class WifiResult(_WifiResult, metaclass=_WifiResultEnumTypeWrapper): ...
WIFI_SUCCESS: WifiResult.ValueType # 0
WIFI_INVALID_SSID: WifiResult.ValueType # 1
WIFI_INVALID_KEY: WifiResult.ValueType # 2
WIFI_IS_DISABLED: WifiResult.ValueType # 3
WIFI_INVALID_BACKHAUL_SSID: WifiResult.ValueType # 4
"""@since 1"""
WIFI_INVALID_BACKHAUL_KEY: WifiResult.ValueType # 5
"""@since 1"""
WIFI_UNSUPPORTED_DEVICE_MODE: WifiResult.ValueType # 6
"""@since 1"""
WIFI_UNKNOWN_ERROR: WifiResult.ValueType # 255
global___WifiResult = WifiResult
class _WifiBand:
ValueType = typing.NewType("ValueType", builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _WifiBandEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_WifiBand.ValueType], builtins.type): # noqa: F821
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
WIFI_BAND_UNKNOWN: _WifiBand.ValueType # 0
WIFI_BAND_2G: _WifiBand.ValueType # 1
WIFI_BAND_5G: _WifiBand.ValueType # 2
class WifiBand(_WifiBand, metaclass=_WifiBandEnumTypeWrapper): ...
WIFI_BAND_UNKNOWN: WifiBand.ValueType # 0
WIFI_BAND_2G: WifiBand.ValueType # 1
WIFI_BAND_5G: WifiBand.ValueType # 2
global___WifiBand = WifiBand
class _WifiVAPType:
ValueType = typing.NewType("ValueType", builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _WifiVAPTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_WifiVAPType.ValueType], builtins.type): # noqa: F821
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
WIFI_VAP_UNKNOWN: _WifiVAPType.ValueType # 0
WIFI_VAP_MAIN_AP: _WifiVAPType.ValueType # 1
WIFI_VAP_GUEST_AP: _WifiVAPType.ValueType # 2
WIFI_VAP_STATION: _WifiVAPType.ValueType # 3
class WifiVAPType(_WifiVAPType, metaclass=_WifiVAPTypeEnumTypeWrapper): ...
WIFI_VAP_UNKNOWN: WifiVAPType.ValueType # 0
WIFI_VAP_MAIN_AP: WifiVAPType.ValueType # 1
WIFI_VAP_GUEST_AP: WifiVAPType.ValueType # 2
WIFI_VAP_STATION: WifiVAPType.ValueType # 3
global___WifiVAPType = WifiVAPType
class _WifiWpaMode:
ValueType = typing.NewType("ValueType", builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _WifiWpaModeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_WifiWpaMode.ValueType], builtins.type): # noqa: F821
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
WPA_NO_CHANGE: _WifiWpaMode.ValueType # 0
WPA_NONE: _WifiWpaMode.ValueType # 1
WPA_1_2: _WifiWpaMode.ValueType # 2
WPA_2: _WifiWpaMode.ValueType # 3
WPA_2_3: _WifiWpaMode.ValueType # 4
WPA_3: _WifiWpaMode.ValueType # 5
class WifiWpaMode(_WifiWpaMode, metaclass=_WifiWpaModeEnumTypeWrapper):
"""@since 1"""
WPA_NO_CHANGE: WifiWpaMode.ValueType # 0
WPA_NONE: WifiWpaMode.ValueType # 1
WPA_1_2: WifiWpaMode.ValueType # 2
WPA_2: WifiWpaMode.ValueType # 3
WPA_2_3: WifiWpaMode.ValueType # 4
WPA_3: WifiWpaMode.ValueType # 5
global___WifiWpaMode = WifiWpaMode
class _WifiDeviceMode:
ValueType = typing.NewType("ValueType", builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _WifiDeviceModeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_WifiDeviceMode.ValueType], builtins.type): # noqa: F821
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
WDM_NO_CONF: _WifiDeviceMode.ValueType # 0
"""Unconfigured, built in automation defines operating mode"""
WDM_AP: _WifiDeviceMode.ValueType # 2
"""Configured to run as access point"""
WDM_REPEATER: _WifiDeviceMode.ValueType # 3
"""Configured to run as WiFi repeater"""
class WifiDeviceMode(_WifiDeviceMode, metaclass=_WifiDeviceModeEnumTypeWrapper):
"""@since 1"""
WDM_NO_CONF: WifiDeviceMode.ValueType # 0
"""Unconfigured, built in automation defines operating mode"""
WDM_AP: WifiDeviceMode.ValueType # 2
"""Configured to run as access point"""
WDM_REPEATER: WifiDeviceMode.ValueType # 3
"""Configured to run as WiFi repeater"""
global___WifiDeviceMode = WifiDeviceMode
class WifiDeviceModeGetResponse(google.protobuf.message.Message):
"""@since 1"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MODE_FIELD_NUMBER: builtins.int
mode: global___WifiDeviceMode.ValueType
"""The mode the device is currently operating in, e.g. repeater, AP."""
def __init__(
self,
*,
mode: global___WifiDeviceMode.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["mode", b"mode"]) -> None: ...
global___WifiDeviceModeGetResponse = WifiDeviceModeGetResponse
class WifiDeviceModeSet(google.protobuf.message.Message):
"""@since 1"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MODE_FIELD_NUMBER: builtins.int
FH_PARAMS_FIELD_NUMBER: builtins.int
BH_PARAMS_FIELD_NUMBER: builtins.int
mode: global___WifiDeviceMode.ValueType
"""The mode the device shall operate in, e.g. repeater, AP."""
@property
def fh_params(self) -> global___WifiParametersSet:
"""The front haul WiFi parameters, i.e. the WiFi the clients connect to."""
@property
def bh_params(self) -> global___WifiRepeaterParametersSet:
""" When left out, parameters are not changed on the device.
The back haul WiFi parameters, i.e. the gateway's WiFi the repeater connects to.
"""
def __init__(
self,
*,
mode: global___WifiDeviceMode.ValueType = ...,
fh_params: global___WifiParametersSet | None = ...,
bh_params: global___WifiRepeaterParametersSet | None = ...,
) -> None: ...
def HasField(self, field_name: typing_extensions.Literal["bh_params", b"bh_params", "fh_params", b"fh_params"]) -> builtins.bool: ...
def ClearField(self, field_name: typing_extensions.Literal["bh_params", b"bh_params", "fh_params", b"fh_params", "mode", b"mode"]) -> None: ...
global___WifiDeviceModeSet = WifiDeviceModeSet
class WifiDeviceModeSetResponse(google.protobuf.message.Message):
"""@since 1"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
RESULT_FIELD_NUMBER: builtins.int
result: global___WifiResult.ValueType
"""Success or failure status."""
def __init__(
self,
*,
result: global___WifiResult.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result", b"result"]) -> None: ...
global___WifiDeviceModeSetResponse = WifiDeviceModeSetResponse
class WifiParametersSet(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
SSID_FIELD_NUMBER: builtins.int
KEY_FIELD_NUMBER: builtins.int
ssid: builtins.str
"""WiFi ssid"""
key: builtins.str
"""WiFi key, independent of the type (WPA2, ...)"""
def __init__(
self,
*,
ssid: builtins.str = ...,
key: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["key", b"key", "ssid", b"ssid"]) -> None: ...
global___WifiParametersSet = WifiParametersSet
class WifiParametersSetResponse(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
RESULT_FIELD_NUMBER: builtins.int
result: global___WifiResult.ValueType
"""contains the result of setting WiFi Parameter message"""
def __init__(
self,
*,
result: global___WifiResult.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result", b"result"]) -> None: ...
global___WifiParametersSetResponse = WifiParametersSetResponse
class WifiGuestAccessSet(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
ENABLE_FIELD_NUMBER: builtins.int
DURATION_FIELD_NUMBER: builtins.int
SSID_FIELD_NUMBER: builtins.int
KEY_FIELD_NUMBER: builtins.int
WPA_FIELD_NUMBER: builtins.int
enable: builtins.bool
duration: builtins.int
"""time in minutes; 0 is infinity"""
ssid: builtins.str
"""Guest WiFi SSID. Leaving it out means not to change the current value. (@since 1)"""
key: builtins.str
"""Guest WiFi key. Leaving it out means not to change the current value. (@since 1)"""
wpa: global___WifiWpaMode.ValueType
"""Encryption mode. Leaving it out means not to change the current value. (@since 1)"""
def __init__(
self,
*,
enable: builtins.bool = ...,
duration: builtins.int = ...,
ssid: builtins.str = ...,
key: builtins.str = ...,
wpa: global___WifiWpaMode.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["duration", b"duration", "enable", b"enable", "key", b"key", "ssid", b"ssid", "wpa", b"wpa"]) -> None: ...
global___WifiGuestAccessSet = WifiGuestAccessSet
class WifiGuestAccessSetResponse(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
RESULT_FIELD_NUMBER: builtins.int
result: global___WifiResult.ValueType
"""contains the result of setting WiFi Guest Access parameters"""
def __init__(
self,
*,
result: global___WifiResult.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result", b"result"]) -> None: ...
global___WifiGuestAccessSetResponse = WifiGuestAccessSetResponse
class WifiGuestAccessGet(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
ENABLED_FIELD_NUMBER: builtins.int
REMAINING_DURATION_FIELD_NUMBER: builtins.int
SSID_FIELD_NUMBER: builtins.int
KEY_FIELD_NUMBER: builtins.int
WPA_FIELD_NUMBER: builtins.int
enabled: builtins.bool
remaining_duration: builtins.int
ssid: builtins.str
key: builtins.str
wpa: global___WifiWpaMode.ValueType
"""Encryption mode. (@since 1)"""
def __init__(
self,
*,
enabled: builtins.bool = ...,
remaining_duration: builtins.int = ...,
ssid: builtins.str = ...,
key: builtins.str = ...,
wpa: global___WifiWpaMode.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["enabled", b"enabled", "key", b"key", "remaining_duration", b"remaining_duration", "ssid", b"ssid", "wpa", b"wpa"]) -> None: ...
global___WifiGuestAccessGet = WifiGuestAccessGet
class WifiNeighborAPsGet(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class NeighborAPInfo(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MAC_ADDRESS_FIELD_NUMBER: builtins.int
SSID_FIELD_NUMBER: builtins.int
BAND_FIELD_NUMBER: builtins.int
CHANNEL_FIELD_NUMBER: builtins.int
SIGNAL_FIELD_NUMBER: builtins.int
SIGNAL_BARS_FIELD_NUMBER: builtins.int
mac_address: builtins.str
ssid: builtins.str
band: global___WifiBand.ValueType
channel: builtins.int
signal: builtins.int
signal_bars: builtins.int
def __init__(
self,
*,
mac_address: builtins.str = ...,
ssid: builtins.str = ...,
band: global___WifiBand.ValueType = ...,
channel: builtins.int = ...,
signal: builtins.int = ...,
signal_bars: builtins.int = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["band", b"band", "channel", b"channel", "mac_address", b"mac_address", "signal", b"signal", "signal_bars", b"signal_bars", "ssid", b"ssid"]) -> None: ...
NEIGHBOR_APS_FIELD_NUMBER: builtins.int
@property
def neighbor_aps(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___WifiNeighborAPsGet.NeighborAPInfo]: ...
def __init__(
self,
*,
neighbor_aps: collections.abc.Iterable[global___WifiNeighborAPsGet.NeighborAPInfo] | None = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["neighbor_aps", b"neighbor_aps"]) -> None: ...
global___WifiNeighborAPsGet = WifiNeighborAPsGet
class WifiRepeatedAPsGet(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class RepeatedAPInfo(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MAC_ADDRESS_FIELD_NUMBER: builtins.int
SSID_FIELD_NUMBER: builtins.int
BAND_FIELD_NUMBER: builtins.int
CHANNEL_FIELD_NUMBER: builtins.int
RATE_FIELD_NUMBER: builtins.int
SIGNAL_FIELD_NUMBER: builtins.int
SIGNAL_BARS_FIELD_NUMBER: builtins.int
mac_address: builtins.str
ssid: builtins.str
band: global___WifiBand.ValueType
channel: builtins.int
rate: builtins.int
signal: builtins.int
signal_bars: builtins.int
def __init__(
self,
*,
mac_address: builtins.str = ...,
ssid: builtins.str = ...,
band: global___WifiBand.ValueType = ...,
channel: builtins.int = ...,
rate: builtins.int = ...,
signal: builtins.int = ...,
signal_bars: builtins.int = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["band", b"band", "channel", b"channel", "mac_address", b"mac_address", "rate", b"rate", "signal", b"signal", "signal_bars", b"signal_bars", "ssid", b"ssid"]) -> None: ...
REPEATED_APS_FIELD_NUMBER: builtins.int
@property
def repeated_aps(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___WifiRepeatedAPsGet.RepeatedAPInfo]: ...
def __init__(
self,
*,
repeated_aps: collections.abc.Iterable[global___WifiRepeatedAPsGet.RepeatedAPInfo] | None = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["repeated_aps", b"repeated_aps"]) -> None: ...
global___WifiRepeatedAPsGet = WifiRepeatedAPsGet
class WifiConnectedStationsGet(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class ConnectedStationInfo(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MAC_ADDRESS_FIELD_NUMBER: builtins.int
VAP_TYPE_FIELD_NUMBER: builtins.int
BAND_FIELD_NUMBER: builtins.int
RX_RATE_FIELD_NUMBER: builtins.int
TX_RATE_FIELD_NUMBER: builtins.int
mac_address: builtins.str
vap_type: global___WifiVAPType.ValueType
band: global___WifiBand.ValueType
rx_rate: builtins.int
tx_rate: builtins.int
def __init__(
self,
*,
mac_address: builtins.str = ...,
vap_type: global___WifiVAPType.ValueType = ...,
band: global___WifiBand.ValueType = ...,
rx_rate: builtins.int = ...,
tx_rate: builtins.int = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["band", b"band", "mac_address", b"mac_address", "rx_rate", b"rx_rate", "tx_rate", b"tx_rate", "vap_type", b"vap_type"]) -> None: ...
CONNECTED_STATIONS_FIELD_NUMBER: builtins.int
@property
def connected_stations(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___WifiConnectedStationsGet.ConnectedStationInfo]: ...
def __init__(
self,
*,
connected_stations: collections.abc.Iterable[global___WifiConnectedStationsGet.ConnectedStationInfo] | None = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["connected_stations", b"connected_stations"]) -> None: ...
global___WifiConnectedStationsGet = WifiConnectedStationsGet
class WifiRepeaterParametersSet(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
SSID_FIELD_NUMBER: builtins.int
KEY_FIELD_NUMBER: builtins.int
CROSSBAND_FIELD_NUMBER: builtins.int
PRIMARY_BAND_FIELD_NUMBER: builtins.int
ssid: builtins.str
"""Wifi ssid"""
key: builtins.str
"""Wifi key, independent of the type (WPA2, ...)"""
crossband: builtins.bool
"""Use crossband (true) or in-band repeating (false)"""
primary_band: global___WifiBand.ValueType
"""Primary backhaul band when using crossband"""
def __init__(
self,
*,
ssid: builtins.str = ...,
key: builtins.str = ...,
crossband: builtins.bool = ...,
primary_band: global___WifiBand.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["crossband", b"crossband", "key", b"key", "primary_band", b"primary_band", "ssid", b"ssid"]) -> None: ...
global___WifiRepeaterParametersSet = WifiRepeaterParametersSet
class WifiRepeaterParametersSetResponse(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
RESULT_FIELD_NUMBER: builtins.int
result: global___WifiResult.ValueType
def __init__(
self,
*,
result: global___WifiResult.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result", b"result"]) -> None: ...
global___WifiRepeaterParametersSetResponse = WifiRepeaterParametersSetResponse
class WifiWpsPbcStart(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
RESULT_FIELD_NUMBER: builtins.int
result: global___WifiResult.ValueType
def __init__(
self,
*,
result: global___WifiResult.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result", b"result"]) -> None: ...
global___WifiWpsPbcStart = WifiWpsPbcStart
class WifiRepeaterWpsClonePbcStart(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
RESULT_FIELD_NUMBER: builtins.int
result: global___WifiResult.ValueType
def __init__(
self,
*,
result: global___WifiResult.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result", b"result"]) -> None: ...
global___WifiRepeaterWpsClonePbcStart = WifiRepeaterWpsClonePbcStart
devolo_plc_api-1.5.1/devolo_plc_api/exceptions/ 0000775 0000000 0000000 00000000000 14777250235 0021651 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/devolo_plc_api/exceptions/__init__.py 0000664 0000000 0000000 00000000404 14777250235 0023760 0 ustar 00root root 0000000 0000000 """Exceptions used by the package."""
from .device import DeviceNotFound, DevicePasswordProtected, DeviceUnavailable
from .feature import FeatureNotSupported
__all__ = ["DeviceNotFound", "DevicePasswordProtected", "DeviceUnavailable", "FeatureNotSupported"]
devolo_plc_api-1.5.1/devolo_plc_api/exceptions/device.py 0000664 0000000 0000000 00000001334 14777250235 0023463 0 ustar 00root root 0000000 0000000 """Exceptions that can occur when communicating with a devolo device."""
class DeviceNotFound(Exception):
"""The device was not found."""
def __init__(self, ip: str) -> None:
"""Initialize error."""
super().__init__(f"The device {ip} did not answer.")
class DeviceUnavailable(Exception):
"""The device is not available, e.g. in standby."""
def __init__(self) -> None:
"""Initialize error."""
super().__init__("The device is currently not available. Maybe on standby?")
class DevicePasswordProtected(Exception):
"""The device is password protected."""
def __init__(self) -> None:
"""Initialize error."""
super().__init__("The used password is wrong.")
devolo_plc_api-1.5.1/devolo_plc_api/exceptions/feature.py 0000664 0000000 0000000 00000000455 14777250235 0023662 0 ustar 00root root 0000000 0000000 """Exceptions that can occur when determining features."""
class FeatureNotSupported(Exception):
"""The feature is not supported by your device."""
def __init__(self, feature: str) -> None:
"""Initialize error."""
super().__init__(f"The device does not support {feature}.")
devolo_plc_api-1.5.1/devolo_plc_api/helpers/ 0000775 0000000 0000000 00000000000 14777250235 0021132 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/devolo_plc_api/helpers/__init__.py 0000664 0000000 0000000 00000001437 14777250235 0023250 0 ustar 00root root 0000000 0000000 """Helper methods to allow advanced usage of information provided by the device."""
from io import BytesIO
from typing import Any
from segno.helpers import make_wifi
from devolo_plc_api.device_api import WifiGuestAccessGet
from devolo_plc_api.device_api.wifinetwork_pb2 import WPA_NONE
def wifi_qr_code(guest_wifi: WifiGuestAccessGet, kind: str = "svg", **kwargs: Any) -> bytes:
"""
Generate a wifi QR code.
:param guest_wifi: Wifi credentials to represent in the QR code
:param kind: Output format of the image
:return: Bytes of image
"""
buffer = BytesIO()
qr_code = make_wifi(ssid=guest_wifi.ssid, password=guest_wifi.key, security=None if guest_wifi.wpa == WPA_NONE else "WPA")
qr_code.save(out=buffer, kind=kind, **kwargs)
return buffer.getvalue()
devolo_plc_api-1.5.1/devolo_plc_api/network/ 0000775 0000000 0000000 00000000000 14777250235 0021161 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/devolo_plc_api/network/__init__.py 0000664 0000000 0000000 00000005416 14777250235 0023300 0 ustar 00root root 0000000 0000000 """Discover devices in your network."""
from __future__ import annotations
import asyncio
import time
from ipaddress import ip_address
from typing import Any, cast
from ifaddr import get_adapters
from zeroconf import DNSQuestionType, ServiceBrowser, ServiceStateChange, Zeroconf
from devolo_plc_api.device import Device
from devolo_plc_api.device_api import SERVICE_TYPE
async def async_discover_network(timeout: float = 3) -> dict[str, Device]:
"""
Discover all devices that expose the devolo device API via mDNS asynchronous.
:return: Devices accessible via serial number.
"""
devices: dict[str, Device] = {}
def add(zeroconf: Zeroconf, service_type: str, name: str, state_change: ServiceStateChange) -> None:
"""React on state changes."""
_add(zeroconf, service_type, name, state_change, devices=devices, timeout=timeout)
browser = ServiceBrowser(Zeroconf(interfaces=_interfaces()), SERVICE_TYPE, [add], question_type=DNSQuestionType.QM)
await asyncio.sleep(timeout)
browser.cancel()
return devices
def discover_network(timeout: float = 3) -> dict[str, Device]:
"""
Discover devices that expose the devolo device API via mDNS synchronous.
:return: Devices accessible via serial number.
"""
devices: dict[str, Device] = {}
def add(zeroconf: Zeroconf, service_type: str, name: str, state_change: ServiceStateChange) -> None:
"""React on state changes."""
_add(zeroconf, service_type, name, state_change, devices=devices, timeout=timeout)
browser = ServiceBrowser(Zeroconf(interfaces=_interfaces()), SERVICE_TYPE, [add], question_type=DNSQuestionType.QM)
time.sleep(timeout)
browser.cancel()
return devices
def _add(zeroconf: Zeroconf, service_type: str, name: str, state_change: ServiceStateChange, **kwargs: Any) -> None:
"""Create a device object to each matching device."""
if state_change is not ServiceStateChange.Added:
return
if (service_info := zeroconf.get_service_info(service_type, name, timeout=kwargs["timeout"] * 1000)) is None:
return
info = Device.info_from_service(service_info)
if info is None or info.properties["MT"] in ("2600", "2601"):
return # Don't react on devolo Home Control central units
devices: dict[str, Device] = kwargs["devices"]
devices[info.properties["SN"]] = Device(ip=str(ip_address(info.address)), zeroconf_instance=zeroconf)
def _interfaces() -> list[str]:
"""Get IP addresses not being localhost."""
interface: list[str] = []
for adapter in get_adapters():
interface.extend(cast("str", ip.ip) for ip in adapter.ips if ip.is_IPv4 and ip.ip != "127.0.0.1")
interface.extend(cast("str", ip.ip[0]) for ip in adapter.ips if ip.is_IPv6 and ip.ip[0] != "::1")
return interface
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/ 0000775 0000000 0000000 00000000000 14777250235 0021606 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/__init__.py 0000664 0000000 0000000 00000001512 14777250235 0023716 0 ustar 00root root 0000000 0000000 """The devolo plcnet API."""
from .getnetworkoverview_pb2 import GetNetworkOverview
from .plcnetapi import PlcNetApi
DEVICES_WITHOUT_PLCNET = ["3046", "3047", "3048", "3049", "3254", "3255", "3256"]
GHN_SPIRIT = GetNetworkOverview.Device.GHN_SPIRIT
HPAV_PANTHER = GetNetworkOverview.Device.HPAV_PANTHER
HPAV_THUNDERBOLT = GetNetworkOverview.Device.HPAV_THUNDERBOLT
LOCAL = GetNetworkOverview.Device.LOCAL
REMOTE = GetNetworkOverview.Device.REMOTE
SERVICE_TYPE = "_dvl-plcnetapi._tcp.local."
DataRate = GetNetworkOverview.DataRate
Device = GetNetworkOverview.Device
LogicalNetwork = GetNetworkOverview.LogicalNetwork
__all__ = [
"DEVICES_WITHOUT_PLCNET",
"GHN_SPIRIT",
"HPAV_PANTHER",
"HPAV_THUNDERBOLT",
"LOCAL",
"REMOTE",
"SERVICE_TYPE",
"DataRate",
"Device",
"LogicalNetwork",
"PlcNetApi",
]
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/getnetworkoverview_pb2.py 0000664 0000000 0000000 00000011256 14777250235 0026710 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: getnetworkoverview.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18getnetworkoverview.proto\x12\nplcnet.api\"\xd5\x06\n\x12GetNetworkOverview\x12>\n\x07network\x18\x01 \x01(\x0b\x32-.plcnet.api.GetNetworkOverview.LogicalNetwork\x1a\x96\x04\n\x06\x44\x65vice\x12\x14\n\x0cproduct_name\x18\x01 \x01(\t\x12\x12\n\nproduct_id\x18\x02 \x01(\t\x12\x18\n\x10\x66riendly_version\x18\x03 \x01(\t\x12\x14\n\x0c\x66ull_version\x18\x04 \x01(\t\x12\x18\n\x10user_device_name\x18\x05 \x01(\t\x12\x19\n\x11user_network_name\x18\x06 \x01(\t\x12\x13\n\x0bmac_address\x18\x07 \x01(\t\x12@\n\x08topology\x18\x08 \x01(\x0e\x32..plcnet.api.GetNetworkOverview.Device.Topology\x12\x44\n\ntechnology\x18\t \x01(\x0e\x32\x30.plcnet.api.GetNetworkOverview.Device.Technology\x12\x17\n\x0f\x62ridged_devices\x18\n \x03(\t\x12\x14\n\x0cipv4_address\x18\x0b \x01(\t\x12\x1a\n\x12\x61ttached_to_router\x18\x0c \x01(\x08\"7\n\x08Topology\x12\x14\n\x10UNKNOWN_TOPOLOGY\x10\x00\x12\t\n\x05LOCAL\x10\x01\x12\n\n\x06REMOTE\x10\x02\"\\\n\nTechnology\x12\x16\n\x12UNKNOWN_TECHNOLOGY\x10\x00\x12\x14\n\x10HPAV_THUNDERBOLT\x10\x03\x12\x10\n\x0cHPAV_PANTHER\x10\x04\x12\x0e\n\nGHN_SPIRIT\x10\x07\x1a^\n\x08\x44\x61taRate\x12\x18\n\x10mac_address_from\x18\x01 \x01(\t\x12\x16\n\x0emac_address_to\x18\x02 \x01(\t\x12\x0f\n\x07tx_rate\x18\x03 \x01(\x01\x12\x0f\n\x07rx_rate\x18\x04 \x01(\x01\x1a\x85\x01\n\x0eLogicalNetwork\x12\x36\n\x07\x64\x65vices\x18\x01 \x03(\x0b\x32%.plcnet.api.GetNetworkOverview.Device\x12;\n\ndata_rates\x18\x02 \x03(\x0b\x32\'.plcnet.api.GetNetworkOverview.DataRateB\r\n\x06plcnetB\x03netb\x06proto3')
_GETNETWORKOVERVIEW = DESCRIPTOR.message_types_by_name['GetNetworkOverview']
_GETNETWORKOVERVIEW_DEVICE = _GETNETWORKOVERVIEW.nested_types_by_name['Device']
_GETNETWORKOVERVIEW_DATARATE = _GETNETWORKOVERVIEW.nested_types_by_name['DataRate']
_GETNETWORKOVERVIEW_LOGICALNETWORK = _GETNETWORKOVERVIEW.nested_types_by_name['LogicalNetwork']
_GETNETWORKOVERVIEW_DEVICE_TOPOLOGY = _GETNETWORKOVERVIEW_DEVICE.enum_types_by_name['Topology']
_GETNETWORKOVERVIEW_DEVICE_TECHNOLOGY = _GETNETWORKOVERVIEW_DEVICE.enum_types_by_name['Technology']
GetNetworkOverview = _reflection.GeneratedProtocolMessageType('GetNetworkOverview', (_message.Message,), {
'Device' : _reflection.GeneratedProtocolMessageType('Device', (_message.Message,), {
'DESCRIPTOR' : _GETNETWORKOVERVIEW_DEVICE,
'__module__' : 'getnetworkoverview_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.GetNetworkOverview.Device)
})
,
'DataRate' : _reflection.GeneratedProtocolMessageType('DataRate', (_message.Message,), {
'DESCRIPTOR' : _GETNETWORKOVERVIEW_DATARATE,
'__module__' : 'getnetworkoverview_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.GetNetworkOverview.DataRate)
})
,
'LogicalNetwork' : _reflection.GeneratedProtocolMessageType('LogicalNetwork', (_message.Message,), {
'DESCRIPTOR' : _GETNETWORKOVERVIEW_LOGICALNETWORK,
'__module__' : 'getnetworkoverview_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.GetNetworkOverview.LogicalNetwork)
})
,
'DESCRIPTOR' : _GETNETWORKOVERVIEW,
'__module__' : 'getnetworkoverview_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.GetNetworkOverview)
})
_sym_db.RegisterMessage(GetNetworkOverview)
_sym_db.RegisterMessage(GetNetworkOverview.Device)
_sym_db.RegisterMessage(GetNetworkOverview.DataRate)
_sym_db.RegisterMessage(GetNetworkOverview.LogicalNetwork)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006plcnetB\003net'
_GETNETWORKOVERVIEW._serialized_start=41
_GETNETWORKOVERVIEW._serialized_end=894
_GETNETWORKOVERVIEW_DEVICE._serialized_start=128
_GETNETWORKOVERVIEW_DEVICE._serialized_end=662
_GETNETWORKOVERVIEW_DEVICE_TOPOLOGY._serialized_start=513
_GETNETWORKOVERVIEW_DEVICE_TOPOLOGY._serialized_end=568
_GETNETWORKOVERVIEW_DEVICE_TECHNOLOGY._serialized_start=570
_GETNETWORKOVERVIEW_DEVICE_TECHNOLOGY._serialized_end=662
_GETNETWORKOVERVIEW_DATARATE._serialized_start=664
_GETNETWORKOVERVIEW_DATARATE._serialized_end=758
_GETNETWORKOVERVIEW_LOGICALNETWORK._serialized_start=761
_GETNETWORKOVERVIEW_LOGICALNETWORK._serialized_end=894
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/getnetworkoverview_pb2.pyi 0000664 0000000 0000000 00000022360 14777250235 0027057 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class GetNetworkOverview(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class Device(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Topology:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _TopologyEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[GetNetworkOverview.Device._Topology.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
UNKNOWN_TOPOLOGY: GetNetworkOverview.Device._Topology.ValueType # 0
LOCAL: GetNetworkOverview.Device._Topology.ValueType # 1
"""the device is LOCAL (i.e. reachable via eth/wifi)"""
REMOTE: GetNetworkOverview.Device._Topology.ValueType # 2
"""the device is REMOTE (i.e. connected via powerline to the LOCAL device)"""
class Topology(_Topology, metaclass=_TopologyEnumTypeWrapper):
pass
UNKNOWN_TOPOLOGY: GetNetworkOverview.Device.Topology.ValueType # 0
LOCAL: GetNetworkOverview.Device.Topology.ValueType # 1
"""the device is LOCAL (i.e. reachable via eth/wifi)"""
REMOTE: GetNetworkOverview.Device.Topology.ValueType # 2
"""the device is REMOTE (i.e. connected via powerline to the LOCAL device)"""
class _Technology:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _TechnologyEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[GetNetworkOverview.Device._Technology.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
UNKNOWN_TECHNOLOGY: GetNetworkOverview.Device._Technology.ValueType # 0
HPAV_THUNDERBOLT: GetNetworkOverview.Device._Technology.ValueType # 3
"""HomePlugAV device (based on Intellon/QCA Thunderbolt or later, i.e. 6x00/74x0 family)"""
HPAV_PANTHER: GetNetworkOverview.Device._Technology.ValueType # 4
"""HomePlugAV device (based on Intellon/QCA Panther or later, i.e. 7420/75x0 family)"""
GHN_SPIRIT: GetNetworkOverview.Device._Technology.ValueType # 7
"""G.hn device (based on Maxlinear Spirit firmware)"""
class Technology(_Technology, metaclass=_TechnologyEnumTypeWrapper):
pass
UNKNOWN_TECHNOLOGY: GetNetworkOverview.Device.Technology.ValueType # 0
HPAV_THUNDERBOLT: GetNetworkOverview.Device.Technology.ValueType # 3
"""HomePlugAV device (based on Intellon/QCA Thunderbolt or later, i.e. 6x00/74x0 family)"""
HPAV_PANTHER: GetNetworkOverview.Device.Technology.ValueType # 4
"""HomePlugAV device (based on Intellon/QCA Panther or later, i.e. 7420/75x0 family)"""
GHN_SPIRIT: GetNetworkOverview.Device.Technology.ValueType # 7
"""G.hn device (based on Maxlinear Spirit firmware)"""
PRODUCT_NAME_FIELD_NUMBER: builtins.int
PRODUCT_ID_FIELD_NUMBER: builtins.int
FRIENDLY_VERSION_FIELD_NUMBER: builtins.int
FULL_VERSION_FIELD_NUMBER: builtins.int
USER_DEVICE_NAME_FIELD_NUMBER: builtins.int
USER_NETWORK_NAME_FIELD_NUMBER: builtins.int
MAC_ADDRESS_FIELD_NUMBER: builtins.int
TOPOLOGY_FIELD_NUMBER: builtins.int
TECHNOLOGY_FIELD_NUMBER: builtins.int
BRIDGED_DEVICES_FIELD_NUMBER: builtins.int
IPV4_ADDRESS_FIELD_NUMBER: builtins.int
ATTACHED_TO_ROUTER_FIELD_NUMBER: builtins.int
product_name: typing.Text
"""product name for display purposes, like "devolo dLAN 1200+" """
product_id: typing.Text
"""internal product identifier, like "MT2639" """
friendly_version: typing.Text
"""version string for display purposes, like "2.5.0.0-1" """
full_version: typing.Text
"""full version string"""
user_device_name: typing.Text
"""user provided device name, if any"""
user_network_name: typing.Text
"""user provided network name, if any"""
mac_address: typing.Text
"""MAC address of the device, like "000B3BC3A4E6" """
topology: global___GetNetworkOverview.Device.Topology.ValueType
"""in a real network, we will always see one LOCAL device
and zero or more REMOTEs
"""
technology: global___GetNetworkOverview.Device.Technology.ValueType
"""in a real network, you will always see either HPAV or GHN devices, but never both"""
@property
def bridged_devices(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]:
"""MAC addresses of devices attached to this device on the LAN side"""
pass
ipv4_address: typing.Text
"""ipv4 address of the device; empty if none is available"""
attached_to_router: builtins.bool
"""indicates whether this adapter is attached to the router or not (only one should be set true)"""
def __init__(self,
*,
product_name: typing.Text = ...,
product_id: typing.Text = ...,
friendly_version: typing.Text = ...,
full_version: typing.Text = ...,
user_device_name: typing.Text = ...,
user_network_name: typing.Text = ...,
mac_address: typing.Text = ...,
topology: global___GetNetworkOverview.Device.Topology.ValueType = ...,
technology: global___GetNetworkOverview.Device.Technology.ValueType = ...,
bridged_devices: typing.Optional[typing.Iterable[typing.Text]] = ...,
ipv4_address: typing.Text = ...,
attached_to_router: builtins.bool = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["attached_to_router",b"attached_to_router","bridged_devices",b"bridged_devices","friendly_version",b"friendly_version","full_version",b"full_version","ipv4_address",b"ipv4_address","mac_address",b"mac_address","product_id",b"product_id","product_name",b"product_name","technology",b"technology","topology",b"topology","user_device_name",b"user_device_name","user_network_name",b"user_network_name"]) -> None: ...
class DataRate(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MAC_ADDRESS_FROM_FIELD_NUMBER: builtins.int
MAC_ADDRESS_TO_FIELD_NUMBER: builtins.int
TX_RATE_FIELD_NUMBER: builtins.int
RX_RATE_FIELD_NUMBER: builtins.int
mac_address_from: typing.Text
"""the powerline device from which we got information about the data rates"""
mac_address_to: typing.Text
"""the powerline device to which we are transmitting/receiving"""
tx_rate: builtins.float
"""transmit data rate in mbps"""
rx_rate: builtins.float
"""receive data rate in mbps"""
def __init__(self,
*,
mac_address_from: typing.Text = ...,
mac_address_to: typing.Text = ...,
tx_rate: builtins.float = ...,
rx_rate: builtins.float = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["mac_address_from",b"mac_address_from","mac_address_to",b"mac_address_to","rx_rate",b"rx_rate","tx_rate",b"tx_rate"]) -> None: ...
class LogicalNetwork(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
DEVICES_FIELD_NUMBER: builtins.int
DATA_RATES_FIELD_NUMBER: builtins.int
@property
def devices(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___GetNetworkOverview.Device]:
"""all devices in the logical network"""
pass
@property
def data_rates(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___GetNetworkOverview.DataRate]:
"""all known data rates between devices in the logical network"""
pass
def __init__(self,
*,
devices: typing.Optional[typing.Iterable[global___GetNetworkOverview.Device]] = ...,
data_rates: typing.Optional[typing.Iterable[global___GetNetworkOverview.DataRate]] = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["data_rates",b"data_rates","devices",b"devices"]) -> None: ...
NETWORK_FIELD_NUMBER: builtins.int
@property
def network(self) -> global___GetNetworkOverview.LogicalNetwork: ...
def __init__(self,
*,
network: typing.Optional[global___GetNetworkOverview.LogicalNetwork] = ...,
) -> None: ...
def HasField(self, field_name: typing_extensions.Literal["network",b"network"]) -> builtins.bool: ...
def ClearField(self, field_name: typing_extensions.Literal["network",b"network"]) -> None: ...
global___GetNetworkOverview = GetNetworkOverview
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/identifydevice_pb2.py 0000664 0000000 0000000 00000005603 14777250235 0025722 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: identifydevice.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14identifydevice.proto\x12\nplcnet.api\"*\n\x13IdentifyDeviceStart\x12\x13\n\x0bmac_address\x18\x01 \x01(\t\")\n\x12IdentifyDeviceStop\x12\x13\n\x0bmac_address\x18\x01 \x01(\t\"\xc2\x01\n\x16IdentifyDeviceResponse\x12\x39\n\x06result\x18\x01 \x01(\x0e\x32).plcnet.api.IdentifyDeviceResponse.Result\"m\n\x06Result\x12\x0b\n\x07SUCCESS\x10\x00\x12\x13\n\x0fMACADDR_INVALID\x10\x01\x12\x13\n\x0fMACADDR_UNKNOWN\x10\x02\x12\x18\n\x13\x43OMMUNICATION_ERROR\x10\xfe\x01\x12\x12\n\rUNKNOWN_ERROR\x10\xff\x01\x42\x12\n\x06plcnetB\x08identityb\x06proto3')
_IDENTIFYDEVICESTART = DESCRIPTOR.message_types_by_name['IdentifyDeviceStart']
_IDENTIFYDEVICESTOP = DESCRIPTOR.message_types_by_name['IdentifyDeviceStop']
_IDENTIFYDEVICERESPONSE = DESCRIPTOR.message_types_by_name['IdentifyDeviceResponse']
_IDENTIFYDEVICERESPONSE_RESULT = _IDENTIFYDEVICERESPONSE.enum_types_by_name['Result']
IdentifyDeviceStart = _reflection.GeneratedProtocolMessageType('IdentifyDeviceStart', (_message.Message,), {
'DESCRIPTOR' : _IDENTIFYDEVICESTART,
'__module__' : 'identifydevice_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.IdentifyDeviceStart)
})
_sym_db.RegisterMessage(IdentifyDeviceStart)
IdentifyDeviceStop = _reflection.GeneratedProtocolMessageType('IdentifyDeviceStop', (_message.Message,), {
'DESCRIPTOR' : _IDENTIFYDEVICESTOP,
'__module__' : 'identifydevice_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.IdentifyDeviceStop)
})
_sym_db.RegisterMessage(IdentifyDeviceStop)
IdentifyDeviceResponse = _reflection.GeneratedProtocolMessageType('IdentifyDeviceResponse', (_message.Message,), {
'DESCRIPTOR' : _IDENTIFYDEVICERESPONSE,
'__module__' : 'identifydevice_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.IdentifyDeviceResponse)
})
_sym_db.RegisterMessage(IdentifyDeviceResponse)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006plcnetB\010identity'
_IDENTIFYDEVICESTART._serialized_start=36
_IDENTIFYDEVICESTART._serialized_end=78
_IDENTIFYDEVICESTOP._serialized_start=80
_IDENTIFYDEVICESTOP._serialized_end=121
_IDENTIFYDEVICERESPONSE._serialized_start=124
_IDENTIFYDEVICERESPONSE._serialized_end=318
_IDENTIFYDEVICERESPONSE_RESULT._serialized_start=209
_IDENTIFYDEVICERESPONSE_RESULT._serialized_end=318
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/identifydevice_pb2.pyi 0000664 0000000 0000000 00000005622 14777250235 0026074 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class IdentifyDeviceStart(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MAC_ADDRESS_FIELD_NUMBER: builtins.int
mac_address: typing.Text
"""MAC address of the targeted device"""
def __init__(self,
*,
mac_address: typing.Text = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["mac_address",b"mac_address"]) -> None: ...
global___IdentifyDeviceStart = IdentifyDeviceStart
class IdentifyDeviceStop(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MAC_ADDRESS_FIELD_NUMBER: builtins.int
mac_address: typing.Text
"""MAC address of the targeted device"""
def __init__(self,
*,
mac_address: typing.Text = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["mac_address",b"mac_address"]) -> None: ...
global___IdentifyDeviceStop = IdentifyDeviceStop
class IdentifyDeviceResponse(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Result:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[IdentifyDeviceResponse._Result.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
SUCCESS: IdentifyDeviceResponse._Result.ValueType # 0
MACADDR_INVALID: IdentifyDeviceResponse._Result.ValueType # 1
MACADDR_UNKNOWN: IdentifyDeviceResponse._Result.ValueType # 2
COMMUNICATION_ERROR: IdentifyDeviceResponse._Result.ValueType # 254
UNKNOWN_ERROR: IdentifyDeviceResponse._Result.ValueType # 255
class Result(_Result, metaclass=_ResultEnumTypeWrapper):
pass
SUCCESS: IdentifyDeviceResponse.Result.ValueType # 0
MACADDR_INVALID: IdentifyDeviceResponse.Result.ValueType # 1
MACADDR_UNKNOWN: IdentifyDeviceResponse.Result.ValueType # 2
COMMUNICATION_ERROR: IdentifyDeviceResponse.Result.ValueType # 254
UNKNOWN_ERROR: IdentifyDeviceResponse.Result.ValueType # 255
RESULT_FIELD_NUMBER: builtins.int
result: global___IdentifyDeviceResponse.Result.ValueType
"""contains the result of StartIdentifyDevice and StopIdentifyDevice message"""
def __init__(self,
*,
result: global___IdentifyDeviceResponse.Result.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result",b"result"]) -> None: ...
global___IdentifyDeviceResponse = IdentifyDeviceResponse
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/pairdevice_pb2.py 0000664 0000000 0000000 00000004365 14777250235 0025046 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pairdevice.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10pairdevice.proto\x12\nplcnet.api\"&\n\x0fPairDeviceStart\x12\x13\n\x0bmac_address\x18\x01 \x01(\t\"\xba\x01\n\x12PairDeviceResponse\x12\x35\n\x06result\x18\x01 \x01(\x0e\x32%.plcnet.api.PairDeviceResponse.Result\"m\n\x06Result\x12\x0b\n\x07SUCCESS\x10\x00\x12\x13\n\x0fMACADDR_INVALID\x10\x01\x12\x13\n\x0fMACADDR_UNKNOWN\x10\x02\x12\x18\n\x13\x43OMMUNICATION_ERROR\x10\xfe\x01\x12\x12\n\rUNKNOWN_ERROR\x10\xff\x01\x42\x11\n\x06plcnetB\x07pairingb\x06proto3')
_PAIRDEVICESTART = DESCRIPTOR.message_types_by_name['PairDeviceStart']
_PAIRDEVICERESPONSE = DESCRIPTOR.message_types_by_name['PairDeviceResponse']
_PAIRDEVICERESPONSE_RESULT = _PAIRDEVICERESPONSE.enum_types_by_name['Result']
PairDeviceStart = _reflection.GeneratedProtocolMessageType('PairDeviceStart', (_message.Message,), {
'DESCRIPTOR' : _PAIRDEVICESTART,
'__module__' : 'pairdevice_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.PairDeviceStart)
})
_sym_db.RegisterMessage(PairDeviceStart)
PairDeviceResponse = _reflection.GeneratedProtocolMessageType('PairDeviceResponse', (_message.Message,), {
'DESCRIPTOR' : _PAIRDEVICERESPONSE,
'__module__' : 'pairdevice_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.PairDeviceResponse)
})
_sym_db.RegisterMessage(PairDeviceResponse)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006plcnetB\007pairing'
_PAIRDEVICESTART._serialized_start=32
_PAIRDEVICESTART._serialized_end=70
_PAIRDEVICERESPONSE._serialized_start=73
_PAIRDEVICERESPONSE._serialized_end=259
_PAIRDEVICERESPONSE_RESULT._serialized_start=150
_PAIRDEVICERESPONSE_RESULT._serialized_end=259
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/pairdevice_pb2.pyi 0000664 0000000 0000000 00000004752 14777250235 0025217 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class PairDeviceStart(google.protobuf.message.Message):
"""
Message to trigger the pairing process
Http POST this payload
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MAC_ADDRESS_FIELD_NUMBER: builtins.int
mac_address: typing.Text
"""MAC address of the targeted device"""
def __init__(self,
*,
mac_address: typing.Text = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["mac_address",b"mac_address"]) -> None: ...
global___PairDeviceStart = PairDeviceStart
class PairDeviceResponse(google.protobuf.message.Message):
"""
Message which will be returned upon reception of PairDeviceStarte
"""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Result:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[PairDeviceResponse._Result.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
SUCCESS: PairDeviceResponse._Result.ValueType # 0
MACADDR_INVALID: PairDeviceResponse._Result.ValueType # 1
MACADDR_UNKNOWN: PairDeviceResponse._Result.ValueType # 2
COMMUNICATION_ERROR: PairDeviceResponse._Result.ValueType # 254
UNKNOWN_ERROR: PairDeviceResponse._Result.ValueType # 255
class Result(_Result, metaclass=_ResultEnumTypeWrapper):
pass
SUCCESS: PairDeviceResponse.Result.ValueType # 0
MACADDR_INVALID: PairDeviceResponse.Result.ValueType # 1
MACADDR_UNKNOWN: PairDeviceResponse.Result.ValueType # 2
COMMUNICATION_ERROR: PairDeviceResponse.Result.ValueType # 254
UNKNOWN_ERROR: PairDeviceResponse.Result.ValueType # 255
RESULT_FIELD_NUMBER: builtins.int
result: global___PairDeviceResponse.Result.ValueType
"""contains the result of PairDeviceStart"""
def __init__(self,
*,
result: global___PairDeviceResponse.Result.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result",b"result"]) -> None: ...
global___PairDeviceResponse = PairDeviceResponse
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/plcnetapi.py 0000664 0000000 0000000 00000010126 14777250235 0024137 0 ustar 00root root 0000000 0000000 """Implementation of the devolo plcnet API."""
from __future__ import annotations
from typing import TYPE_CHECKING
from devolo_plc_api.clients import Protobuf
from .getnetworkoverview_pb2 import GetNetworkOverview
from .identifydevice_pb2 import IdentifyDeviceResponse, IdentifyDeviceStart, IdentifyDeviceStop
from .pairdevice_pb2 import PairDeviceResponse, PairDeviceStart
from .setuserdevicename_pb2 import SetUserDeviceName, SetUserDeviceNameResponse
if TYPE_CHECKING:
from httpx import AsyncClient
from devolo_plc_api.zeroconf import ZeroconfServiceInfo
class PlcNetApi(Protobuf):
"""
Implementation of the devolo plcnet API.
:param ip: IP address of the device to communicate with
:param session: HTTP client session
:param info: Information collected from the mDNS query
"""
def __init__(self, ip: str, session: AsyncClient, info: ZeroconfServiceInfo) -> None:
"""Initialize the plcnet API."""
super().__init__()
self._ip = ip
self._mac = info.properties["PlcMacAddress"]
self._path = info.properties["Path"]
self._port = info.port
self._session = session
self._user = "devolo"
self._version = info.properties["Version"]
self.password = ""
async def async_get_network_overview(self) -> GetNetworkOverview.LogicalNetwork:
"""
Get a PLC network overview.
:return: Network overview
"""
self._logger.debug("Getting network overview.")
network_overview = GetNetworkOverview()
response = await self._async_get("GetNetworkOverview")
network_overview.ParseFromString(await response.aread())
return network_overview.network
async def async_identify_device_start(self) -> bool:
"""
Make PLC LED of a device blink to identify it.
:return: True, if identifying was successfully started, otherwise False
"""
self._logger.debug("Starting LED blinking.")
identify_device = IdentifyDeviceStart()
identify_device.mac_address = self._mac
query = await self._async_post("IdentifyDeviceStart", content=identify_device.SerializeToString())
response = IdentifyDeviceResponse()
response.ParseFromString(await query.aread())
return response.result == response.SUCCESS
async def async_identify_device_stop(self) -> bool:
"""
Stop the PLC LED blinking.
:return: True, if identifying was successfully stopped, otherwise False
"""
self._logger.debug("Stopping LED blinking.")
identify_device = IdentifyDeviceStop()
identify_device.mac_address = self._mac
query = await self._async_post("IdentifyDeviceStop", content=identify_device.SerializeToString())
response = IdentifyDeviceResponse()
response.ParseFromString(await query.aread())
return response.result == response.SUCCESS
async def async_pair_device(self) -> bool:
"""
Start pairing mode.
:return: True, if pairing was started successfully, otherwise False
"""
self._logger.debug("Pairing.")
pair_device = PairDeviceStart()
pair_device.mac_address = self._mac
query = await self._async_post("PairDeviceStart", content=pair_device.SerializeToString())
response = PairDeviceResponse()
response.ParseFromString(await query.aread())
return response.result == response.SUCCESS
async def async_set_user_device_name(self, name: str) -> bool:
"""
Set device name.
:param name: Name, the device shall have
:return: True, if the device was successfully renamed, otherwise False
"""
self._logger.debug("Setting device name.")
set_user_name = SetUserDeviceName()
set_user_name.mac_address = self._mac
set_user_name.user_device_name = name
query = await self._async_post("SetUserDeviceName", content=set_user_name.SerializeToString())
response = SetUserDeviceNameResponse()
response.ParseFromString(await query.aread())
return response.result == response.SUCCESS
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/plcnetapi.pyi 0000664 0000000 0000000 00000002060 14777250235 0024306 0 ustar 00root root 0000000 0000000 """
@generated by stubgen. Do not edit manually!
isort:skip_file
"""
from __future__ import annotations
from .getnetworkoverview_pb2 import GetNetworkOverview
from devolo_plc_api.clients import Protobuf
from devolo_plc_api.zeroconf import ZeroconfServiceInfo as ZeroconfServiceInfo
from httpx import AsyncClient as AsyncClient
class PlcNetApi(Protobuf):
password: str
def __init__(self, ip: str, session: AsyncClient, info: ZeroconfServiceInfo) -> None: ...
async def async_get_network_overview(self) -> GetNetworkOverview.LogicalNetwork: ...
async def async_identify_device_start(self) -> bool: ...
async def async_identify_device_stop(self) -> bool: ...
async def async_pair_device(self) -> bool: ...
async def async_set_user_device_name(self, name: str) -> bool: ...
def get_network_overview(self) -> GetNetworkOverview.LogicalNetwork: ...
def identify_device_start(self) -> bool: ...
def identify_device_stop(self) -> bool: ...
def pair_device(self) -> bool: ...
def set_user_device_name(self, name: str) -> bool: ...
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/setuserdevicename_pb2.py 0000664 0000000 0000000 00000004753 14777250235 0026447 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: setuserdevicename.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17setuserdevicename.proto\x12\nplcnet.api\"B\n\x11SetUserDeviceName\x12\x13\n\x0bmac_address\x18\x01 \x01(\t\x12\x18\n\x10user_device_name\x18\x02 \x01(\t\"\xe2\x01\n\x19SetUserDeviceNameResponse\x12<\n\x06result\x18\x01 \x01(\x0e\x32,.plcnet.api.SetUserDeviceNameResponse.Result\"\x86\x01\n\x06Result\x12\x0b\n\x07SUCCESS\x10\x00\x12\x13\n\x0fMACADDR_INVALID\x10\x01\x12\x13\n\x0fMACADDR_UNKNOWN\x10\x02\x12\x17\n\x13\x44\x45VICE_NAME_INVALID\x10\x03\x12\x18\n\x13\x43OMMUNICATION_ERROR\x10\xfe\x01\x12\x12\n\rUNKNOWN_ERROR\x10\xff\x01\x42\x0e\n\x06plcnetB\x04nameb\x06proto3')
_SETUSERDEVICENAME = DESCRIPTOR.message_types_by_name['SetUserDeviceName']
_SETUSERDEVICENAMERESPONSE = DESCRIPTOR.message_types_by_name['SetUserDeviceNameResponse']
_SETUSERDEVICENAMERESPONSE_RESULT = _SETUSERDEVICENAMERESPONSE.enum_types_by_name['Result']
SetUserDeviceName = _reflection.GeneratedProtocolMessageType('SetUserDeviceName', (_message.Message,), {
'DESCRIPTOR' : _SETUSERDEVICENAME,
'__module__' : 'setuserdevicename_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.SetUserDeviceName)
})
_sym_db.RegisterMessage(SetUserDeviceName)
SetUserDeviceNameResponse = _reflection.GeneratedProtocolMessageType('SetUserDeviceNameResponse', (_message.Message,), {
'DESCRIPTOR' : _SETUSERDEVICENAMERESPONSE,
'__module__' : 'setuserdevicename_pb2'
# @@protoc_insertion_point(class_scope:plcnet.api.SetUserDeviceNameResponse)
})
_sym_db.RegisterMessage(SetUserDeviceNameResponse)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\006plcnetB\004name'
_SETUSERDEVICENAME._serialized_start=39
_SETUSERDEVICENAME._serialized_end=105
_SETUSERDEVICENAMERESPONSE._serialized_start=108
_SETUSERDEVICENAMERESPONSE._serialized_end=334
_SETUSERDEVICENAMERESPONSE_RESULT._serialized_start=200
_SETUSERDEVICENAMERESPONSE_RESULT._serialized_end=334
# @@protoc_insertion_point(module_scope)
devolo_plc_api-1.5.1/devolo_plc_api/plcnet_api/setuserdevicename_pb2.pyi 0000664 0000000 0000000 00000005450 14777250235 0026613 0 ustar 00root root 0000000 0000000 """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class SetUserDeviceName(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MAC_ADDRESS_FIELD_NUMBER: builtins.int
USER_DEVICE_NAME_FIELD_NUMBER: builtins.int
mac_address: typing.Text
"""MAC address of the targeted device"""
user_device_name: typing.Text
"""user provided device name, if any"""
def __init__(self,
*,
mac_address: typing.Text = ...,
user_device_name: typing.Text = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["mac_address",b"mac_address","user_device_name",b"user_device_name"]) -> None: ...
global___SetUserDeviceName = SetUserDeviceName
class SetUserDeviceNameResponse(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
class _Result:
ValueType = typing.NewType('ValueType', builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _ResultEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[SetUserDeviceNameResponse._Result.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
SUCCESS: SetUserDeviceNameResponse._Result.ValueType # 0
MACADDR_INVALID: SetUserDeviceNameResponse._Result.ValueType # 1
MACADDR_UNKNOWN: SetUserDeviceNameResponse._Result.ValueType # 2
DEVICE_NAME_INVALID: SetUserDeviceNameResponse._Result.ValueType # 3
COMMUNICATION_ERROR: SetUserDeviceNameResponse._Result.ValueType # 254
UNKNOWN_ERROR: SetUserDeviceNameResponse._Result.ValueType # 255
class Result(_Result, metaclass=_ResultEnumTypeWrapper):
pass
SUCCESS: SetUserDeviceNameResponse.Result.ValueType # 0
MACADDR_INVALID: SetUserDeviceNameResponse.Result.ValueType # 1
MACADDR_UNKNOWN: SetUserDeviceNameResponse.Result.ValueType # 2
DEVICE_NAME_INVALID: SetUserDeviceNameResponse.Result.ValueType # 3
COMMUNICATION_ERROR: SetUserDeviceNameResponse.Result.ValueType # 254
UNKNOWN_ERROR: SetUserDeviceNameResponse.Result.ValueType # 255
RESULT_FIELD_NUMBER: builtins.int
result: global___SetUserDeviceNameResponse.Result.ValueType
"""contains the result of SetUserDeviceName message"""
def __init__(self,
*,
result: global___SetUserDeviceNameResponse.Result.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["result",b"result"]) -> None: ...
global___SetUserDeviceNameResponse = SetUserDeviceNameResponse
devolo_plc_api-1.5.1/devolo_plc_api/py.typed 0000664 0000000 0000000 00000000000 14777250235 0021155 0 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/devolo_plc_api/zeroconf/ 0000775 0000000 0000000 00000000000 14777250235 0021315 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/devolo_plc_api/zeroconf/__init__.py 0000664 0000000 0000000 00000000736 14777250235 0023434 0 ustar 00root root 0000000 0000000 """Zeroconf dataclasses."""
from __future__ import annotations
from dataclasses import dataclass, field
@dataclass
class ZeroconfServiceInfo:
"""Prepared info from mDNS entries."""
address: bytes = b""
"""IP address of the device."""
port: int | None = None
"""mDNS port to use."""
hostname: str = ""
"""mDNS hostname of the device."""
properties: dict[str, str] = field(default_factory=dict)
"""Properties provided by the device."""
devolo_plc_api-1.5.1/docs/ 0000775 0000000 0000000 00000000000 14777250235 0015441 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/docs/CHANGELOG.md 0000664 0000000 0000000 00000012056 14777250235 0017256 0 ustar 00root root 0000000 0000000 # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.5.1] - 2025/04/14
### Changed
- Allow older versions of tenacity for compatibility reasons
## [v1.5.0] - 2025/04/13
### Added
- Retry mechanism for timed-out connections
- Use SPDX license identifier for project metadata
### Changed
- Drop support for Python 3.8
## [v1.4.1] - 2023/09/14
### Fixed
- Increase timeout of async_check_firmware_available to handle unknown errors gracefully
## [v1.4.0] - 2023/07/26
### Added
- Generate QR codes from wifi guest settings
- Make use of zeroconf unicast requests to be able to respond across subnets
## [v1.3.2] - 2023/07/13
### Fixed
- Frequently connecting to an offline device lead to a memory leak
## [v1.3.1] - 2023/05/12
### Fixed
- Reduce zeroconf traffic
## [v1.3.0] - 2023/04/13
### Added
- Get MultiAP information from the device
### Fixed
- The event loop got closed to early when disconnecting from a device synchronously.
## [v1.2.0] - 2023/02/17
### Added
- Support for devices with password protected PLCNET API
## [v1.1.0] - 2023/01/24
### Added
- Get support information from the device
## [v1.0.0] - 2023/01/05
### Changed
- **BREAKING**: The results are now dataclass-like objects. Please have a look at our [examples](https://github.com/2Fake/devolo_plc_api/blob/dee4617da680685a35ac48051d1aecd0456b7764/example_async.py) to see, how migration works.
## [v0.9.0] - 2022/12/20
### Added
- Handle updates sent via mDNS
## [v0.8.1] - 2022/10/18
### Fixed
- Use correct device password if password was set before connecting to it
## [v0.8.0] - 2022/05/06
### Added
#### Device API
- Specify a duration for the guest wifi
- Start WPS clone mode
- Factory reset device
#### PLCNET API
- Start pairing mode
## [v0.7.1] - 2022/01/10
### Fixed
- Get LED status from devices
## [v0.7.0] - 2021/11/30
### Added
#### Device API
- Restart device
- Query uptime as strict monotonically increasing number
### Fixed
- Connecting to multiple devices at the same time works again
- Zeroconf Browsers terminate correctly in case a device does not answer
- Accessing password protected LAN devices works again
## [v0.6.4] - 2021/11/24
### Fixed
- Running tasks get cleanly canceled on disconnect
## [v0.6.3] - 2021/11/18
### Fixed
- Disconnecting from a device synchronously works again
## [v0.6.2] - 2021/10/28
### Fixed
- Request service info also as multicast response for better support of Magic LAN devices
### Changed
- The request timeouts were increased
## [v0.6.1] - 2021/10/20
### Fixed
- Package structure
## [v0.6.0] - 2021/10/20
### Changed
- **BREAKING**: Drop support for Python 3.7
- Use AsyncZeroconf instead of Zeroconf
### Fixed
- Use Zeroconf questions requesting multicast responses for better support of Magic LAN devices
## [v0.5.4] - 2021/10/18
### Fixed
- Fix pip installation
## [v0.5.3] - 2021/10/18
### Changed
- Rework typing
- Mark package as typed
- Add Python 3.10 to CI
## [v0.5.2] - 2021/09/01
### Changed
- Use newer dependency versions
## [v0.5.1] - 2021/01/19
### Fixed
- React correctly on different connection errors
## [v0.5.0] - 2020/12/21
### Changed
- Increase read timeout to better handle busy devices
- If a device is unavailable (e.g. in standby), DeviceUnavailable is raised
- Loggers now contain the module name
### Fixed
- Sometime a warning popped up to properly close the connection to the device although it was properly closed
## [v0.4.0] - 2020/12/08
### Added
- mDNS hostname is now stored in the device object
- Add possibility to pass in an httpx AsyncClient instance
- Ignore devolo Home Control Central Units in discovery function as they offer a device API record but no real device API
### Changed
- **BREAKING**: The discovery function does no longer connect to the device automatically
### Fixed
- Under unfavorable conditions incorrect PLCNET API data was collected
## [v0.3.0] - 2020/12/02
### Added
- If API data is discovered externally, it can be reused
- The devices can be accessed without context manager
- If the network topology is unknown, it can be discovered now
### Changed
- **BREAKING**: The device password must be specified by setting an attribute now
## [v0.2.0] - 2020/09/14
### Added
#### Device API
- Check for firmware updates
- Start firmware updates
- Start WPS
### Fixed
- Port from mDNS query is now used
- Get network overview now also works synchronously
- Sopping identify device now also works synchronously
- Set user device name now also works synchronously
## [v0.1.0] - 2020/08/28
### Added
#### Device API
- Get LED settings
- Set LED settings
- Get connected wifi clients
- Get details about wifi guest access
- Enable or disable guest wifi
- Get visible wifi access points
- Get details about master wifi (repeater only)
#### PLCNET API
- Get details about your powerline network
- Start and stop identifying your PLC device
- Rename your device
devolo_plc_api-1.5.1/docs/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000006454 14777250235 0020251 0 ustar 00root root 0000000 0000000 # Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at guido.schmitz@fedaix.de or m.bong@famabo.de. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
devolo_plc_api-1.5.1/docs/CONTRIBUTING.md 0000664 0000000 0000000 00000005511 14777250235 0017674 0 ustar 00root root 0000000 0000000 # Contributing
Thank you very much for considering to contribute to our project. The devolo PLC devices deliver interesting data that we wanted to be usable in other projects. To achieve that goal, help is welcome.
The following guidelines will help you to understand how you can help. They will also make transparent to you the time we need to manage and develop this open source project. In return, we will reciprocate that respect in addressing your issues, assessing changes, and helping you finalize your pull requests.
## Table of contents
1. [Reporting an issue](#reporting-an-issue)
1. [Requesting a feature](#requesting-a-feature)
1. [Code style guide](#code-style-guide)
## Reporting an issue
If you are having issues with our module, especially, if you found a bug, we want to know. Please [create an issue](https://github.com/2Fake/devolo_plc_api/issues). However, you should keep in mind that it might take some time for us to respond to your issue. We will try to get in contact with you within two weeks. Please also respond within two weeks, if we have further inquiries.
## Requesting a feature
While we develop this module, we have our own use cases in mind. Those use cases do not necessarily meet your use cases. Nevertheless we want to hear about them, so you can either [create an issue](https://github.com/2Fake/devolo_plc_api/issues) or create a merge request. By choosing the first option, you tell us to take care about your use case. That will take time as we will prioritize it with our own needs. By choosing the second option, you can speed up this process. Please read our code style guide.
## Code style guide
We basically follow [PEP8](https://www.python.org/dev/peps/pep-0008/), but deviate in some points for - as we think - good reasons. If you have good reasons to stick strictly to PEP8 or even have good reasons to deviate from our deviation, feel free to convince us.
We limit out lines to 127 characters, as that is maximum length still allowing code reviews on GitHub without horizontal scrolling.
As PEP8 allows to use extra blank lines sparingly to separate groups of related functions, we use an extra line between static methods and constructor, constructor and properties, properties and public methods, and public methods and internal methods.
We use double string quotes, except when the string contains double string quotes itself or when used as key of a dictionary.
If you find code where we violated our own rules, feel free to [tell us](https://github.com/2Fake/devolo_plc_api/issues).
## Testing
We cover our code with unit tests written in pytest, but we do not push them to hard. We want public methods covered, but we skip nested and trivial methods. Often we also skip constructors. If you want to contribute, please make sure to keep the unit tests green and to deliver new ones, if you extend the functionality.
devolo_plc_api-1.5.1/example_async.py 0000664 0000000 0000000 00000016207 14777250235 0017721 0 ustar 00root root 0000000 0000000 import asyncio
from devolo_plc_api import Device, wifi_qr_code
# IP of the device to query
IP = "192.168.0.10"
# Password, if the device has one. It is the same as the Web-UI has. It no password is set, you can remove the password
# parameter or set it to None.
PASSWORD = "super_secret"
async def run():
async with Device(ip=IP) as dpa:
# Set the password
dpa.password = PASSWORD
# Get LED settings of the device. The state might be LED_ON or LED_OFF.
print("LED is on" if await dpa.device.async_get_led_setting() else "LED if off")
# Set LED settings of the device. Set enable to True to them turn on, to False to turn them off.
# If the state was changed successfully, True is returned, otherwise False.
print("success" if await dpa.device.async_set_led_setting(enable=True) else "failed")
# Get MultiAP details. If the device is not aware of a mesh controller or doesn't know its IP, it is left empty.
multi_ap = await dpa.device.async_get_wifi_multi_ap()
print(multi_ap.enabled) # True
print(multi_ap.controller_id) # "AA:BB:CC:DD:EE:FF"
print(multi_ap.controller_ip) # "192.0.2.1"
# Factory reset the device. If the reset will happen shortly, True is returned, otherwise False.
print("success" if await dpa.device.async_factory_reset() else "failed")
# Restart the device. If the restart will happen shortly, True is returned, otherwise False.
print("success" if await dpa.device.async_restart() else "failed")
# Get uptime of the device. This value can only be used as a strict monotonically increasing number and therefore has no unit.
print(await dpa.device.async_uptime())
# Get support information from the device.
print(await dpa.device.async_get_support_info())
# Check for new firmware versions
firmware = await dpa.device.async_check_firmware_available()
print(firmware.result) # devolo_plc_api.device_api.UPDATE_NOT_AVAILABLE
print(firmware.new_firmware_version) # ""
# Start firmware update, if new version is available. Important: The response does not tell you anything about the
# success of the update itself.
print("update started" if await dpa.device.async_start_firmware_update() else "no update available")
# Get details of wifi stations connected to the device: MAC address, access point type (main or guest), wifi band and
# connection rates.
connected_stations = await dpa.device.async_get_wifi_connected_station()
print(connected_stations[0].mac_address) # "AA:BB:CC:DD:EE:FF"
print(connected_stations[0].vap_type) # devolo_plc_api.device_api.WIFI_VAP_MAIN_AP
print(connected_stations[0].band) # devolo_plc_api.device_api.WIFI_BAND_5G
print(connected_stations[0].rx_rate) # 87800
print(connected_stations[0].tx_rate) # 87800
# Get details about wifi guest access: SSID, Wifi key, state (enabled/disabled) and if time limited, the remaining
# duration.
guest_wifi = await dpa.device.async_get_wifi_guest_access()
print(guest_wifi.ssid) # "devolo-guest-930"
print(guest_wifi.key) # "HMANPGBA"
print(guest_wifi.enabled) # False
print(guest_wifi.remaining_duration) # 0
# Get a QR code of the guest wifi settings as byte stream in SVG format
qr = wifi_qr_code(guest_wifi)
with open("qr.svg", "wb") as binary_file:
binary_file.write(qr)
# Enable or disable the wifi guest access. Set enable to True to it turn on, to False to turn it off. Optionally
# specify a duration in minutes. Changing SSID or the wifi key is currently not supported. If the state was changed
# successfully, True is returned, otherwise False.
print("success" if await dpa.device.async_set_wifi_guest_access(enable=True, duration=5) else "failed")
# Get details about other access points in your neighborhood: MAC address, SSID, wifi band, used channel, signal
# strength in DB and a value from 1 to 5, if you would want to map the signal strength to a signal bars.
neighbor_aps = await dpa.device.async_get_wifi_neighbor_access_points()
print(neighbor_aps[0].mac_address) # "AA:BB:CC:DD:EE:FF"
print(neighbor_aps[0].ssid) # "wifi"
print(neighbor_aps[0].band) # devolo_plc_api.device_api.WIFI_BAND_2G
print(neighbor_aps[0].channel) # 1
print(neighbor_aps[0].signal) # -73
print(neighbor_aps[0].signal_bars) # 1
# Start WPS push button configuration. If WPS was started successfully, True is returned, otherwise False.
print("WPS started" if await dpa.device.async_start_wps() else "WPS start failed")
# Start WPS clone mode. If clone mode was started successfully, True is returned, otherwise False.
print("WPS clone mode started" if await dpa.device.async_start_wps_clone() else "WPS clone mode start failed")
# Get PLC network overview with enriched information like firmware version.
network = await dpa.plcnet.async_get_network_overview()
print(network.devices[0].product_name) # "devolo Magic 2 WiFi next"
print(network.devices[0].product_id) # "MT3056"
print(network.devices[0].friendly_version) # "7.12.5.124"
print(network.devices[0].full_version) # "magic-2-wifi-next 7.12.5.124_2022-08-29"
print(network.devices[0].user_device_name) # "Living Room"
print(network.devices[0].mac_address) # "AABBCCDDEEFF"
print(network.devices[0].topology) # devolo_plc_api.plcnet_api.LOCAL
print(network.devices[0].technology) # devolo_plc_api.plcnet_api.GHN_SPIRIT
print(network.devices[0].bridged_devices) # []
print(network.devices[0].attached_to_router) # True
print(network.devices[0].user_network_name) # ""
print(network.devices[0].ipv4_address) # ""
print(network.data_rates[0].mac_address_from) # "AABBCCDDEEFF"
print(network.data_rates[0].mac_address_to) # "AABBCCDDEEFF"
print(network.data_rates[0].tx_rate) # 129.9375
print(network.data_rates[0].rx_rate) # 124.6875
# Identify the device by making the PLC LED blink. This call returns directly with True, if identifying was started
# successfully, otherwise False. However, the LED stays blinking for two minutes.
print("success" if await dpa.plcnet.async_identify_device_start() else "failed")
# Stop identify the device if you don't want to wait for the timeout.
print("success" if await dpa.plcnet.async_identify_device_stop() else "failed")
# Start pairing the device. This call returns directly with True, if pairing was started successfully, otherwise
# False. However, the device stays in pairing mode for up to three minutes.
print("success" if await dpa.plcnet.async_pair_device() else "failed")
# Set the user device name. If the name was changed successfully, True is returned, otherwise False.
print("success" if await dpa.plcnet.async_set_user_device_name(name="New name") else "failed")
if __name__ == "__main__":
asyncio.run(run())
devolo_plc_api-1.5.1/example_sync.py 0000664 0000000 0000000 00000015556 14777250235 0017566 0 ustar 00root root 0000000 0000000 from devolo_plc_api import Device, wifi_qr_code
# IP of the device to query
IP = "192.168.0.10"
# Password, if the device has one. It is the same as the Web-UI has. It no password is set, you can remove the password
# parameter or set it to None.
PASSWORD = "super_secret"
def run():
with Device(ip=IP) as dpa:
# Set the password
dpa.password = PASSWORD
# Get LED settings of the device. The state might be LED_ON or LED_OFF.
print("LED is on" if dpa.device.get_led_setting() else "LED if off")
# Set LED settings of the device. Set enable to True to them turn on, to False to turn them off.
# If the state was changed successfully, True is returned, otherwise False.
print("success" if dpa.device.set_led_setting(enable=True) else "failed")
# Get MultiAP details. If the device is not aware of a mesh controller or doesn't know its IP, it is left empty.
multi_ap = dpa.device.get_wifi_multi_ap()
print(multi_ap.enabled) # True
print(multi_ap.controller_id) # "AA:BB:CC:DD:EE:FF"
print(multi_ap.controller_ip) # "192.0.2.1"
# Factory reset the device. If the reset will happen shortly, True is returned, otherwise False.
print("success" if dpa.device.factory_reset() else "failed")
# Restart the device. If the restart will happen shortly, True is returned, otherwise False.
print("success" if dpa.device.restart() else "failed")
# Get uptime of the device. This value can only be used as a strict monotonically increasing number and therefore has no unit.
print(dpa.device.uptime())
# Get support information from the device.
print(dpa.device.get_support_info())
# Check for new firmware versions
firmware = dpa.device.check_firmware_available()
print(firmware.result) # devolo_plc_api.device_api.UPDATE_NOT_AVAILABLE
print(firmware.new_firmware_version) # ""
# Start firmware update, if new version is available. Important: The response does not tell you anything about the
# success of the update itself.
print("update started" if dpa.device.start_firmware_update() else "no update available")
# Get details of wifi stations connected to the device: MAC address, access point type (main or guest), wifi band and
# connection rates.
connected_stations = dpa.device.get_wifi_connected_station()
print(connected_stations[0].mac_address) # "AA:BB:CC:DD:EE:FF"
print(connected_stations[0].vap_type) # devolo_plc_api.device_api.WIFI_VAP_MAIN_AP
print(connected_stations[0].band) # devolo_plc_api.device_api.WIFI_BAND_5G
print(connected_stations[0].rx_rate) # 87800
print(connected_stations[0].tx_rate) # 87800
# Get details about wifi guest access: SSID, Wifi key, state (enabled/disabled) and if time limited, the remaining
# duration.
guest_wifi = dpa.device.get_wifi_guest_access()
print(guest_wifi.ssid) # "devolo-guest-930"
print(guest_wifi.key) # "HMANPGBA"
print(guest_wifi.enabled) # False
print(guest_wifi.remaining_duration) # 0
# Get a QR code of the guest wifi settings as byte stream in SVG format
qr = wifi_qr_code(guest_wifi)
with open("qr.svg", "wb") as binary_file:
binary_file.write(qr)
# Enable or disable the wifi guest access. Set enable to True to it turn on, to False to turn it off. Optionally
# specify a duration in minutes. Changing SSID or the wifi key is currently not supported. If the state was changed
# successfully, True is returned, otherwise False.
print("success" if dpa.device.set_wifi_guest_access(enable=True, duration=5) else "failed")
# Get details about other access points in your neighborhood: MAC address, SSID, wifi band, used channel, signal
# strength in DB and a value from 1 to 5, if you would want to map the signal strength to a signal bars.
neighbor_aps = dpa.device.get_wifi_neighbor_access_points()
print(neighbor_aps[0].mac_address) # "AA:BB:CC:DD:EE:FF"
print(neighbor_aps[0].ssid) # "wifi"
print(neighbor_aps[0].band) # devolo_plc_api.device_api.WIFI_BAND_2G
print(neighbor_aps[0].channel) # 1
print(neighbor_aps[0].signal) # -73
print(neighbor_aps[0].signal_bars) # 1
# Start WPS push button configuration. If WPS was started successfully, True is returned, otherwise False.
print("WPS started" if dpa.device.start_wps() else "WPS start failed")
# Start WPS clone mode. If clone mode was started successfully, True is returned, otherwise False.
print("WPS clone mode started" if dpa.device.start_wps_clone() else "WPS clone mode start failed")
# Get PLC network overview with enriched information like firmware version.
network = dpa.plcnet.get_network_overview()
print(network.devices[0].product_name) # "devolo Magic 2 WiFi next"
print(network.devices[0].product_id) # "MT3056"
print(network.devices[0].friendly_version) # "7.12.5.124"
print(network.devices[0].full_version) # "magic-2-wifi-next 7.12.5.124_2022-08-29"
print(network.devices[0].user_device_name) # "Living Room"
print(network.devices[0].mac_address) # "AABBCCDDEEFF"
print(network.devices[0].topology) # devolo_plc_api.plcnet_api.LOCAL
print(network.devices[0].technology) # devolo_plc_api.plcnet_api.GHN_SPIRIT
print(network.devices[0].bridged_devices) # []
print(network.devices[0].attached_to_router) # True
print(network.devices[0].user_network_name) # ""
print(network.devices[0].ipv4_address) # ""
print(network.data_rates[0].mac_address_from) # "AABBCCDDEEFF"
print(network.data_rates[0].mac_address_to) # "AABBCCDDEEFF"
print(network.data_rates[0].tx_rate) # 129.9375
print(network.data_rates[0].rx_rate) # 124.6875
# Identify the device by making the PLC LED blink. This call returns directly with True, if identifying was started
# successfully, otherwise False. However, the LED stays blinking for two minutes.
print("success" if dpa.plcnet.identify_device_start() else "failed")
# Stop identify the device if you don't want to wait for the timeout.
print("success" if dpa.plcnet.identify_device_stop() else "failed")
# Start pairing the device. This call returns directly with True, if pairing was started successfully, otherwise
# False. However, the device stays in pairing mode for up to three minutes.
print("success" if dpa.plcnet.pair_device() else "failed")
# Set the user device name. If the name was changed successfully, True is returned, otherwise False.
print("success" if dpa.plcnet.set_user_device_name(name="New name") else "failed")
if __name__ == "__main__":
run()
devolo_plc_api-1.5.1/pyproject.toml 0000664 0000000 0000000 00000003573 14777250235 0017435 0 ustar 00root root 0000000 0000000 [build-system]
requires = ["setuptools>=77", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"
[project]
authors = [
{ name = "Markus Bong", email = "m.bong@famabo.de" },
{ name = "Guido Schmitz", email = "guido.schmitz@fedaix.de"}
]
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
description = "devolo PLC devices in Python"
dependencies = [
"ifaddr>=0.1.7",
"httpx>=0.21.0",
"protobuf>=4.22.0",
"segno>=1.5.2",
"tenacity>=8.3.0",
"zeroconf>=0.70.0",
]
dynamic = [
"version",
]
license = "GPL-3.0-or-later"
name = "devolo_plc_api"
readme = "README.md"
requires-python = ">= 3.9"
urls = {changelog = "https://github.com/2Fake/devolo_plc_api/docs/CHANGELOG.md", homepage = "https://github.com/2Fake/devolo_plc_api"}
[project.optional-dependencies]
dev = [
"pre-commit",
"mypy>=1.8.0"
]
test = [
"pytest",
"pytest-asyncio",
"pytest-cov",
"pytest-httpx>=0.18.0",
"typing-extensions",
"syrupy",
]
[tool.black]
line-length = 127
force-exclude = '.*_pb2\.py|.*\.pyi'
[tool.isort]
combine_as_imports = true
filter_files = true
forced_separate = ["tests"]
line_length = 127
profile = "black"
skip_glob = "*_pb2.py"
[tool.mypy]
ignore_missing_imports = true
[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
[tool.ruff]
exclude = ["*_pb2.py", "*.pyi"]
line-length = 127
target-version = "py39"
[tool.ruff.lint]
ignore = ["ANN401", "COM812", "D203", "D205", "D212", "FBT001", "N818"]
select = ["ALL"]
[tool.ruff.lint.isort]
combine-as-imports = true
forced-separate = ["tests"]
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["ANN201", "ARG", "PLR2004", "PT004", "PT012", "S", "SLF001"]
"scripts/*" = ["FBT002", "INP001"]
[tool.setuptools]
packages = { find = {exclude=["docs*", "script*", "tests*"]} }
[tool.setuptools_scm]
devolo_plc_api-1.5.1/scripts/ 0000775 0000000 0000000 00000000000 14777250235 0016200 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/scripts/stubgen.py 0000775 0000000 0000000 00000010537 14777250235 0020232 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3
"""Generate stub files for API classes with async and sync interface."""
from __future__ import annotations
import re
import sys
from contextlib import suppress
from copy import copy
from pathlib import Path
from mypy.nodes import ConditionalExpr, Expression, ListExpr
from mypy.stubgen import (
ASTStubGenerator,
Options,
StubSource,
collect_build_targets,
generate_asts_for_modules,
generate_guarded,
mypy_options,
)
HEADER = '''"""
@generated by stubgen. Do not edit manually!
isort:skip_file
"""
'''
class ApiStubGenerator(ASTStubGenerator):
"""Generate stub text from a mypy AST."""
def get_str_type_of_node(self, rvalue: Expression, can_infer_optional: bool = False, can_be_any: bool = True) -> str:
"""Get type of node as string."""
if isinstance(rvalue, ConditionalExpr):
if_type = self.get_str_type_of_node(rvalue.if_expr, can_infer_optional=can_infer_optional, can_be_any=False)
else_type = self.get_str_type_of_node(rvalue.else_expr, can_infer_optional=can_infer_optional, can_be_any=False)
if if_type and else_type and if_type != else_type:
return f"{if_type} | {else_type}"
return if_type or else_type or "Any" if can_be_any else ""
if isinstance(rvalue, ListExpr):
list_item_type = {
self.get_str_type_of_node(item, can_infer_optional=can_infer_optional, can_be_any=can_be_any)
for item in rvalue.items
}
return f"list[{' | '.join(list_item_type)}]"
return super().get_str_type_of_node(rvalue, can_infer_optional=can_infer_optional, can_be_any=can_be_any)
def add_sync(self) -> None:
"""Add sync methods."""
output = copy(self._output)
for i in range(len(output)):
if "async" in output[i]:
self.add(output[i].replace("async_", "").replace("async ", ""))
def fix_union_annotations(self) -> None:
"""Fix Union annotations."""
for i, output in enumerate(self._output):
if match := re.search(r"Union\[([a-z, ]+)\]", output):
types = match[1].replace(",", " |")
self._output[i] = output.replace(match[0], types)
def generate_stubs() -> None:
"""Generate stubs - main entry point for the program."""
options = Options(
pyversion=sys.version_info[:2],
no_import=True,
inspect=False,
doc_dir="",
search_path=[],
interpreter=sys.executable,
parse_only=False,
ignore_errors=False,
include_private=False,
output_dir="",
modules=[],
packages=[],
files=["devolo_plc_api/device_api/deviceapi.py", "devolo_plc_api/plcnet_api/plcnetapi.py"],
verbose=False,
quiet=True,
export_less=True,
include_docstrings=False,
)
mypy_opts = mypy_options(options)
py_modules, _, _ = collect_build_targets(options, mypy_opts)
generate_asts_for_modules(py_modules, options.parse_only, mypy_opts, options.verbose)
files = []
for mod in py_modules:
target = mod.module.replace(".", "/")
target += ".pyi"
target = str(Path(options.output_dir) / target)
files.append(target)
with generate_guarded(mod.module, target, options.ignore_errors, options.verbose):
generate_stub_from_ast(mod, target, options.parse_only, options.include_private, options.export_less)
def generate_stub_from_ast(mod: StubSource, target: str, parse_only: bool, include_private: bool, export_less: bool) -> None:
"""Use analyzed (or just parsed) AST to generate type stub for single file."""
gen = ApiStubGenerator(mod.runtime_all, include_private=include_private, analyzed=not parse_only, export_less=export_less)
if mod.ast is None:
return
mod.ast.accept(gen)
if "annotations" in mod.ast.future_import_flags:
gen.add_import_line("from __future__ import annotations\n")
gen.fix_union_annotations()
gen.add_sync()
old_output = ""
new_output = HEADER + "".join(gen.output())
with suppress(FileNotFoundError), Path(target).open() as file:
old_output = file.read()
if new_output != old_output:
with Path(target).open("w") as file:
file.write(new_output)
sys.exit(1)
if __name__ == "__main__":
generate_stubs()
devolo_plc_api-1.5.1/tests/ 0000775 0000000 0000000 00000000000 14777250235 0015653 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/tests/__init__.py 0000664 0000000 0000000 00000003354 14777250235 0017771 0 ustar 00root root 0000000 0000000 """Unittests for devolo_plc_api."""
from __future__ import annotations
import json
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import TYPE_CHECKING
from syrupy.extensions.amber import AmberSnapshotExtension
from devolo_plc_api.device_api import SERVICE_TYPE as DEVICE_API
from devolo_plc_api.plcnet_api import SERVICE_TYPE as PLCNET_API
from devolo_plc_api.zeroconf import ZeroconfServiceInfo
if TYPE_CHECKING:
from syrupy.location import PyTestLocation
class DeviceType(Enum):
"""Different device types."""
REPEATER = 1
PLC = 2
class DifferentDirectoryExtension(AmberSnapshotExtension):
"""Extention for Syrupy to change the directory in which snapshots are stored."""
@classmethod
def dirname(cls: type[DifferentDirectoryExtension], *, test_location: PyTestLocation) -> str:
"""Store snapshots in `snapshots`rather than `__snapshots__`."""
return str(Path(test_location.filepath).parent.joinpath("snapshots"))
@dataclass
class TestData:
"""Test data for a devolo device."""
__test__ = False
ip: str
"""IP address of a device."""
hostname: str
"""Hostname of a device."""
device_info: dict[str, ZeroconfServiceInfo]
"""Zeroconf info a device delivers."""
def load_test_data():
"""Load test data from file."""
file = Path(__file__).parent / "test_data.json"
with file.open("r") as handler:
data = json.load(handler)
device_info = {
DEVICE_API: ZeroconfServiceInfo(hostname=data["hostname"], **data["device_info"][DEVICE_API]),
PLCNET_API: ZeroconfServiceInfo(**data["device_info"][PLCNET_API]),
}
return TestData(ip=data["ip"], hostname=data["hostname"], device_info=device_info)
devolo_plc_api-1.5.1/tests/conftest.py 0000664 0000000 0000000 00000005223 14777250235 0020054 0 ustar 00root root 0000000 0000000 """Test configuration."""
from __future__ import annotations
from collections import OrderedDict
from functools import partial
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, Mock, patch
import pytest
import pytest_asyncio
from ifaddr import IP, Adapter
from devolo_plc_api import Device
from . import DeviceType, DifferentDirectoryExtension, TestData, load_test_data
from .mocks.zeroconf import MockAsyncServiceInfo, MockServiceBrowser
if TYPE_CHECKING:
from collections.abc import AsyncGenerator, Generator
from syrupy.assertion import SnapshotAssertion
pytest_plugins = [
"tests.fixtures.device_api",
"tests.fixtures.plcnet_api",
]
@pytest.fixture(scope="session")
def test_data() -> TestData:
"""Load test data."""
return load_test_data()
@pytest.fixture
def block_communication() -> Generator[None, None, None]:
"""Block external communication."""
adapter = OrderedDict()
adapter["eth0"] = Adapter(name="eth0", nice_name="eth0", ips=[IP("192.0.2.100", network_prefix=24, nice_name="eth0")])
with (
patch("devolo_plc_api.device.get_adapters", return_value=adapter.values()),
patch("devolo_plc_api.device.AsyncZeroconf", AsyncMock),
patch("devolo_plc_api.device.AsyncServiceInfo", MockAsyncServiceInfo),
):
yield
@pytest_asyncio.fixture
async def http_client() -> AsyncGenerator[None, None]:
"""Patch HTTP client."""
with patch("devolo_plc_api.device.AsyncClient", autospec=True):
yield
@pytest.fixture
def mock_device(test_data: TestData) -> Device:
"""Generate a device from test data."""
return Device(ip=test_data.ip)
@pytest.fixture
def mock_info_from_service() -> Generator[Mock, None, None]:
"""Patch reading info from mDNS entries."""
with patch("devolo_plc_api.device.Device.info_from_service") as ifs:
yield ifs
@pytest.fixture(name="sleep")
def patch_sleep() -> Generator[AsyncMock, None, None]:
"""Don't sleep anywhere except if marked as allowed."""
with patch("time.sleep"), patch("asyncio.sleep") as sleep:
yield sleep
@pytest.fixture
def service_browser(device_type: DeviceType) -> Generator[None, None, None]:
"""Patch mDNS service browser."""
service_browser = partial(MockServiceBrowser, device_type=device_type)
with (
patch("devolo_plc_api.device.AsyncServiceBrowser", service_browser),
patch("devolo_plc_api.network.ServiceBrowser", service_browser),
):
yield
@pytest.fixture
def snapshot(snapshot: SnapshotAssertion) -> SnapshotAssertion:
"""Return snapshot assertion fixture with nicer path."""
return snapshot.use_extension(DifferentDirectoryExtension)
devolo_plc_api-1.5.1/tests/fixtures/ 0000775 0000000 0000000 00000000000 14777250235 0017524 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/tests/fixtures/__init__.py 0000664 0000000 0000000 00000000044 14777250235 0021633 0 ustar 00root root 0000000 0000000 """Fixtures used during testing."""
devolo_plc_api-1.5.1/tests/fixtures/device_api.py 0000664 0000000 0000000 00000004121 14777250235 0022164 0 ustar 00root root 0000000 0000000 """Fixtures for device API tests."""
from __future__ import annotations
from secrets import randbelow
from typing import TYPE_CHECKING
import pytest
import pytest_asyncio
from httpx import AsyncClient
from devolo_plc_api.device_api import (
SERVICE_TYPE,
ConnectedStationInfo,
DeviceApi,
NeighborAPInfo,
RepeatedAPInfo,
SupportInfoItem,
UpdateFirmwareCheck,
)
if TYPE_CHECKING:
from collections.abc import AsyncGenerator
from tests import TestData
@pytest_asyncio.fixture
async def device_api(test_data: TestData, feature: str) -> AsyncGenerator[DeviceApi, None]:
"""Yield a prepared DeviceApi object."""
test_data.device_info[SERVICE_TYPE].properties["Features"] = feature
async with AsyncClient() as client:
yield DeviceApi(test_data.ip, client, test_data.device_info[SERVICE_TYPE])
@pytest.fixture(scope="session")
def connected_station() -> ConnectedStationInfo:
"""Generate a mocked answer of a connected wifi station."""
station = ConnectedStationInfo()
station.mac_address = "aa:bb:cc:dd:ee:ff"
return station
@pytest.fixture(scope="session")
def firmware_update() -> UpdateFirmwareCheck:
"""Generate a mocked firmware update message."""
update = UpdateFirmwareCheck()
update.result = UpdateFirmwareCheck.UPDATE_NOT_AVAILABLE
update.new_firmware_version = ""
return update
@pytest.fixture(scope="session")
def neighbor_ap() -> NeighborAPInfo:
"""Generate a mocked answer of a neighbor access point."""
ap = NeighborAPInfo()
ap.mac_address = "aa:bb:cc:dd:ee:ff"
return ap
@pytest.fixture(scope="session")
def repeated_ap() -> RepeatedAPInfo:
"""Generate a mocked answer of a repeated access point."""
ap = RepeatedAPInfo()
ap.mac_address = "aa:bb:cc:dd:ee:ff"
return ap
@pytest.fixture(scope="session")
def runtime() -> int:
"""Generate a mocked runtime of a device."""
return randbelow(65536)
@pytest.fixture(scope="session")
def support_item() -> SupportInfoItem:
"""Generate mocked support information."""
return SupportInfoItem(label="test", content=b"test")
devolo_plc_api-1.5.1/tests/fixtures/plcnet_api.py 0000664 0000000 0000000 00000001227 14777250235 0022216 0 ustar 00root root 0000000 0000000 """Fixtures for plcnet API tests."""
from collections.abc import AsyncGenerator
import pytest
import pytest_asyncio
from httpx import AsyncClient
from devolo_plc_api.plcnet_api import SERVICE_TYPE, LogicalNetwork, PlcNetApi
from tests import TestData
@pytest_asyncio.fixture()
async def plcnet_api(test_data: TestData) -> AsyncGenerator[PlcNetApi, None]:
"""Yield a prepared PlcNetApi object."""
async with AsyncClient() as client:
yield PlcNetApi(test_data.ip, client, test_data.device_info[SERVICE_TYPE])
@pytest.fixture
def network() -> LogicalNetwork:
"""Mock a PLC network."""
return LogicalNetwork(devices=[], data_rates=[])
devolo_plc_api-1.5.1/tests/mocks/ 0000775 0000000 0000000 00000000000 14777250235 0016767 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/tests/mocks/__init__.py 0000664 0000000 0000000 00000000041 14777250235 0021073 0 ustar 00root root 0000000 0000000 """Mocks used during testing."""
devolo_plc_api-1.5.1/tests/mocks/zeroconf.py 0000664 0000000 0000000 00000003067 14777250235 0021174 0 ustar 00root root 0000000 0000000 """Mock methods from the Zeroconf module."""
from __future__ import annotations
import socket
from typing import Any, Callable
from unittest.mock import AsyncMock, Mock
from zeroconf import ServiceStateChange, Zeroconf
from zeroconf.asyncio import AsyncServiceInfo
from devolo_plc_api.plcnet_api import SERVICE_TYPE
from tests import DeviceType, load_test_data
class MockServiceBrowser:
"""Mock of the ServiceBrowser."""
_async_start = AsyncMock()
_async_cancel = AsyncMock()
async_cancel = AsyncMock()
cancel = Mock()
def __init__(self, zeroconf: Zeroconf, type_: list[str] | str, handlers: list[Callable], **kwargs: Any) -> None:
"""Initialize the service browser."""
if isinstance(type_, str):
type_ = [type_]
elif kwargs.get("device_type") == DeviceType.REPEATER:
type_.remove(SERVICE_TYPE)
for service_type in type_:
handlers[0](zeroconf, service_type, service_type, ServiceStateChange.Added)
class MockAsyncServiceInfo(AsyncServiceInfo):
"""AsyncServiceInfo object with pre-filled information."""
async_request = AsyncMock()
def __init__(self, service_type: str, name: str) -> None:
"""Initialize the service info."""
test_data = load_test_data()
super().__init__(
service_type,
name,
port=test_data.device_info[service_type].port,
properties=test_data.device_info[service_type].properties,
server=test_data.hostname,
addresses=[socket.inet_aton(test_data.ip)],
)
devolo_plc_api-1.5.1/tests/snapshots/ 0000775 0000000 0000000 00000000000 14777250235 0017675 5 ustar 00root root 0000000 0000000 devolo_plc_api-1.5.1/tests/snapshots/test_device.ambr 0000664 0000000 0000000 00000003477 14777250235 0023051 0 ustar 00root root 0000000 0000000 # serializer version: 1
# name: TestDevice.test_async_connect_plc[DeviceType.PLC]
Device(
MDNS_TIMEOUT=300,
device=DeviceApi(
features=list([
'wifi1',
]),
password='',
url='http://192.0.2.1:80/1234567890abcdef/v0/',
),
firmware_date=datetime.date(2020, 6, 29),
firmware_version='5.5.1',
hostname='device.local',
ip='192.0.2.1',
mac='AABBCCDDEEFF',
mt_number='3046',
password='',
plcnet=PlcNetApi(
password='',
url='http://192.0.2.1:80/1234567890abcdef/v0/',
),
product='dLAN pro 1200+ WiFi ac',
serial_number='1234567890123456',
technology='hpav',
)
# ---
# name: TestDevice.test_async_connect_plc[DeviceType.PLC].1
Device(
MDNS_TIMEOUT=300,
device=DeviceApi(
features=list([
'wifi1',
]),
password='',
url='http://192.0.2.1:80/1234567890abcdef/v0/',
),
firmware_date=datetime.date(2020, 6, 29),
firmware_version='5.5.1',
hostname='device.local',
ip='192.0.2.1',
mac='AABBCCDDEEFF',
mt_number='3046',
password='',
plcnet=PlcNetApi(
password='',
url='http://192.0.2.1:80/1234567890abcdef/v0/',
),
product='dLAN pro 1200+ WiFi ac',
serial_number='1234567890123456',
technology='hpav',
)
# ---
# name: TestDevice.test_async_connect_repeater[DeviceType.REPEATER]
Device(
MDNS_TIMEOUT=300,
device=DeviceApi(
features=list([
'wifi1',
]),
password='',
url='http://192.0.2.1:80/1234567890abcdef/v0/',
),
firmware_date=datetime.date(2020, 6, 29),
firmware_version='5.5.1',
hostname='device.local',
ip='192.0.2.1',
mac='',
mt_number='3046',
password='',
plcnet=None,
product='dLAN pro 1200+ WiFi ac',
serial_number='1234567890123456',
technology='',
)
# ---
devolo_plc_api-1.5.1/tests/snapshots/test_helpers.ambr 0000664 0000000 0000000 00000003160 14777250235 0023241 0 ustar 00root root 0000000 0000000 # serializer version: 1
# name: TestHelpers.test_wifi_qr_code
b'\n\n'
# ---
devolo_plc_api-1.5.1/tests/test_data.json 0000664 0000000 0000000 00000001565 14777250235 0020525 0 ustar 00root root 0000000 0000000 {
"device_info": {
"_dvl-deviceapi._tcp.local.": {
"address": "192.0.2.1",
"port": 80,
"properties": {
"FirmwareDate": "2020-06-29",
"FirmwareVersion": "5.5.1",
"SN": "1234567890123456",
"MT": "3046",
"Product": "dLAN pro 1200+ WiFi ac",
"Path": "1234567890abcdef",
"Version": "v0",
"Features": "wifi1"
}
},
"_dvl-plcnetapi._tcp.local.": {
"address": "192.0.2.1",
"port": 80,
"properties": {
"Path": "1234567890abcdef",
"PlcMacAddress": "AABBCCDDEEFF",
"PlcTechnology": "hpav",
"Version": "v0"
}
}
},
"hostname": "device.local",
"ip": "192.0.2.1"
}
devolo_plc_api-1.5.1/tests/test_device.py 0000664 0000000 0000000 00000015360 14777250235 0020530 0 ustar 00root root 0000000 0000000 """Test communicating with a devolo device."""
from asyncio import AbstractEventLoop
from unittest.mock import AsyncMock, Mock, patch
import pytest
from syrupy.assertion import SnapshotAssertion
from zeroconf import ServiceStateChange
from devolo_plc_api.device import Device
from devolo_plc_api.exceptions import DeviceNotFound
from devolo_plc_api.plcnet_api import SERVICE_TYPE as PLCNETAPI
from . import DeviceType, TestData
from .mocks.zeroconf import MockAsyncServiceInfo
@pytest.mark.usefixtures("block_communication")
class TestDevice:
"""Test devolo_plc_api.device.Device class."""
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("service_browser")
async def test_async_connect_plc(self, mock_device: Device, snapshot: SnapshotAssertion):
"""Test that connecting to a device collects information from the APIs."""
await mock_device.async_connect()
assert mock_device._connected
assert mock_device.device
assert mock_device.plcnet
assert mock_device == snapshot
await mock_device.async_disconnect()
await mock_device.async_connect(session_instance=AsyncMock())
assert mock_device._connected
assert mock_device.device
assert mock_device.plcnet
assert mock_device == snapshot
await mock_device.async_disconnect()
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.REPEATER])
@pytest.mark.usefixtures("service_browser")
async def test_async_connect_repeater(self, mock_device: Device, snapshot: SnapshotAssertion):
"""Test that connecting to a device collects information from the APIs."""
await mock_device.async_connect()
assert mock_device._connected
assert mock_device.device
assert not mock_device.plcnet
assert mock_device == snapshot
await mock_device.async_disconnect()
@pytest.mark.asyncio
async def test_sync_connect_multicast(self, test_data: TestData):
"""Test that devices having trouble with unicast zeroconf are queried twice."""
with patch("devolo_plc_api.device.Device._get_zeroconf_info") as get_zeroconf_info, pytest.raises(DeviceNotFound):
device = Device(test_data.ip)
await device.async_connect()
assert device._multicast
assert get_zeroconf_info.call_count == 2
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("service_browser")
async def test_async_connect_not_found(self, mock_device: Device, sleep: AsyncMock):
"""Test that an exception is raised if both APIs are not available."""
with pytest.raises(DeviceNotFound):
await mock_device.async_connect()
assert not mock_device._connected
assert sleep.call_count == Device.MDNS_TIMEOUT
def test_connect(self, mock_device: Device):
"""Test that the sync connect method just calls the async connect method."""
with patch("devolo_plc_api.device.Device.async_connect", new=AsyncMock()) as ac:
mock_device.connect()
assert ac.call_count == 1
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("service_browser")
async def test_set_password(self, mock_device: Device):
"""Test setting a device password is also reflected in the APIs."""
await mock_device.async_connect()
assert mock_device.device
assert mock_device.plcnet
mock_device.password = "super_secret"
assert mock_device.device.password == "super_secret"
assert mock_device.plcnet.password == "super_secret"
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("http_client", "service_browser")
async def test_async_disconnect(self, mock_device: Device):
"""Test that disconnecting from a device cleans up Zeroconf and the HTTP client."""
await mock_device.async_connect()
await mock_device.async_disconnect()
assert mock_device._zeroconf.async_close.call_count == 1 # type: ignore[attr-defined]
assert mock_device._session.aclose.call_count == 1 # type: ignore[attr-defined]
assert not mock_device._connected
await mock_device.async_connect(session_instance=AsyncMock())
await mock_device.async_disconnect()
assert mock_device._zeroconf.async_close.call_count == 1 # type: ignore[attr-defined]
assert mock_device._session.aclose.call_count == 0 # type: ignore[attr-defined]
assert not mock_device._connected
def test_disconnect(self, mock_device: Device, event_loop: AbstractEventLoop):
"""Test that the sync disconnect method just calls the async disconnect method."""
with patch("devolo_plc_api.device.Device.async_disconnect", new=AsyncMock()) as ad:
mock_device._loop = event_loop
mock_device.disconnect()
assert ad.call_count == 1
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("service_browser")
async def test_async_context_manager(self, test_data: TestData):
"""Test the async context manager."""
async with Device(test_data.ip) as device:
assert device._connected
assert not device._connected
@pytest.mark.usefixtures("service_browser")
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
def test_context_manager(self, test_data: TestData):
"""Test the sync context manager."""
with Device(test_data.ip) as device:
assert device._connected
assert not device._connected
@pytest.mark.asyncio
async def test_state_change_removed(self, mock_device: Device):
"""Test that service information are not processed on state change to removed."""
with (
patch("devolo_plc_api.device.Device._retry_zeroconf_info"),
patch("devolo_plc_api.device.Device._get_service_info") as gsi,
):
mock_device._state_change(Mock(), PLCNETAPI, PLCNETAPI, ServiceStateChange.Removed)
assert gsi.call_count == 0
@pytest.mark.asyncio
@pytest.mark.usefixtures("service_browser", "sleep")
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
async def test_get_service_info_alien(self, mock_info_from_service: Mock):
"""Test ignoring alien information discovered via mDNS."""
with pytest.raises(DeviceNotFound):
mock_device = Device(ip="192.0.2.2")
await mock_device.async_connect()
assert MockAsyncServiceInfo.async_request.call_count == 1
assert mock_info_from_service.call_count == 0
devolo_plc_api-1.5.1/tests/test_deviceapi.py 0000664 0000000 0000000 00000044531 14777250235 0021224 0 ustar 00root root 0000000 0000000 """Test communicating with a the device API."""
from __future__ import annotations
import sys
from http import HTTPStatus
from typing import TYPE_CHECKING
from unittest.mock import patch
import pytest
from httpx import ConnectTimeout
from devolo_plc_api.device_api.factoryreset_pb2 import FactoryResetStart
from devolo_plc_api.device_api.ledsettings_pb2 import LedSettingsGet, LedSettingsSetResponse
from devolo_plc_api.device_api.multiap_pb2 import WifiMultiApGetResponse
from devolo_plc_api.device_api.restart_pb2 import RestartResponse, UptimeGetResponse
from devolo_plc_api.device_api.support_pb2 import SupportInfoDump, SupportInfoDumpResponse
from devolo_plc_api.device_api.updatefirmware_pb2 import UpdateFirmwareCheck, UpdateFirmwareStart
from devolo_plc_api.device_api.wifinetwork_pb2 import (
WifiConnectedStationsGet,
WifiGuestAccessGet,
WifiGuestAccessSetResponse,
WifiNeighborAPsGet,
WifiRepeatedAPsGet,
WifiRepeaterWpsClonePbcStart,
WifiResult,
WifiWpsPbcStart,
)
from devolo_plc_api.exceptions import DevicePasswordProtected, DeviceUnavailable, FeatureNotSupported
from . import DeviceType
if TYPE_CHECKING:
from pytest_httpx import HTTPXMock
from devolo_plc_api import Device
from devolo_plc_api.device_api import ConnectedStationInfo, DeviceApi, NeighborAPInfo, RepeatedAPInfo, SupportInfoItem
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Tests with httpx_mock need at least Python 3.9")
class TestDeviceApi:
"""Test devolo_plc_api.device_api.deviceapi.DeviceApi class."""
@pytest.mark.parametrize("feature", ["[]"])
def test_unsupported_feature(self, device_api: DeviceApi):
"""Test raising on using unsupported feature."""
with pytest.raises(FeatureNotSupported):
device_api.get_led_setting()
@pytest.mark.parametrize("feature", [""])
def test_feature(self, device_api: DeviceApi):
"""Test list of default features."""
assert device_api.features == ["reset", "update", "led", "intmtg"]
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("block_communication", "service_browser")
@pytest.mark.httpx_mock(can_send_already_matched_responses=True)
async def test_wrong_password_type(self, httpx_mock: HTTPXMock, mock_device: Device):
"""Test using different password hash if original password failed."""
await mock_device.async_connect()
assert mock_device.device
mock_device.password = "password"
httpx_mock.add_response(status_code=HTTPStatus.UNAUTHORIZED)
with pytest.raises(DevicePasswordProtected):
await mock_device.device.async_get_wifi_connected_station()
assert mock_device.device.password == "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
httpx_mock.add_response(status_code=HTTPStatus.UNAUTHORIZED)
with pytest.raises(DevicePasswordProtected):
await mock_device.device.async_get_wifi_connected_station()
assert mock_device.device.password == "113459eb7bb31bddee85ade5230d6ad5d8b2fb52879e00a84ff6ae1067a210d3"
await mock_device.async_disconnect()
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["led"])
async def test_async_get_led_setting(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test getting LED settings asynchronously."""
led_setting_get = LedSettingsGet(state=LedSettingsGet.LED_ON)
httpx_mock.add_response(content=led_setting_get.SerializeToString())
assert await device_api.async_get_led_setting()
@pytest.mark.parametrize("feature", ["led"])
def test_get_led_setting(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test getting LED settings synchronously."""
led_setting_get = LedSettingsGet(state=LedSettingsGet.LED_ON)
httpx_mock.add_response(content=led_setting_get.SerializeToString())
assert device_api.get_led_setting()
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["led"])
async def test_async_set_led_setting(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test setting LED settings asynchronously."""
led_setting_set = LedSettingsSetResponse()
httpx_mock.add_response(content=led_setting_set.SerializeToString())
assert await device_api.async_set_led_setting(enable=True)
@pytest.mark.parametrize("feature", ["led"])
def test_set_led_setting(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test setting LED settings synchronously."""
led_setting_set = LedSettingsSetResponse()
httpx_mock.add_response(content=led_setting_set.SerializeToString())
assert device_api.set_led_setting(enable=True)
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["multiap"])
async def test_async_get_wifi_multi_ap(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test setting LED settings asynchronously."""
multi_ap_details = WifiMultiApGetResponse(enabled=True)
httpx_mock.add_response(content=multi_ap_details.SerializeToString())
details = await device_api.async_get_wifi_multi_ap()
assert details.enabled
@pytest.mark.parametrize("feature", ["multiap"])
def test_get_wifi_multi_ap(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test setting LED settings synchronously."""
multi_ap_details = WifiMultiApGetResponse(enabled=True)
httpx_mock.add_response(content=multi_ap_details.SerializeToString())
details = device_api.get_wifi_multi_ap()
assert details.enabled
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["repeater0"])
async def test_async_get_wifi_repeated_access_points(
self, device_api: DeviceApi, httpx_mock: HTTPXMock, repeated_ap: RepeatedAPInfo
):
"""Test getting AP settings asynchronously."""
wifi_repeated_accesspoints_get = WifiRepeatedAPsGet(repeated_aps=[repeated_ap])
httpx_mock.add_response(content=wifi_repeated_accesspoints_get.SerializeToString())
wifi_repeated_access_points = await device_api.async_get_wifi_repeated_access_points()
assert wifi_repeated_access_points == [repeated_ap]
@pytest.mark.parametrize("feature", ["repeater0"])
def test_get_wifi_repeated_access_points(self, device_api: DeviceApi, httpx_mock: HTTPXMock, repeated_ap: RepeatedAPInfo):
"""Test getting AP settings synchronously."""
wifi_repeated_accesspoints_get = WifiRepeatedAPsGet(repeated_aps=[repeated_ap])
httpx_mock.add_response(content=wifi_repeated_accesspoints_get.SerializeToString())
wifi_repeated_access_points = device_api.get_wifi_repeated_access_points()
assert wifi_repeated_access_points == [repeated_ap]
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["repeater0"])
async def test_async_start_wps_clone(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test starting WPS clone mode asynchronously."""
wps = WifiRepeaterWpsClonePbcStart()
httpx_mock.add_response(content=wps.SerializeToString())
assert await device_api.async_start_wps_clone()
@pytest.mark.parametrize("feature", ["repeater0"])
def test_start_wps_clone(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test starting WPS clone mode synchronously."""
wps = WifiRepeaterWpsClonePbcStart()
httpx_mock.add_response(content=wps.SerializeToString())
assert device_api.start_wps_clone()
@pytest.mark.parametrize("feature", ["reset"])
async def test_async_factory_reset(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test factory reset asynchronously."""
reset = FactoryResetStart()
httpx_mock.add_response(content=reset.SerializeToString())
assert await device_api.async_factory_reset()
@pytest.mark.parametrize("feature", ["reset"])
def test_factory_reset(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test factory reset synchronously."""
reset = FactoryResetStart()
httpx_mock.add_response(content=reset.SerializeToString())
assert device_api.factory_reset()
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["restart"])
async def test_async_restart(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test restarting a device asynchronously."""
restart = RestartResponse()
httpx_mock.add_response(content=restart.SerializeToString())
assert await device_api.async_restart()
@pytest.mark.parametrize("feature", ["restart"])
def test_restart(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test restarting a device synchronously."""
restart = RestartResponse()
httpx_mock.add_response(content=restart.SerializeToString())
assert device_api.restart()
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["restart"])
async def test_async_uptime(self, device_api: DeviceApi, httpx_mock: HTTPXMock, runtime: int):
"""Test getting a device's update asynchronously."""
uptime = UptimeGetResponse(uptime=runtime)
httpx_mock.add_response(content=uptime.SerializeToString())
assert await device_api.async_uptime() == runtime
@pytest.mark.parametrize("feature", ["restart"])
def test_uptime(self, device_api: DeviceApi, httpx_mock: HTTPXMock, runtime: int):
"""Test getting a device's update synchronously."""
uptime = UptimeGetResponse(uptime=runtime)
httpx_mock.add_response(content=uptime.SerializeToString())
assert device_api.uptime() == runtime
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["support"])
async def test_async_get_support_info(self, device_api: DeviceApi, httpx_mock: HTTPXMock, support_item: SupportInfoItem):
"""Test getting a device's support information asynchronously."""
support_info = SupportInfoDumpResponse(info=SupportInfoDump(items=[support_item]))
httpx_mock.add_response(content=support_info.SerializeToString())
assert await device_api.async_get_support_info() == support_info.info
@pytest.mark.parametrize("feature", ["support"])
def test_get_support_info(self, device_api: DeviceApi, httpx_mock: HTTPXMock, support_item: SupportInfoItem):
"""Test getting a device's support information synchronously."""
support_info = SupportInfoDumpResponse(info=SupportInfoDump(items=[support_item]))
httpx_mock.add_response(content=support_info.SerializeToString())
assert device_api.get_support_info() == support_info.info
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["update"])
async def test_async_check_firmware_available(
self, device_api: DeviceApi, httpx_mock: HTTPXMock, firmware_update: UpdateFirmwareCheck
):
"""Test checking for firmware updates asynchronously."""
httpx_mock.add_response(content=firmware_update.SerializeToString())
firmware = await device_api.async_check_firmware_available()
assert firmware == firmware_update
@pytest.mark.parametrize("feature", ["update"])
def test_check_firmware_available(
self, device_api: DeviceApi, httpx_mock: HTTPXMock, firmware_update: UpdateFirmwareCheck
):
"""Test checking for firmware updates synchronously."""
httpx_mock.add_response(content=firmware_update.SerializeToString())
firmware = device_api.check_firmware_available()
assert firmware == firmware_update
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["update"])
async def test_async_start_firmware_update(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test firmware update asynchronously."""
firmware_update = UpdateFirmwareStart(result=UpdateFirmwareStart.UPDATE_STARTED)
httpx_mock.add_response(content=firmware_update.SerializeToString())
assert await device_api.async_start_firmware_update()
@pytest.mark.parametrize("feature", ["update"])
def test_start_firmware_update(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test firmware update synchronously."""
firmware_update = UpdateFirmwareStart(result=UpdateFirmwareStart.UPDATE_STARTED)
httpx_mock.add_response(content=firmware_update.SerializeToString())
assert device_api.start_firmware_update()
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["wifi1"])
async def test_async_get_wifi_connected_station(
self, device_api: DeviceApi, httpx_mock: HTTPXMock, connected_station: ConnectedStationInfo
):
"""Test getting connected wifi clients asynchronously."""
wifi_connected_stations_get = WifiConnectedStationsGet(connected_stations=[connected_station])
httpx_mock.add_response(content=wifi_connected_stations_get.SerializeToString())
connected_stations = await device_api.async_get_wifi_connected_station()
assert connected_stations == [connected_station]
@pytest.mark.parametrize("feature", ["wifi1"])
def test_get_wifi_connected_station(
self, device_api: DeviceApi, httpx_mock: HTTPXMock, connected_station: ConnectedStationInfo
):
"""Test getting connected wifi clients synchronously."""
wifi_connected_stations_get = WifiConnectedStationsGet(connected_stations=[connected_station])
httpx_mock.add_response(content=wifi_connected_stations_get.SerializeToString())
connected_stations = device_api.get_wifi_connected_station()
assert connected_stations == [connected_station]
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["wifi1"])
async def test_async_get_wifi_guest_access(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test getting wifi guest access status asynchronously."""
wifi_guest_access_get = WifiGuestAccessGet(enabled=True)
httpx_mock.add_response(content=wifi_guest_access_get.SerializeToString())
wifi_guest_access = await device_api.async_get_wifi_guest_access()
assert wifi_guest_access == wifi_guest_access_get
@pytest.mark.parametrize("feature", ["wifi1"])
def test_get_wifi_guest_access(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test getting wifi guest access status synchronously."""
wifi_guest_access_get = WifiGuestAccessGet(enabled=True)
httpx_mock.add_response(content=wifi_guest_access_get.SerializeToString())
wifi_guest_access = device_api.get_wifi_guest_access()
assert wifi_guest_access == wifi_guest_access_get
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["wifi1"])
async def test_async_set_wifi_guest_access(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test setting wifi guest access status asynchronously."""
wifi_guest_access_set = WifiGuestAccessSetResponse(result=WifiResult.WIFI_SUCCESS)
httpx_mock.add_response(content=wifi_guest_access_set.SerializeToString())
assert await device_api.async_set_wifi_guest_access(enable=True)
@pytest.mark.parametrize("feature", ["wifi1"])
def test_set_wifi_guest_access(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test setting wifi guest access status synchronously."""
wifi_guest_access_set = WifiGuestAccessSetResponse(result=WifiResult.WIFI_SUCCESS)
httpx_mock.add_response(content=wifi_guest_access_set.SerializeToString())
assert device_api.set_wifi_guest_access(enable=True)
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["wifi1"])
async def test_async_get_wifi_neighbor_access_points(
self, device_api: DeviceApi, httpx_mock: HTTPXMock, neighbor_ap: NeighborAPInfo
):
"""Test getting neighboring wifi access points asynchronously."""
wifi_neighbor_accesspoints_get = WifiNeighborAPsGet(neighbor_aps=[neighbor_ap])
httpx_mock.add_response(content=wifi_neighbor_accesspoints_get.SerializeToString())
wifi_neighbor_access_points = await device_api.async_get_wifi_neighbor_access_points()
assert wifi_neighbor_access_points == [neighbor_ap]
@pytest.mark.parametrize("feature", ["wifi1"])
def test_get_wifi_neighbor_access_points(self, device_api: DeviceApi, httpx_mock: HTTPXMock, neighbor_ap: NeighborAPInfo):
"""Test getting neighboring wifi access points synchronously."""
wifi_neighbor_accesspoints_get = WifiNeighborAPsGet(neighbor_aps=[neighbor_ap])
httpx_mock.add_response(content=wifi_neighbor_accesspoints_get.SerializeToString())
wifi_neighbor_access_points = device_api.get_wifi_neighbor_access_points()
assert wifi_neighbor_access_points == [neighbor_ap]
@pytest.mark.asyncio
@pytest.mark.parametrize("feature", ["wifi1"])
async def test_async_start_wps(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test starting WPS asynchronously."""
wps = WifiWpsPbcStart(result=WifiResult.WIFI_SUCCESS)
httpx_mock.add_response(content=wps.SerializeToString())
assert await device_api.async_start_wps()
@pytest.mark.parametrize("feature", ["wifi1"])
def test_start_wps(self, device_api: DeviceApi, httpx_mock: HTTPXMock):
"""Test starting WPS synchronously."""
wps = WifiWpsPbcStart(result=WifiResult.WIFI_SUCCESS)
httpx_mock.add_response(content=wps.SerializeToString())
assert device_api.start_wps()
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("block_communication", "service_browser")
async def test_device_unavailable(self, httpx_mock: HTTPXMock, mock_device: Device):
"""Test device being unavailable."""
await mock_device.async_connect()
assert mock_device.device
httpx_mock.add_exception(ConnectTimeout(""), is_reusable=True)
with pytest.raises(DeviceUnavailable), patch("asyncio.sleep"):
await mock_device.device.async_get_wifi_connected_station()
await mock_device.async_disconnect()
assert len(httpx_mock.get_requests()) == 3
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("block_communication", "service_browser")
async def test_attribute_error(self, mock_device: Device):
"""Test raising on calling not existing method."""
await mock_device.async_connect()
assert mock_device.device
with pytest.raises(AttributeError):
mock_device.device.test()
devolo_plc_api-1.5.1/tests/test_helpers.py 0000664 0000000 0000000 00000001006 14777250235 0020723 0 ustar 00root root 0000000 0000000 """Test helper methods."""
from syrupy.assertion import SnapshotAssertion
from devolo_plc_api import wifi_qr_code
from devolo_plc_api.device_api.wifinetwork_pb2 import WPA_2, WifiGuestAccessGet
class TestHelpers:
"""Test devolo_plc_api.helpers."""
def test_wifi_qr_code(self, snapshot: SnapshotAssertion):
"""Test creating a QR code."""
wifi_guest_access = WifiGuestAccessGet(enabled=True, ssid='"Test"', key='"Test"', wpa=WPA_2)
assert wifi_qr_code(wifi_guest_access) == snapshot
devolo_plc_api-1.5.1/tests/test_network.py 0000664 0000000 0000000 00000006540 14777250235 0020762 0 ustar 00root root 0000000 0000000 """Test network discovery."""
from socket import inet_aton
from unittest.mock import Mock, patch
import pytest
from zeroconf import ServiceStateChange, Zeroconf
from devolo_plc_api import Device, network
from devolo_plc_api.device_api import SERVICE_TYPE
from devolo_plc_api.zeroconf import ZeroconfServiceInfo
from . import TestData
from .mocks.zeroconf import MockServiceBrowser
class TestNetwork:
"""Test devolo_plc_api.network functions."""
@pytest.mark.asyncio
async def test_async_discover_network(self, test_data: TestData, mock_info_from_service: Mock):
"""Test discovering the network asynchronously."""
with (
patch("devolo_plc_api.network.ServiceBrowser", MockServiceBrowser),
patch("devolo_plc_api.network.Zeroconf.get_service_info", return_value=""),
):
serial_number = test_data.device_info[SERVICE_TYPE].properties["SN"]
mock_info_from_service.return_value = ZeroconfServiceInfo(
address=inet_aton(test_data.ip),
properties=test_data.device_info[SERVICE_TYPE].properties,
)
discovered = await network.async_discover_network(timeout=0.1)
assert serial_number in discovered
assert isinstance(discovered[serial_number], Device)
def test_discover_network(self, test_data: TestData, mock_info_from_service: Mock):
"""Test discovering the network synchronously."""
with (
patch("devolo_plc_api.network.ServiceBrowser", MockServiceBrowser),
patch("devolo_plc_api.network.Zeroconf.get_service_info", return_value=""),
):
serial_number = test_data.device_info[SERVICE_TYPE].properties["SN"]
mock_info_from_service.return_value = ZeroconfServiceInfo(
address=inet_aton(test_data.ip),
properties=test_data.device_info[SERVICE_TYPE].properties,
)
discovered = network.discover_network(timeout=0.1)
assert serial_number in discovered
assert isinstance(discovered[serial_number], Device)
def test_add_wrong_state(self):
"""Test early return on wrong state changes."""
with patch("devolo_plc_api.network.Zeroconf.get_service_info") as gsi:
network._add(Zeroconf(), SERVICE_TYPE, SERVICE_TYPE, ServiceStateChange.Removed, devices={}, timeout=3)
assert gsi.call_count == 0
def test_no_devices(self):
"""Test discovery with no devices."""
with (
patch("devolo_plc_api.network.ServiceBrowser", MockServiceBrowser),
patch("devolo_plc_api.network.Zeroconf.get_service_info", return_value=None),
):
discovered = network.discover_network(timeout=0.1)
assert not discovered
@pytest.mark.parametrize("mt", ["2600", "2601"])
def test_hcu(self, test_data: TestData, mt: str, mock_info_from_service: Mock):
"""Test ignoring Home Control Central Units."""
with (
patch("devolo_plc_api.network.ServiceBrowser", MockServiceBrowser),
patch("devolo_plc_api.network.Zeroconf.get_service_info", return_value=""),
):
mock_info_from_service.return_value = ZeroconfServiceInfo(address=test_data.ip.encode(), properties={"MT": mt})
discovered = network.discover_network(timeout=0.1)
assert not discovered
devolo_plc_api-1.5.1/tests/test_plcnetapi.py 0000664 0000000 0000000 00000015322 14777250235 0021246 0 ustar 00root root 0000000 0000000 """Test communicating with a the plcnet API."""
import sys
from http import HTTPStatus
from unittest.mock import patch
import pytest
from httpx import ConnectTimeout
from pytest_httpx import HTTPXMock
from devolo_plc_api import Device
from devolo_plc_api.exceptions import DevicePasswordProtected, DeviceUnavailable
from devolo_plc_api.plcnet_api import LogicalNetwork, PlcNetApi
from devolo_plc_api.plcnet_api.getnetworkoverview_pb2 import GetNetworkOverview
from devolo_plc_api.plcnet_api.identifydevice_pb2 import IdentifyDeviceResponse
from devolo_plc_api.plcnet_api.pairdevice_pb2 import PairDeviceStart
from devolo_plc_api.plcnet_api.setuserdevicename_pb2 import SetUserDeviceNameResponse
from . import DeviceType
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Tests with httpx_mock need at least Python 3.9")
class TestPlcApi:
"""Test devolo_plc_api.plcnet_api.plcnetapi.PlcNetApi class."""
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("block_communication", "service_browser")
@pytest.mark.httpx_mock(can_send_already_matched_responses=True)
async def test_wrong_password_type(self, httpx_mock: HTTPXMock, mock_device: Device):
"""Test using different password hash if original password failed."""
await mock_device.async_connect()
assert mock_device.plcnet
mock_device.password = "password"
httpx_mock.add_response(status_code=HTTPStatus.UNAUTHORIZED)
with pytest.raises(DevicePasswordProtected):
await mock_device.plcnet.async_set_user_device_name("Test")
assert mock_device.plcnet.password == "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
httpx_mock.add_response(status_code=HTTPStatus.UNAUTHORIZED)
with pytest.raises(DevicePasswordProtected):
await mock_device.plcnet.async_set_user_device_name("Test")
assert mock_device.plcnet.password == "113459eb7bb31bddee85ade5230d6ad5d8b2fb52879e00a84ff6ae1067a210d3"
await mock_device.async_disconnect()
@pytest.mark.asyncio
async def test_async_get_network_overview(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock, network: LogicalNetwork):
"""Test getting the network overview asynchronously."""
network_overview = GetNetworkOverview(network=network)
httpx_mock.add_response(content=network_overview.SerializeToString())
overview = await plcnet_api.async_get_network_overview()
assert overview == network
def test_get_network_overview(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock, network: LogicalNetwork):
"""Test getting the network overview synchronously."""
network_overview = GetNetworkOverview(network=network)
httpx_mock.add_response(content=network_overview.SerializeToString())
overview = plcnet_api.get_network_overview()
assert overview == network
@pytest.mark.asyncio
async def test_async_identify_device_start(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock):
"""Test starting identifying a device asynchronously."""
identify_device = IdentifyDeviceResponse()
httpx_mock.add_response(content=identify_device.SerializeToString())
assert await plcnet_api.async_identify_device_start()
def test_identify_device_start(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock):
"""Test starting identifying a device synchronously."""
identify_device = IdentifyDeviceResponse()
httpx_mock.add_response(content=identify_device.SerializeToString())
assert plcnet_api.identify_device_start()
@pytest.mark.asyncio
async def test_async_identify_device_stop(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock):
"""Test stopping identifying a device asynchronously."""
identify_device = IdentifyDeviceResponse()
httpx_mock.add_response(content=identify_device.SerializeToString())
assert await plcnet_api.async_identify_device_stop()
def test_identify_device_stop(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock):
"""Test stopping identifying a device synchronously."""
identify_device = IdentifyDeviceResponse()
httpx_mock.add_response(content=identify_device.SerializeToString())
assert plcnet_api.identify_device_stop()
@pytest.mark.asyncio
async def test_async_pair_device(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock):
"""Test pairing a device asynchronously."""
pair_device = PairDeviceStart()
httpx_mock.add_response(content=pair_device.SerializeToString())
assert await plcnet_api.async_pair_device()
def test_pair_device(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock):
"""Test pairing a device synchronously."""
pair_device = PairDeviceStart()
httpx_mock.add_response(content=pair_device.SerializeToString())
assert plcnet_api.pair_device()
@pytest.mark.asyncio
async def test_async_set_user_device_name(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock):
"""Test setting a device name asynchronously."""
user_device_name_set = SetUserDeviceNameResponse()
httpx_mock.add_response(content=user_device_name_set.SerializeToString())
assert await plcnet_api.async_set_user_device_name("Test")
def test_set_user_device_name(self, plcnet_api: PlcNetApi, httpx_mock: HTTPXMock):
"""Test setting a device name synchronously."""
user_device_name_set = SetUserDeviceNameResponse()
httpx_mock.add_response(content=user_device_name_set.SerializeToString())
assert plcnet_api.set_user_device_name("Test")
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("block_communication", "service_browser")
async def test_device_unavailable(self, httpx_mock: HTTPXMock, mock_device: Device):
"""Test device being unavailable."""
await mock_device.async_connect()
assert mock_device.plcnet
httpx_mock.add_exception(ConnectTimeout(""), is_reusable=True)
with pytest.raises(DeviceUnavailable), patch("asyncio.sleep"):
await mock_device.plcnet.async_get_network_overview()
await mock_device.async_disconnect()
assert len(httpx_mock.get_requests()) == 3
@pytest.mark.asyncio
@pytest.mark.parametrize("device_type", [DeviceType.PLC])
@pytest.mark.usefixtures("block_communication", "service_browser")
async def test_attribute_error(self, mock_device: Device):
"""Test raising on calling not existing method."""
await mock_device.async_connect()
assert mock_device.plcnet
with pytest.raises(AttributeError):
mock_device.plcnet.test() # type: ignore[union-attr]