Skip to content

Commit

Permalink
Merge branch 'release/0.0.88'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey committed Dec 7, 2022
2 parents 975e320 + e832985 commit 811dd9f
Show file tree
Hide file tree
Showing 18 changed files with 538 additions and 97 deletions.
92 changes: 46 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

env:
CACHE_VERSION: 1
DEFAULT_PYTHON: '3.9.14'
PYTHON_VERSION_DEFAULT: '3.9.15'
PRE_COMMIT_HOME: ~/.cache/pre-commit

jobs:
Expand All @@ -21,18 +21,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8.14', '3.9.14', '3.10.7']
python-version: ['3.8.14', '3.9.15', '3.10.8', '3.11.0']
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v2.1.4
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: venv
key: >-
Expand All @@ -57,15 +57,15 @@ jobs:
needs: prepare-base
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v2.1.4
uses: actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_VERSION_DEFAULT }}
uses: actions/setup-python@v4
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: venv
key: >-
Expand All @@ -80,7 +80,7 @@ jobs:
exit 1
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: |
Expand All @@ -99,15 +99,15 @@ jobs:
needs: pre-commit
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v2.1.4
uses: actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_VERSION_DEFAULT }}
uses: actions/setup-python@v4
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: venv
key: >-
Expand All @@ -122,7 +122,7 @@ jobs:
exit 1
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: |
Expand All @@ -143,15 +143,15 @@ jobs:
needs: pre-commit
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v2.1.4
uses: actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_VERSION_DEFAULT }}
uses: actions/setup-python@v4
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: venv
key: >-
Expand All @@ -166,7 +166,7 @@ jobs:
exit 1
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: |
Expand All @@ -190,15 +190,15 @@ jobs:
needs: pre-commit
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v2.1.4
uses: actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_VERSION_DEFAULT }}
uses: actions/setup-python@v4
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: venv
key: >-
Expand All @@ -213,7 +213,7 @@ jobs:
exit 1
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: |
Expand All @@ -234,15 +234,15 @@ jobs:
needs: pre-commit
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v2.1.4
uses: actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_VERSION_DEFAULT }}
uses: actions/setup-python@v4
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: venv
key: >-
Expand All @@ -257,7 +257,7 @@ jobs:
exit 1
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: |
Expand All @@ -280,20 +280,20 @@ jobs:
needs: prepare-base
strategy:
matrix:
python-version: ['3.8.14', '3.9.14', '3.10.7']
python-version: ['3.8.14', '3.9.15', '3.10.8', '3.11.0']
name: >-
Run tests Python ${{ matrix.python-version }}
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.1.4
uses: actions/setup-python@v4
id: python
with:
python-version: ${{ matrix.python-version }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: venv
key: >-
Expand Down Expand Up @@ -328,7 +328,7 @@ jobs:
-p no:sugar \
tests
- name: Upload coverage artifact
uses: actions/upload-artifact@v2.2.0
uses: actions/upload-artifact@v3
with:
name: coverage-${{ matrix.python-version }}
path: .coverage
Expand All @@ -347,15 +347,15 @@ jobs:
needs: pytest
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.1.4
uses: actions/setup-python@v4
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: venv
key: >-
Expand All @@ -369,15 +369,15 @@ jobs:
echo "Failed to restore Python virtual environment from cache"
exit 1
- name: Download all coverage artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
- name: Combine coverage results
run: |
. venv/bin/activate
coverage combine coverage*/.coverage*
coverage report --fail-under=72
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
- name: Upload coverage to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
name: Build and publish distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.6
uses: actions/setup-python@v1
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
version: 3.6
version: 3.9
- name: Install wheel
run: >-
pip install wheel
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ pytest-sugar
pytest-timeout
pytest-asyncio
pytest>=7.1.3
zigpy>=0.51.6
zigpy>=0.52
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ line_length = 88
indent = " "

[mypy]
python_version = 3.7
python_version = 3.9
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_calls = true
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from setuptools import find_packages, setup

VERSION = "0.0.87"
VERSION = "0.0.88"


setup(
Expand All @@ -19,7 +19,7 @@
license="Apache License Version 2.0",
keywords="zha quirks homeassistant hass",
packages=find_packages(exclude=["tests"]),
python_requires=">=3",
install_requires=["zigpy>=0.51.6"],
python_requires=">=3.8",
install_requires=["zigpy>=0.52"],
tests_require=["pytest"],
)
4 changes: 2 additions & 2 deletions tests/test_tuya_dimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def test_command(zigpy_device_from_quirk, quirk):
m1.assert_called_with(
61184,
4,
b"\x01\x04\x00\x00\x03\x02\x02\x00\x04\x00\x00\x03r",
b"\x01\x04\x00\x00\x03\x02\x02\x00\x04r\x03\x00\x00",
expect_reply=True,
command_id=0,
)
Expand Down Expand Up @@ -78,7 +78,7 @@ async def test_write_attr(zigpy_device_from_quirk, quirk):
m1.assert_called_with(
61184,
2,
b"\x01\x02\x00\x00\x01\x03\x02\x00\x04\x00\x00\x00b",
b"\x01\x02\x00\x00\x01\x03\x02\x00\x04b\x00\x00\x00",
expect_reply=False,
command_id=0,
)
Expand Down
11 changes: 6 additions & 5 deletions tests/test_tuya_mcu.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ async def test_tuya_methods(zigpy_device_from_quirk, quirk):

result_1 = tuya_cluster.from_cluster_data(tcd_1)
assert result_1
assert result_1.datapoints
assert len(result_1.datapoints) == 1
assert result_1.datapoints[0].dp == 9
assert result_1.datapoints[0].data.dp_type == TuyaDPType.VALUE
assert result_1.datapoints[0].data.raw == b"\x00\x00\x00b"
assert len(result_1) == 1
assert result_1[0].datapoints
assert len(result_1[0].datapoints) == 1
assert result_1[0].datapoints[0].dp == 9
assert result_1[0].datapoints[0].data.dp_type == TuyaDPType.VALUE
assert result_1[0].datapoints[0].data.raw == b"b\x00\x00\x00"

tcd_2 = TuyaClusterData(
endpoint_id=7, cluster_attr="not_exists_attribute", attr_value=25
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tuya_valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def test_write_attr_psbzs(zigpy_device_from_quirk, quirk):
m1.assert_called_with(
61184,
2,
b"\x01\x02\x00\x00\x01\x05\x02\x00\x04\x00\x00\x00\x0f",
b"\x01\x02\x00\x00\x01\x05\x02\x00\x04\x0f\x00\x00\x00",
expect_reply=False,
command_id=0,
)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38, py39, py310, lint, black
envlist = py38, py39, py310, py311, lint, black
skip_missing_interpreters = True

[testenv]
Expand Down
20 changes: 19 additions & 1 deletion zhaquirks/lixee/zlinky.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
"""Quirk for ZLinky_TIC."""
from copy import deepcopy

from zigpy.profiles import zha
from zigpy.quirks import CustomCluster, CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Identify, Ota
from zigpy.zcl.clusters.general import (
Basic,
GreenPowerProxy,
Identify,
Ota,
PowerConfiguration,
)
from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement, MeterIdentification
from zigpy.zcl.clusters.manufacturer_specific import ManufacturerSpecificCluster
from zigpy.zcl.clusters.smartenergy import Metering
Expand Down Expand Up @@ -170,6 +178,7 @@ class ZLinkyTIC(CustomDevice):
DEVICE_TYPE: zha.DeviceType.METER_INTERFACE,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
ZLinkyTICMetering,
MeterIdentification.cluster_id,
Expand All @@ -186,3 +195,12 @@ class ZLinkyTIC(CustomDevice):
},
},
}


class ZLinkyTICFWV12(ZLinkyTIC):
"""ZLinky_TIC from LiXee with firmware v12.0+."""

signature = deepcopy(ZLinkyTIC.signature)

# Insert PowerConfiguration cluster in signature for devices with firmware v12.0+
signature[ENDPOINTS][1][INPUT_CLUSTERS].insert(1, PowerConfiguration.cluster_id)
Loading

0 comments on commit 811dd9f

Please sign in to comment.