Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix zap-gui and add zap-install #579

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions scripts/west/west-commands.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Keep the help strings in sync with the values in the .py files!
west-commands:
- file: scripts/west/zap_install.py
commands:
- name: zap-install
class: ZapInstall
help: Install Matter ZCL Advanced Platform (ZAP) GUI
- file: scripts/west/zap_generate.py
commands:
- name: zap-generate
Expand Down
4 changes: 4 additions & 0 deletions scripts/west/zap_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def do_run(self, args, unknown_args):
zap_file_path = args.zap_file or find_zap()
zcl_json_path = Path(args.zcl_json).absolute() if args.zcl_json else default_zcl_path

if zap_file_path is None:
log.err("ZAP file not found!")
return

if args.clusters:
# If the user provided the clusters and the zcl.json file provided by -j argument does not exist
# we will create a new zcl.json file according to the base zcl.json file in default_zcl_path.
Expand Down
35 changes: 35 additions & 0 deletions scripts/west/zap_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

import argparse
from textwrap import dedent
from west.commands import WestCommand
from zap_common import existing_dir_path, ZapInstaller, DEFAULT_MATTER_PATH


class ZapInstall(WestCommand):

def __init__(self):
super().__init__(
'zap-install',
'Install Matter ZCL Advanced Platform (ZAP) GUI',
dedent('''
Install Matter ZCL Advanced Platform (ZAP) GUI.

The ZAP GUI in a node.js tool for configuring the data model
of a Matter application, which defines clusters, commands,
attributes and events enabled for the given application.'''))

def do_add_parser(self, parser_adder):
parser = parser_adder.add_parser(self.name,
help=self.help,
formatter_class=argparse.RawDescriptionHelpFormatter,
description=self.description)
parser.add_argument('-m', '--matter-path', type=existing_dir_path,
default=DEFAULT_MATTER_PATH, help=f'Path to Matter SDK. Default is set to {DEFAULT_MATTER_PATH}')
return parser

def do_run(self, args, unknown_args):
zap_installer = ZapInstaller(args.matter_path)
zap_installer.update_zap_if_needed()
Loading