Skip to content
Draft
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
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies = [
"zigpy-deconz==0.25.5",
"zigpy-xbee==0.21.1",
"zigpy-zigate==0.14.0",
"zha-quirks==1.2.0",
"zha-quirks>=1.2.0",
]

[tool.setuptools.packages.find]
Expand All @@ -30,7 +30,8 @@ exclude = ["tests", "tests.*"]
testing = [
"pytest",
"coloredlogs",
"python-slugify"
"python-slugify",
"homeassistant",
]

[tool.setuptools-git-versioning]
Expand Down Expand Up @@ -229,6 +230,7 @@ split-on-trailing-comma = false

# Allow for main entry & scripts to write to stdout
"script/*" = ["T20"]
"tools/*" = ["T20"]

[tool.ruff.lint.mccabe]
max-complexity = 25
Expand Down
5 changes: 2 additions & 3 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from zigpy.application import ControllerApplication
from zigpy.const import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_PROFILE, SIG_EP_TYPE
from zigpy.quirks import get_device as quirks_get_device
import zigpy.types as t
import zigpy.zcl
import zigpy.zcl.foundation as zcl_f
Expand Down Expand Up @@ -423,7 +422,7 @@ def zigpy_device_from_device_data(
if quirk:
device = quirk(app, device.ieee, device.nwk, device)
else:
device = quirks_get_device(device)
device = app._device_resolver(device)

for epid, ep in device_data["endpoints"].items():
try:
Expand Down Expand Up @@ -601,7 +600,7 @@ def create_mock_zigpy_device(
if quirk:
device = quirk(zigpy_app_controller, device.ieee, device.nwk, device)
else:
device = quirks_get_device(device)
device = zigpy_app_controller._device_resolver(device)

if patch_cluster:
for endpoint in (ep for epid, ep in device.endpoints.items() if epid):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": null,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "PM25",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": null,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "PM25",
Expand Down
4 changes: 2 additions & 2 deletions tests/data/devices/tze200-7bztmfm1-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": null,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "PM25",
Expand Down Expand Up @@ -542,7 +542,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": 0,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "VOCLevel",
Expand Down
4 changes: 2 additions & 2 deletions tests/data/devices/tze200-dwcarsat-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": null,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "PM25",
Expand Down Expand Up @@ -642,7 +642,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": 0,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "VOCLevel",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/devices/tze200-mja3fuja-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": 0,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "VOCLevel",
Expand Down
4 changes: 2 additions & 2 deletions tests/data/devices/tze200-yvx5lh6k-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": null,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "PM25",
Expand Down Expand Up @@ -381,7 +381,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": 0,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "VOCLevel",
Expand Down
4 changes: 2 additions & 2 deletions tests/data/devices/tze204-c2fmom5z-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": null,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "PM25",
Expand Down Expand Up @@ -705,7 +705,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": 0,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "VOCLevel",
Expand Down
4 changes: 2 additions & 2 deletions tests/data/devices/tze204-dwcarsat-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": null,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "PM25",
Expand Down Expand Up @@ -584,7 +584,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": 0,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "VOCLevel",
Expand Down
4 changes: 2 additions & 2 deletions tests/data/devices/tze204-ltwbm23f-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,13 @@
"mode": "auto",
"native_max_value": 6,
"native_min_value": -6,
"native_step": 0.1,
"native_step": 1,
"native_unit_of_measurement": "\u00b0C"
},
"state": {
"class_name": "NumberConfigurationEntity",
"available": true,
"state": 0.0
"state": 0
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion tests/data/devices/tze204-qyr2m29i-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"mode": "auto",
"native_max_value": 6,
"native_min_value": -6,
"native_step": 0.1,
"native_step": 1,
"native_unit_of_measurement": "\u00b0C"
},
"state": {
Expand Down
4 changes: 2 additions & 2 deletions tests/data/devices/tze204-yvx5lh6k-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": null,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "PM25",
Expand Down Expand Up @@ -542,7 +542,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": 0,
"unit": "\u00b5g/m\u00b3"
"unit": "\u03bcg/m\u00b3"
},
"state": {
"class_name": "VOCLevel",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/devices/tze284-rqcuwlsa-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
"available": true,
"group_id": null,
"suggested_display_precision": null,
"unit": "\u00b5S/cm"
"unit": "\u03bcS/cm"
},
"state": {
"class_name": "ElectricalConductivity",
Expand Down
5 changes: 2 additions & 3 deletions tests/test_discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
zigpy_device_from_json,
)
from zha.application import Platform
from zha.application.discovery import discover_device_entities
from zha.application.gateway import Gateway
from zha.application.helpers import DeviceOverridesConfiguration
from zha.application.platforms import PlatformEntity, binary_sensor, sensor
Expand Down Expand Up @@ -171,7 +170,7 @@ async def test_device_override_picks_highest_priority(
zha_device = await join_zigpy_device(zha_gateway, zigpy_device)

# Only one light entity will be discovered
entities = list(discover_device_entities(zha_device))
entities = list(zha_device.discover_entities())
light_entities = [e for e in entities if e.PLATFORM == Platform.LIGHT]
assert len(light_entities) == 1
assert isinstance(light_entities[0], HueLight)
Expand All @@ -181,7 +180,7 @@ async def test_device_override_picks_highest_priority(
f"{zigpy_device.ieee}-11": DeviceOverridesConfiguration(type=Platform.SWITCH)
}

entities = list(discover_device_entities(zha_device))
entities = list(zha_device.discover_entities())
switch_entities = [e for e in entities if e.PLATFORM == Platform.SWITCH]
assert len(switch_entities) == 1

Expand Down
Loading
Loading