Skip to content
Merged
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
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')}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we don't really need to replace this in the old CLI tools, but I guess it also doesn't hurt..

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