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
15 changes: 10 additions & 5 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,21 @@ def zigpy_device_from_device_data(

for attr in cluster["attributes"]:
attrid = int(attr["id"], 16)
attr_name = attr.get("name")

# Look up by name to avoid ambiguity with manufacturer-specific attrs
if attr_name is not None:
attr_def = real_cluster.find_attribute(attr_name)
assert attr_def.id == attrid
else:
attr_def = real_cluster.find_attribute(attrid)

if attr.get("value", None) is not None:
real_cluster._attr_cache[attrid] = attr["value"]
real_cluster._attr_cache.set_value(attr_def, attr["value"])
real_cluster.PLUGGED_ATTR_READS[attrid] = attr["value"]

if attr.get("unsupported", False):
real_cluster.unsupported_attributes.add(attrid)

if attr["name"] is not None:
real_cluster.unsupported_attributes.add(attr["name"])
real_cluster.add_unsupported_attribute(attr_def)

for obj in device_data["neighbors"]:
app.topology.neighbors[device.ieee].append(
Expand Down
4 changes: 2 additions & 2 deletions tests/data/devices/smartthings-tagv4.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@
"state": {
"class_name": "DeviceScannerEntity",
"available": true,
"connected": false,
"battery_level": null
"connected": true,
"battery_level": 69.0
}
}
],
Expand Down
141 changes: 141 additions & 0 deletions tests/data/devices/tze200-c88teujp-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,147 @@
}
],
"number": [
{
"info_object": {
"fallback_name": null,
"unique_id": "ab:cd:ef:12:f0:e2:89:82-1-513-local_temperature_calibration",
"migrate_unique_ids": [],
"platform": "number",
"class_name": "ThermostatLocalTempCalibration",
"translation_key": "local_temperature_calibration",
"translation_placeholders": null,
"device_class": null,
"state_class": null,
"entity_category": "config",
"entity_registry_enabled_default": true,
"enabled": true,
"primary": false,
"cluster_handlers": [
{
"class_name": "ThermostatClusterHandler",
"generic_id": "cluster_handler_0x0201",
"endpoint_id": 1,
"cluster": {
"id": 513,
"name": "TuyaThermostatV2NoSchedule",
"type": "server"
},
"id": "1:0x0201",
"unique_id": "ab:cd:ef:12:f0:e2:89:82:1:0x0201",
"status": "INITIALIZED",
"value_attribute": "local_temperature"
}
],
"device_ieee": "ab:cd:ef:12:f0:e2:89:82",
"endpoint_id": 1,
"available": true,
"group_id": null,
"mode": "box",
"native_max_value": 2.5,
"native_min_value": -2.5,
"native_step": 0.1,
"native_unit_of_measurement": "\u00b0C"
},
"state": {
"class_name": "ThermostatLocalTempCalibration",
"available": true,
"state": 2.0
}
},
{
"info_object": {
"fallback_name": null,
"unique_id": "ab:cd:ef:12:f0:e2:89:82-1-513-max_heat_setpoint_limit",
"migrate_unique_ids": [],
"platform": "number",
"class_name": "MaxHeatSetpointLimit",
"translation_key": "max_heat_setpoint_limit",
"translation_placeholders": null,
"device_class": null,
"state_class": null,
"entity_category": "config",
"entity_registry_enabled_default": true,
"enabled": true,
"primary": false,
"cluster_handlers": [
{
"class_name": "ThermostatClusterHandler",
"generic_id": "cluster_handler_0x0201",
"endpoint_id": 1,
"cluster": {
"id": 513,
"name": "TuyaThermostatV2NoSchedule",
"type": "server"
},
"id": "1:0x0201",
"unique_id": "ab:cd:ef:12:f0:e2:89:82:1:0x0201",
"status": "INITIALIZED",
"value_attribute": "local_temperature"
}
],
"device_ieee": "ab:cd:ef:12:f0:e2:89:82",
"endpoint_id": 1,
"available": true,
"group_id": null,
"mode": "box",
"native_max_value": 30.0,
"native_min_value": 5.0,
"native_step": 0.5,
"native_unit_of_measurement": "\u00b0C"
},
"state": {
"class_name": "MaxHeatSetpointLimit",
"available": true,
"state": 30.0
}
},
{
"info_object": {
"fallback_name": null,
"unique_id": "ab:cd:ef:12:f0:e2:89:82-1-513-min_heat_setpoint_limit",
"migrate_unique_ids": [],
"platform": "number",
"class_name": "MinHeatSetpointLimit",
"translation_key": "min_heat_setpoint_limit",
"translation_placeholders": null,
"device_class": null,
"state_class": null,
"entity_category": "config",
"entity_registry_enabled_default": true,
"enabled": true,
"primary": false,
"cluster_handlers": [
{
"class_name": "ThermostatClusterHandler",
"generic_id": "cluster_handler_0x0201",
"endpoint_id": 1,
"cluster": {
"id": 513,
"name": "TuyaThermostatV2NoSchedule",
"type": "server"
},
"id": "1:0x0201",
"unique_id": "ab:cd:ef:12:f0:e2:89:82:1:0x0201",
"status": "INITIALIZED",
"value_attribute": "local_temperature"
}
],
"device_ieee": "ab:cd:ef:12:f0:e2:89:82",
"endpoint_id": 1,
"available": true,
"group_id": null,
"mode": "box",
"native_max_value": 30.0,
"native_min_value": 5.0,
"native_step": 0.5,
"native_unit_of_measurement": "\u00b0C"
},
"state": {
"class_name": "MinHeatSetpointLimit",
"available": true,
"state": 5.0
}
},
{
"info_object": {
"fallback_name": "Local temperature calibration",
Expand Down
141 changes: 141 additions & 0 deletions tests/data/devices/tze200-h4cgnbzg-ts0601.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,147 @@
}
],
"number": [
{
"info_object": {
"fallback_name": null,
"unique_id": "ab:cd:ef:12:d1:91:b1:8f-1-513-local_temperature_calibration",
"migrate_unique_ids": [],
"platform": "number",
"class_name": "ThermostatLocalTempCalibration",
"translation_key": "local_temperature_calibration",
"translation_placeholders": null,
"device_class": null,
"state_class": null,
"entity_category": "config",
"entity_registry_enabled_default": true,
"enabled": true,
"primary": false,
"cluster_handlers": [
{
"class_name": "ThermostatClusterHandler",
"generic_id": "cluster_handler_0x0201",
"endpoint_id": 1,
"cluster": {
"id": 513,
"name": "TuyaThermostatV2NoSchedule",
"type": "server"
},
"id": "1:0x0201",
"unique_id": "ab:cd:ef:12:d1:91:b1:8f:1:0x0201",
"status": "INITIALIZED",
"value_attribute": "local_temperature"
}
],
"device_ieee": "ab:cd:ef:12:d1:91:b1:8f",
"endpoint_id": 1,
"available": true,
"group_id": null,
"mode": "box",
"native_max_value": 2.5,
"native_min_value": -2.5,
"native_step": 0.1,
"native_unit_of_measurement": "\u00b0C"
},
"state": {
"class_name": "ThermostatLocalTempCalibration",
"available": true,
"state": -0.4
}
},
{
"info_object": {
"fallback_name": null,
"unique_id": "ab:cd:ef:12:d1:91:b1:8f-1-513-max_heat_setpoint_limit",
"migrate_unique_ids": [],
"platform": "number",
"class_name": "MaxHeatSetpointLimit",
"translation_key": "max_heat_setpoint_limit",
"translation_placeholders": null,
"device_class": null,
"state_class": null,
"entity_category": "config",
"entity_registry_enabled_default": true,
"enabled": true,
"primary": false,
"cluster_handlers": [
{
"class_name": "ThermostatClusterHandler",
"generic_id": "cluster_handler_0x0201",
"endpoint_id": 1,
"cluster": {
"id": 513,
"name": "TuyaThermostatV2NoSchedule",
"type": "server"
},
"id": "1:0x0201",
"unique_id": "ab:cd:ef:12:d1:91:b1:8f:1:0x0201",
"status": "INITIALIZED",
"value_attribute": "local_temperature"
}
],
"device_ieee": "ab:cd:ef:12:d1:91:b1:8f",
"endpoint_id": 1,
"available": true,
"group_id": null,
"mode": "box",
"native_max_value": 30.0,
"native_min_value": 5.0,
"native_step": 0.5,
"native_unit_of_measurement": "\u00b0C"
},
"state": {
"class_name": "MaxHeatSetpointLimit",
"available": true,
"state": 30.0
}
},
{
"info_object": {
"fallback_name": null,
"unique_id": "ab:cd:ef:12:d1:91:b1:8f-1-513-min_heat_setpoint_limit",
"migrate_unique_ids": [],
"platform": "number",
"class_name": "MinHeatSetpointLimit",
"translation_key": "min_heat_setpoint_limit",
"translation_placeholders": null,
"device_class": null,
"state_class": null,
"entity_category": "config",
"entity_registry_enabled_default": true,
"enabled": true,
"primary": false,
"cluster_handlers": [
{
"class_name": "ThermostatClusterHandler",
"generic_id": "cluster_handler_0x0201",
"endpoint_id": 1,
"cluster": {
"id": 513,
"name": "TuyaThermostatV2NoSchedule",
"type": "server"
},
"id": "1:0x0201",
"unique_id": "ab:cd:ef:12:d1:91:b1:8f:1:0x0201",
"status": "INITIALIZED",
"value_attribute": "local_temperature"
}
],
"device_ieee": "ab:cd:ef:12:d1:91:b1:8f",
"endpoint_id": 1,
"available": true,
"group_id": null,
"mode": "box",
"native_max_value": 30.0,
"native_min_value": 5.0,
"native_step": 0.5,
"native_unit_of_measurement": "\u00b0C"
},
"state": {
"class_name": "MinHeatSetpointLimit",
"available": true,
"state": 5.0
}
},
{
"info_object": {
"fallback_name": "Local temperature calibration",
Expand Down
Loading
Loading