Skip to content

Commit

Permalink
Fix blocking metadata version call (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJulianJES authored Jun 26, 2024
1 parent b658bc1 commit 92eef38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion zigpy_znp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
if typing.TYPE_CHECKING:
import typing_extensions

LIB_VERSION = importlib.metadata.version("zigpy-znp")
LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -148,7 +149,7 @@ async def _load_network_info(self, *, load_devices=False):
)

network_info = zigpy.state.NetworkInfo(
source=f"zigpy-znp@{importlib.metadata.version('zigpy-znp')}",
source=f"zigpy-znp@{LIB_VERSION}",
extended_pan_id=nib.extendedPANID,
pan_id=nib.nwkPanId,
nwk_update_id=nib.nwkUpdateId,
Expand Down
3 changes: 2 additions & 1 deletion zigpy_znp/tools/network_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from zigpy_znp.tools.common import ClosableFileType, setup_parser, validate_backup_json
from zigpy_znp.zigbee.application import ControllerApplication

LIB_VERSION = importlib.metadata.version("zigpy-znp")
LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -84,7 +85,7 @@ async def backup_network(znp: ZNP) -> t.JSONType:

now = datetime.datetime.now().astimezone()

obj["metadata"]["source"] = f"zigpy-znp@{importlib.metadata.version('zigpy-znp')}"
obj["metadata"]["source"] = f"zigpy-znp@{LIB_VERSION}"
obj["metadata"]["internal"] = {
"creation_time": now.isoformat(timespec="seconds"),
"zstack": {
Expand Down

0 comments on commit 92eef38

Please sign in to comment.