Skip to content

Commit

Permalink
fix match on quirk in manufacturerspecific.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Caius-Bonus committed Sep 30, 2023
1 parent 3293f46 commit e49aed5
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,12 @@ class IkeaRemote(ClusterHandler):
REPORT_CONFIG = ()


def compare_quirk_class(cluster: zigpy.zcl.Cluster, name: str):
def compare_quirk_class(endpoint: Endpoint, name: str):
"""Return True if the last two words separated by dots equal the words between the dots in name.
This function should probably be moved to the base class
"""
return cluster.endpoint.quirk_class.rsplit(".", 2)[1:] == name.split(".")
return endpoint.device.quirk_class.rsplit(".", 2)[1:] == name.split(".")


@registries.CLUSTER_HANDLER_ONLY_CLUSTERS.register(
Expand All @@ -397,7 +397,7 @@ class DanfossTRVChannel(ClusterHandler):
@classmethod
def matches(cls, cluster: zigpy.zcl.Cluster, endpoint: Endpoint) -> bool:
"""Filter the cluster match for specific devices."""
return compare_quirk_class(cluster, "thermostat.DanfossThermostat")
return compare_quirk_class(endpoint, "thermostat.DanfossThermostat")

REPORT_CONFIG = (
AttrReportConfig(attr="open_window_detection", config=REPORT_CONFIG_DEFAULT),
Expand Down Expand Up @@ -438,7 +438,7 @@ class DanfossTRVInterfaceChannel(ClusterHandler):
@classmethod
def matches(cls, cluster: zigpy.zcl.Cluster, endpoint: Endpoint) -> bool:
"""Filter the cluster match for specific devices."""
return compare_quirk_class(cluster, "thermostat.DanfossThermostat")
return compare_quirk_class(endpoint, "thermostat.DanfossThermostat")

ZCL_INIT_ATTRS = {"viewing_direction": True}

Expand All @@ -455,7 +455,7 @@ class DanfossTRVDiagnosticChannel(ClusterHandler):
@classmethod
def matches(cls, cluster: zigpy.zcl.Cluster, endpoint: Endpoint) -> bool:
"""Filter the cluster match for specific devices."""
return compare_quirk_class(cluster, "thermostat.DanfossThermostat")
return compare_quirk_class(endpoint, "thermostat.DanfossThermostat")

REPORT_CONFIG = (
AttrReportConfig(attr="sw_error_code", config=REPORT_CONFIG_DEFAULT),
Expand Down

0 comments on commit e49aed5

Please sign in to comment.