Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
CACHE_VERSION: 1
DEFAULT_PYTHON: 3.8
DEFAULT_PYTHON: 3.8.16
PRE_COMMIT_HOME: ~/.cache/pre-commit

jobs:
Expand All @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8.14', '3.9.15', '3.10.8', '3.11.0']
python-version: ['3.8.16', '3.9.15', '3.10.8', '3.11.0']
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
args:
- --safe
- --quiet

- repo: https://github.com/pycqa/flake8
rev: 3.8.4
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-docstrings==1.5.0
- pydocstyle==5.1.1

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/codespell-project/codespell
rev: v1.17.1
rev: v2.2.4
hooks:
- id: codespell
args:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
author_email="schmidt.d@aon.at",
license="GPL-3.0",
packages=find_packages(exclude=["tests"]),
install_requires=["zigpy>=0.52.1"],
install_requires=["zigpy>=0.54.0"],
tests_require=["pytest", "asynctest"],
)
17 changes: 16 additions & 1 deletion tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import asyncio
import logging
from unittest import mock

import pytest
import zigpy.application
import zigpy.config
import zigpy.device
from zigpy.types import EUI64
from zigpy.types import EUI64, Channels
import zigpy.zdo.types as zdo_t

from zigpy_deconz import types as t
Expand Down Expand Up @@ -569,3 +571,16 @@ async def test_reset_network_info(app):
await app.reset_network_info()

app.form_network.assert_called_once()


async def test_energy_scan(app):
with mock.patch.object(
zigpy.application.ControllerApplication,
"energy_scan",
return_value={c: c for c in Channels.ALL_CHANNELS},
):
results = await app.energy_scan(
channels=Channels.ALL_CHANNELS, duration_exp=0, count=1
)

assert results == {c: c * 3 for c in Channels.ALL_CHANNELS}
10 changes: 10 additions & 0 deletions zigpy_deconz/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,16 @@ async def force_remove(self, dev):
"""Forcibly remove device from NCP."""
pass

async def energy_scan(
self, channels: t.Channels.ALL_CHANNELS, duration_exp: int, count: int
) -> dict[int, float]:
results = await super().energy_scan(
channels=channels, duration_exp=duration_exp, count=count
)

# The Conbee seems to max out at an LQI of 85, which is exactly 255/3
return {c: v * 3 for c, v in results.items()}

async def add_endpoint(self, descriptor: zdo_t.SimpleDescriptor) -> None:
"""Register an endpoint on the device, replacing any with conflicting IDs."""

Expand Down