Skip to content

Commit

Permalink
Fix TuyaQuirkBuilder quirk_file location (#3757)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJulianJES authored Jan 23, 2025
1 parent c00eb01 commit d900f4b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions zhaquirks/tuya/builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

from collections.abc import Callable
from enum import Enum
import inspect
import math
import pathlib
from types import FrameType
from typing import Any, Optional

from zigpy.quirks import _DEVICE_REGISTRY
Expand Down Expand Up @@ -185,6 +188,12 @@ def __init__(
self.tuya_dp_to_attribute: dict[int, DPToAttributeMapping] = {}
self.new_attributes: set[foundation.ZCLAttributeDef] = set()
super().__init__(manufacturer, model, registry)
# quirk_file will point to the init call above if called from this QuirkBuilder,
# so we need to re-set it correctly
current_frame: FrameType = inspect.currentframe()
caller: FrameType = current_frame.f_back
self.quirk_file = pathlib.Path(caller.f_code.co_filename)
self.quirk_file_line = caller.f_lineno

def _tuya_battery(
self,
Expand Down

0 comments on commit d900f4b

Please sign in to comment.