Coder Social home page Coder Social logo

matter-pi-gpio-commander's Introduction

Matter Pi GPIO Commander

matter-pi-gpio-commander

This small application can turn your Raspberry Pi into a Matter lighting device. Once setup and commissioned, it allows control of a configured GPIO pin via Matter on/off commands. The GPIO output can be used switch an LED or another device via a relay.

The application is based on CHIP's Linux Lighting App example. It used the WiringPi library to control the GPIO of Raspberry Pi.

Usage instructions are available below and on the wiki.

Hardware Compatibility

This snap is expected to work on the following Raspberry Pi hardware:

  • RPi 5 Model B Rev 1.x
  • RPi 4 Model B Rev 1.x
  • RPi 400 Rev 1.x
  • RPi CM4 Rev 1.x
  • RPi 3 Model B Rev 1.x
  • RPi 3 Model B Plus Rev 1.x
  • RPi 3 Model A Plus Rev 1.x
  • RPi CM3 Rev 1.x
  • RPi Zero 2W Rev 1.x

Note: If you have one of the listed hardware, and this snap doesn't work on it, please open an issue.

Install

sudo snap install matter-pi-gpio-commander

Configure

Set the GPIO chip

Starting with v2, the project uses the character device for gpio operations, so it's necessary to configure the chip to be used. The chip number is set to 0 by default.

For example, to set the chip for the /dev/gpiochip4:

sudo snap set matter-pi-gpio-commander gpiochip=4

Currently, the options possible for of chip to be configured are 4 in case of using RPi5 and 0 for all the other legacy arm64 Raspberry Pis.

If for some specific case you want to use a different chip, you can set:

sudo snap set matter-pi-gpio-commander gpiochip-validation=false

Then you can set whathever chip you want.

Set the GPIO line

To set the line 4:

sudo snap set matter-pi-gpio-commander gpio=4

In case of using the v1.x.x make sure to also grant the GPIO access.

Set CLI flags

By default, the lighting app runs as a service without any CLI flags. The snap allows passing flags to the service via the args snap option. This is useful for overriding SDK defaults to customize the application behavior.

To see the list of all flags and SDK default, run the help app:

$ matter-pi-gpio-commander.help
Usage: /snap/matter-pi-gpio-commander/x3/bin/lighting-app [opti

GENERAL OPTIONS

  --ble-device <number>
       The device number for CHIPoBLE, without 'hci' prefix, can be found by hciconfig.

  --wifi
       Enable WiFi management via wpa_supplicant.

  --thread
       Enable Thread management via ot-agent.

  ...

For example, to set Passcode for commissioning:

sudo snap set matter-pi-gpio-commander args="--passcode 1234"

For enabling Thread management:

sudo snap set matter-pi-gpio-commander args="--thread"

Note
For Thread management, the application needs to have access to the OpenThread Border Router (OTBR) agent via DBus. When using the OTBR Snap, this can be achieved by installing the snap and granting the necessary rights; refer to Thread.

For setting multiple flags, concatenate the arguments and set them together:

sudo snap set matter-pi-gpio-commander args="--thread --ble-device 1"

Grant access

The snap uses interfaces to allow access to external resources. Depending on the use case, you need to "connect" certain interfaces to grant the necessary access.

DNS-SD

The avahi-control is necessary to allow discovery of the application via DNS-SD:

sudo snap connect matter-pi-gpio-commander:avahi-control

Note
To make DNS-SD discovery work, the host also needs to have a running avahi-daemon which can be installed with sudo apt install avahi-daemon.

Note
On Ubuntu Core, the avahi-control interface is not provided by the system. Instead, it depends on the Avahi snap. To use the interface from that snap, run:

sudo snap connect matter-pi-gpio-commander:avahi-control avahi:avahi-control

GPIO

The gpio access is granted using the custom-device, which declares a slot to expose the /dev/gpiochip* device and also a plug to self connect. This interface is auto connected when installing the snap from the Snap Store.

For manual connection:

sudo snap connect matter-pi-gpio-commander:custom-gpio matter-pi-gpio-commander:custom-gpio-dev 

BLE

To allow the device to advertise itself over Bluetooth Low Energy:

sudo snap connect matter-pi-gpio-commander:bluez

Note
BLE advertisement depends on BlueZ which can be installed with sudo apt install bluez.

Note
On Ubuntu Core, the bluez interface is not provided by the system. The interface can instead be consumed from the BlueZ snap:

sudo snap connect matter-pi-gpio-commander:bluez bluez:service

Thread

To allow communication with the OTBR Snap for Thread management, connect the following interface:

sudo snap connect matter-pi-gpio-commander:otbr-dbus-wpan0 \
                  openthread-border-router:dbus-wpan0

Run

sudo snap start matter-pi-gpio-commander

Add --enable to make the service automatically start at boot.

Query and follow the logs:

sudo snap logs -n 100 -f matter-pi-gpio-commander

Control with Chip Tool

For the following examples, we use the Chip Tool snap to commission and control the lighting app.

Commissioning

sudo snap connect chip-tool:avahi-observe
sudo chip-tool pairing onnetwork 110 20202021

where:

  • 110 is the assigned node id
  • 20202021 is the default passcode (pin code) for the lighting app

Command

Switching on/off:

sudo chip-tool onoff toggle 110 1 # toggle is stateless and recommended
sudo chip-tool onoff on 110 1
sudo chip-tool onoff off 110 1

where:

  • onoff is the matter cluster name
  • on/off/toggle is the command name. The toggle command is RECOMMENDED because it is stateless. The lighting app does not synchronize the actual state of devices.
  • 110 is the node id of the lighting app assigned during the commissioning
  • 1 is the endpoint of the configured device

Development

Build:

snapcraft -v

This will download >500MB and requires around 8GB of disk space.

To build for other architectures, customize the architectures field inside the snapcraft.yaml and use snapcraft's Remote build.

Install it as described in the install section by replacing matter-pi-gpio-commander with the locally built snap file name and setting --dangerous flag.

Test Blink

This project includes an app to quickly verify the chosen pin and snap GPIO access control without using a Matter Controller. The app will toggle the output voltage of the pin to high/low periodically.

To use, install the snap and configure the GPIO as explained above. Then, run it via sudo snap run matter-pi-gpio-commander.test-blink snap command or directly:

sudo matter-pi-gpio-commander.test-blink

matter-pi-gpio-commander's People

Contributors

farshidtz avatar locnnil avatar monicaisher avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

matter-pi-gpio-commander's Issues

Separate installation of node and ZAP into a standalone part

The following script could be moved to a new part called nodjs-zap:

# Install NodeJS and ZAP tool for arm builds
if [[ $SNAP_ARCH == "arm64" ]]; then
set -x
mkdir node_js
cd node_js
wget https://nodejs.org/dist/v12.22.12/node-v12.22.12-linux-x64.tar.xz
tar xfvJ node-v12.22.12-linux-x64.tar.xz
cp -rn node-v12.22.12-linux-x64/. /opt/node-v12.22.12-linux-x64/
rm -r node-v12.22.12-linux-x64
rm -rf /opt/node
rm -rf /usr/bin/node
rm -rf /usr/bin/npm
rm -rf /usr/bin/npx
ln -s /opt/node-v12.22.12-linux-x64 /opt/node
ln -s /opt/node/bin/* /usr/bin
cd ..
rm -rf node_js
ZAP_VERSION=v2023.05.22-nightly
mkdir -p /opt/zap-${ZAP_VERSION}
git clone https://github.com/project-chip/zap.git /opt/zap-${ZAP_VERSION}
cd /opt/zap-${ZAP_VERSION}
git checkout -b ${ZAP_VERSION}
npm cache clean --force
npm install -g npm@latest
npm ci
export ZAP_DEVELOPMENT_PATH=/opt/zap-${ZAP_VERSION}
fi

Sync GPIO output with the known state

Sometimes it takes a few toggle commands to turn on the LED. The actual GPIO state is not recorded by the application upon startup.

To manually bring the device state with the stored state in sync: sudo chip-tool onoff on <node-id> 1 && sudo chip-tool onoff off <node-id> 1

build: Error loading zap env file on remote builds

On remote build (using snapcraft remote-build, via Launchpad), the env file created in zap part doesn't get loaded in the lighting part. See the relevant logs below:

Remote build:

:: + echo 'export ZAP_INSTALL_PATH=/build/snapcraft-matter-pi-gpio-commander-dcf72f424a2401ddf9b69c72baccc6c2/parts/zap/build'
...
:: + test -f /root/parts/zap/build/env
:: + cd ../../connectedhomeip/src

On Pi:

+ echo 'export ZAP_INSTALL_PATH=/root/parts/zap/build'                                                                                              
...                                                                                                        
:: + test -f /root/parts/zap/build/env                                                                                                                 
:: + source /root/parts/zap/build/env                                                                                                                  
:: ++ export ZAP_INSTALL_PATH=/root/parts/zap/build                                                                                                    
:: ++ ZAP_INSTALL_PATH=/root/parts/zap/build                                                                                                           
:: + cd ../../connectedhomeip/src

The remote builds use the destructive mode, i.e. building directly on the host. The difference in paths appears related to that.

Originally posted by @farshidtz in #29 (comment)

Compatibility problems on `ARM64` builds

The build of main branch is failing on arm64.

As showed in this action run:

Something made it incompatible with the upstream chip project, similar to what happens on #43.

The errors:

:: [69/639] ACTION //third_party/connectedhomeip/examples/lighting-app/lighting-common:lighting-common_codegen_generate(//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc)
:: [70/639] ACTION //third_party/connectedhomeip/examples/lighting-app/lighting-common:lighting-common_zapgen_generate(//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc)
:: FAILED: gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zapgen/zap-generated/access.h gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zapgen/zap-generated/gen_config.h gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zapgen/zap-generated/endpoint_config.h gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zapgen/zap-generated/IMClusterCommandHandler.cpp
:: python ../../third_party/connectedhomeip/third_party/pigweed/repo/pw_build/py/pw_build/python_runner.py --gn-root ../../ --current-path ../../third_party/connectedhomeip/examples/lighting-app/lighting-common --default-toolchain=//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc --current-toolchain=//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc --capture-output --python-dep-list-files gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/lighting-common_zapgen_generate_metadata_path_list.txt -- ../../third_party/connectedhomeip/scripts/tools/zap/generate.py --no-prettify-output --templates /root/parts/connectedhomeip/src/examples/lighting-app/linux/third_party/connectedhomeip/src/app/zap-templates/app-templates.json --output-dir /root/parts/connectedhomeip/src/examples/lighting-app/linux/out/build/gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zapgen/zap-generated --lock-file /root/parts/connectedhomeip/src/examples/lighting-app/linux/out/build/zap_gen.lock --parallel /root/parts/connectedhomeip/src/examples/lighting-app/linux/third_party/connectedhomeip/examples/lighting-app/lighting-common/lighting-app.zap
:: Searching for zcl file from /root/parts/connectedhomeip/src/examples/lighting-app/linux/third_party/connectedhomeip/examples/lighting-app/lighting-common/lighting-app.zap
:: Checking ZAP from ['/root/parts/zap/build/zap-cli']:
::   !!! Version validation failed: required at least 2024.3.14, got 2024.1.5 instead
:: [71/639] stamp obj/third_party/connectedhomeip/examples/lighting-app/lighting-common/lighting-common_codegen_generate.stamp
:: [72/639] ar openthread.a

AppArmor denial for dac_read_search

I receive the following denial when running the test-blink on the v2.0.0 of the snap:

= AppArmor =
Time: Feb 22 15:33:57
Log: apparmor="DENIED" operation="capable" profile="snap.matter-pi-gpio-commander.test-blink" pid=1961 comm="load-snap-optio" capability=2  capname="dac_read_search"
Capability: dac_read_search
Suggestions:
* adjust program to not require 'CAP_DAC_READ_SEARCH' (see 'man 7 capabilities')
* add one of 'microstack-support, system-backup' to 'plugs'
* do nothing if program otherwise works properly

It doesn't affect the functionality.

Missing zap-cli fails arm64 builds

The arm64 build of v1.1.0.1 fails with the following error:

:: [33/555] ACTION //third_party/connectedhomeip/examples/lighting-app/lighting-common:lighting-common_zapgen_zap_pregen(//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc)
:: FAILED: gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zap_pregen/zap-generated/access.h gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zap_pregen/zap-generated/gen_config.h gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zap_pregen/zap-generated/endpoint_config.h gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zap_pregen/zap-generated/CHIPClientCallbacks.h gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zap_pregen/zap-generated/CHIPClusters.h gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zap_pregen/zap-generated/IMClusterCommandHandler.cpp
:: python ../../third_party/connectedhomeip/third_party/pigweed/repo/pw_build/py/pw_build/python_runner.py --gn-root ../../ --current-path ../../third_party/connectedhomeip/examples/lighting-app/lighting-common --default-toolchain=//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc --current-toolchain=//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc --capture-output --python-dep-list-files gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/lighting-common_zapgen_zap_pregen_metadata_path_list.txt -- ../../third_party/connectedhomeip/scripts/tools/zap/generate.py --no-prettify-output --templates /build/snapcraft-matter-pi-gpio-commander-28bfd9faac2be3cc31a04dd4da83a95d/parts/connectedhomeip/src/examples/lighting-app/linux/third_party/connectedhomeip/src/app/zap-templates/app-templates.json --output-dir /build/snapcraft-matter-pi-gpio-commander-28bfd9faac2be3cc31a04dd4da83a95d/parts/connectedhomeip/src/examples/lighting-app/linux/out/build/gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zap_pregen/zap-generated --lock-file /build/snapcraft-matter-pi-gpio-commander-28bfd9faac2be3cc31a04dd4da83a95d/parts/connectedhomeip/src/examples/lighting-app/linux/out/build/zap_gen.lock --parallel /build/snapcraft-matter-pi-gpio-commander-28bfd9faac2be3cc31a04dd4da83a95d/parts/connectedhomeip/src/examples/lighting-app/linux/third_party/connectedhomeip/examples/lighting-app/lighting-common/lighting-app.zap
:: Searching for zcl file from /build/snapcraft-matter-pi-gpio-commander-28bfd9faac2be3cc31a04dd4da83a95d/parts/connectedhomeip/src/examples/lighting-app/linux/third_party/connectedhomeip/examples/lighting-app/lighting-common/lighting-app.zap
:: FAILED TO EXECUTE ZAP GENERATION: No such file or directory - "zap-cli"
:: ********************************************************************************
:: * You may need to install zap. Please ensure one of these applies:
:: * - `zap-cli` is in $PATH. Install from https://github.com/project-chip/zap/releases
:: *   see docs/guides/BUILDING.md for details
:: * - `zap-cli` is in $ZAP_INSTALL_PATH. Use this option if you
:: *   installed zap but do not want to update $PATH
:: * - Point $ZAP_DEVELOPMENT_PATH to your local copy of zap that you
:: *   develop on (to use a developer build of zap)
:: ********************************************************************************
:: [34/555] ACTION //third_party/connectedhomeip/src/platform/Linux/dbus/bluez:bluez_gen(//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc)
:: [35/555] ACTION //third_party/connectedhomeip/src/platform/Linux/dbus/openthread:openthread_gen(//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc)
:: [36/555] ACTION //third_party/connectedhomeip/src/platform/Linux/dbus/wpa:wpa_gen(//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc)
:: [37/555] ACTION //third_party/connectedhomeip/src/platform/Linux/dbus/wpa:wpa_gen(//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc)
:: [38/555] ACTION //third_party/connectedhomeip/examples/lighting-app/lighting-common:lighting-common_codegen_codegen(//third_party/connectedhomeip/build/toolchain/linux:linux_arm64_gcc)
:: ninja: build stopped: subcommand failed.

The same issue exists on the chip-tool side, where it utilizes the same version of the Matter SDK: canonical/chip-tool-snap#3

Exception handling for GPIO number conversion

The stoi function is used for converting the value of GPIO environment variable to an integer. When a non-integer is set for the value, the application crashes:

$ sudo snap set matter-pi-gpio-commander gpio=x
$ sudo snap run matter-pi-gpio-commander.lighting
...
[1677659847.179663][14576:14576] CHIP:SVR: Using GPIO x
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
/snap/matter-pi-gpio-commander/x7/bin/run.sh: line 3: 14576 Aborted                 (core dumped) $SNAP/bin/lighting-app $ARGS

The test-blink app has exception handling for stoi :

try
{
gpio = std::stoi(envGPIO);
std::cout << "GPIO: " << gpio << std::endl;
}
catch (std::exception &ex)
{
std::cerr << "Non-integer value for GPIO: " << ex.what() << std::endl;
return 1;
}

Originally posted by @farshidtz in #9 (comment)

Build failing on Launchpad during git clone operation.

Launchpad build log:

[09/Apr/2024:06:15:02 +0000] "CONNECT github.com:443 HTTP/1.1" 200 49427057 "-" "git/2.34.1"
:: + scripts/checkout_submodules.py --shallow --platform linux
:: Checking out: nlassert, nlio, nlunit-test, mbedtls, qrcode, pigweed, openthread, ot-br-posix, cirque, nanopb, ot-stm32, third_party/pybind11/repo, third_party/jsoncpp/repo, editline, third_party/boringssl/repo/src, third_party/libwebsockets/repo, third_party/imgui/repo, perfetto
[09/Apr/2024:06:15:05 +0000] "CONNECT github.com:443 HTTP/1.1" 200 181618 "-" "git/2.34.1"
[09/Apr/2024:06:15:08 +0000] "CONNECT github.com:443 HTTP/1.1" 200 35441910 "-" "git/2.34.1"
[09/Apr/2024:06:15:09 +0000] "CONNECT github.com:443 HTTP/1.1" 200 74164 "-" "git/2.34.1"
[09/Apr/2024:06:15:12 +0000] "CONNECT github.com:443 HTTP/1.1" 200 63656 "-" "git/2.34.1"
[09/Apr/2024:06:15:14 +0000] "CONNECT github.com:443 HTTP/1.1" 200 1728361 "-" "git/2.34.1"
[09/Apr/2024:06:15:15 +0000] "CONNECT github.com:443 HTTP/1.1" 200 208151 "-" "git/2.34.1"
[09/Apr/2024:06:15:18 +0000] "CONNECT github.com:443 HTTP/1.1" 200 16884377 "-" "git/2.34.1"
[09/Apr/2024:06:15:19 +0000] "CONNECT github.com:443 HTTP/1.1" 200 5539059 "-" "git/2.34.1"
[09/Apr/2024:06:15:21 +0000] "CONNECT github.com:443 HTTP/1.1" 200 1266169 "-" "git/2.34.1"
[09/Apr/2024:06:15:23 +0000] "CONNECT github.com:443 HTTP/1.1" 200 582676 "-" "git/2.34.1"
[09/Apr/2024:06:15:24 +0000] "CONNECT github.com:443 HTTP/1.1" 200 578146 "-" "git/2.34.1"
[09/Apr/2024:06:15:25 +0000] "CONNECT github.com:443 HTTP/1.1" 200 530441 "-" "git/2.34.1"
[09/Apr/2024:06:15:27 +0000] "CONNECT github.com:443 HTTP/1.1" 200 8894100 "-" "git/2.34.1"
[09/Apr/2024:06:15:29 +0000] "CONNECT github.com:443 HTTP/1.1" 200 8893760 "-" "git/2.34.1"
[09/Apr/2024:06:15:31 +0000] "CONNECT github.com:443 HTTP/1.1" 200 1069302 "-" "git/2.34.1"
[09/Apr/2024:06:15:33 +0000] "CONNECT github.com:443 HTTP/1.1" 200 22986078 "-" "git/2.34.1"
[09/Apr/2024:06:15:36 +0000] "CONNECT github.com:443 HTTP/1.1" 200 9150416 "-" "git/2.34.1"
[09/Apr/2024:06:15:37 +0000] "CONNECT github.com:443 HTTP/1.1" 200 871582 "-" "git/2.34.1"
[09/Apr/2024:06:15:38 +0000] "CONNECT github.com:443 HTTP/1.1" 200 6755 "-" "git/2.34.1"
[09/Apr/2024:06:15:40 +0000] "CONNECT github.com:443 HTTP/1.1" 200 59004 "-" "git/2.34.1"
[09/Apr/2024:06:15:41 +0000] "CONNECT github.com:443 HTTP/1.1" 200 7511 "-" "git/2.34.1"
[09/Apr/2024:06:15:43 +0000] "CONNECT github.com:443 HTTP/1.1" 200 2581807 "-" "git/2.34.1"
[09/Apr/2024:06:15:45 +0000] "CONNECT github.com:443 HTTP/1.1" 200 12382 "-" "git/2.34.1"
[09/Apr/2024:06:15:46 +0000] "CONNECT github.com:443 HTTP/1.1" 200 120420 "-" "git/2.34.1"
[09/Apr/2024:06:15:48 +0000] "CONNECT github.com:443 HTTP/1.1" 200 12650 "-" "git/2.34.1"
[09/Apr/2024:06:15:49 +0000] "CONNECT github.com:443 HTTP/1.1" 200 83133 "-" "git/2.34.1"
[09/Apr/2024:06:15:50 +0000] "CONNECT github.com:443 HTTP/1.1" 200 34982 "-" "git/2.34.1"
[09/Apr/2024:06:15:52 +0000] "CONNECT github.com:443 HTTP/1.1" 200 1616206 "-" "git/2.34.1"
[09/Apr/2024:06:15:54 +0000] "CONNECT github.com:443 HTTP/1.1" 200 6442 "-" "git/2.34.1"
[09/Apr/2024:06:15:57 +0000] "CONNECT github.com:443 HTTP/1.1" 200 2480747 "-" "git/2.34.1"
[09/Apr/2024:06:15:59 +0000] "CONNECT github.com:443 HTTP/1.1" 200 6444 "-" "git/2.34.1"
[09/Apr/2024:06:16:01 +0000] "CONNECT github.com:443 HTTP/1.1" 200 675437 "-" "git/2.34.1"
[09/Apr/2024:06:16:03 +0000] "CONNECT github.com:443 HTTP/1.1" 200 5905 "-" "git/2.34.1"
[09/Apr/2024:06:16:04 +0000] "CONNECT github.com:443 HTTP/1.1" 200 135952 "-" "git/2.34.1"
[09/Apr/2024:06:16:05 +0000] "CONNECT github.com:443 HTTP/1.1" 200 11820 "-" "git/2.34.1"
[09/Apr/2024:06:16:07 +0000] "CONNECT github.com:443 HTTP/1.1" 200 3267874 "-" "git/2.34.1"
[09/Apr/2024:06:16:09 +0000] "CONNECT github.com:443 HTTP/1.1" 200 5389 "-" "git/2.34.1"
[09/Apr/2024:06:16:12 +0000] "CONNECT github.com:443 HTTP/1.1" 200 404135 "-" "git/2.34.1"
[09/Apr/2024:06:16:14 +0000] "CONNECT github.com:443 HTTP/1.1" 200 11647 "-" "git/2.34.1"
[09/Apr/2024:06:16:15 +0000] "CONNECT github.com:443 HTTP/1.1" 200 203273 "-" "git/2.34.1"
Pulling libgpiod
[09/Apr/2024:06:16:16 +0000] "CONNECT git.kernel.org:9418 HTTP/1.0" 200 56686 "-" "-"
Failed to pull source: command ['git', 'clone', '--recursive', '--branch', 'v2.1', 'git://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git', '/build/matter-pi-gpio-commander/parts/libgpiod/src'] exited with code 128.
Make sure sources are correctly specified.
Full execution log: '/root/.local/state/snapcraft/log/snapcraft-20240409-061345.223713.log'
Build failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 265, in run
    self.pull()
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 205, in pull
    self.run_build_command(
  File "/usr/lib/python3/dist-packages/lpbuildd/target/operation.py", line 62, in run_build_command
    return self.backend.run(args, cwd=cwd, env=full_env, **kwargs)
  File "/usr/lib/python3/dist-packages/lpbuildd/target/lxd.py", line 718, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'lp-jammy-arm64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/lpbuildd-git-proxy', '--env', 'SNAPPY_STORE_NO_CDN=1', '--env', 'SNAPCRAFT_LOCAL_SOURCES=1', '--env', 'SNAPCRAFT_SETUP_CORE=1', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build-request-id": "lp-87860346", "build-request-timestamp": "2024-04-09T06:10:51Z", "build_url": "https://launchpad.net/~build.snapcraft.io/+snap/23e77e65b0e55be1a2f0abd873ad22d8/+build/2445776"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--', '/bin/sh', '-c', 'cd /build/matter-pi-gpio-commander && linux64 snapcraft pull']' returned non-zero exit status 1.
Revoking proxy token...
RUN: /usr/share/launchpad-buildd/bin/in-target scan-for-processes --backend=lxd --series=jammy --arch=arm64 SNAPBUILD-2445776
Scanning for processes to kill in build SNAPBUILD-2445776

Pairing issue with Chip Tool v1.1.0.1

The chip-tool v1.1.0.1 has some difficulties in pairing with the matter-gpio-commander. The log shows a persisted storage error preventing the commissioning discovery over DNS-SD as follows:

CHIP:CTL: Couldn't get ExampleOpCredsCAKey from storage: src/controller/ExamplePersistentStorage.cpp:93: CHIP Error 0x000000A0: Value not found in the persisted storage

Full logs could be find here.

With the same setup as the matter-bridge-tapo-lighting, the chip-tool snapped from the edge channel was able to pair with it without any errors. The full logs can be found here.

chip-tool snap:

$ snap info chip-tool
...
  latest/edge:      v1.0.0.2+snap 2023-03-02 (14) 17MB -
installed:          v1.1.0.1+snap            (x1) 20MB -

$ snap connections chip-tool
Interface      Plug                     Slot            Notes
avahi-observe  chip-tool:avahi-observe  :avahi-observe  manual
bluez          chip-tool:bluez          :bluez          manual
network        chip-tool:network        :network        -

Originally posted by @MonicaisHer in canonical/chip-tool-snap#2 (comment)

SDK incompatibility with the application code

The application code has become incompatible with the SDK some time between Jan 15 (when it was last built) and now.

The build fails with the following errors:

:: [318/602] c++ obj/third_party/connectedhomeip/src/app/clusters/scenes-server/lighting-common.scenes-server.cpp.o
:: FAILED: obj/third_party/connectedhomeip/src/app/clusters/scenes-server/lighting-common.scenes-server.cpp.o
:: aarch64-linux-gnu-g++ -MMD -MF obj/third_party/connectedhomeip/src/app/clusters/scenes-server/lighting-common.scenes-server.cpp.o.d -Wconversion -O0 -g2 -fno-common -ffunction-sections -fdata-sections -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -Wall -Werror -Wextra -Wshadow -Wunreachable-code -Wvla -Wformat -Wformat-nonliteral -Wformat-security -Wundef -Wno-deprecated-declarations -Wno-missing-field-initializers -Wno-unknown-warning-option -Wno-unused-parameter -Wno-cast-function-type -Wno-psabi -Wno-maybe-uninitialized -fdiagnostics-color -fno-strict-aliasing -fmacro-prefix-map=../../third_party/connectedhomeip/= -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -Wno-format-nonliteral -Wno-format-nonliteral -std=gnu++17 -fno-rtti -Wnon-virtual-dtor -DCHIP_HAVE_CONFIG_H=1 -DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=\<lib/address_resolve/AddressResolve_DefaultImpl.h\> -DCHIP_MINMDNS_USE_EPHEMERAL_UNICAST_PORT=1 -DCHIP_MINMDNS_HIGH_VERBOSITY=0 -DCHIP_MINMDNS_DEFAULT_POLICY=1 -I../../third_party/connectedhomeip/zzz_generated/lighting-app -Igen/third_party/connectedhomeip/examples/lighting-app/lighting-common -Igen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zapgen -I../../third_party/connectedhomeip/src/include -I../../third_party/connectedhomeip/src -Igen/include -I../../third_party/connectedhomeip/zzz_generated/app-common -I../../third_party/connectedhomeip/examples/lighting-app/linux/include -I../../third_party/connectedhomeip/config/standalone -I../../third_party/connectedhomeip/third_party/nlassert/repo/include -I../../third_party/connectedhomeip/third_party/nlio/repo/include -I../../third_party/connectedhomeip/third_party/inipp/repo/inipp -I../../third_party/connectedhomeip/src/tracing/perfetto/include -I../../third_party/connectedhomeip/third_party/perfetto/repo/sdk -c ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.cpp -o obj/third_party/connectedhomeip/src/app/clusters/scenes-server/lighting-common.scenes-server.cpp.o
:: In file included from ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.cpp:19:
:: ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.h:38:9: error: ‘EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT’ was not declared in this scope; did you mean ‘EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT’?
::    38 |         EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT;
::       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::       |         EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT
:: ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.h:38:9: note: maximum limit of 1000 namespaces searched for ‘EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT’
:: ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.h:39:49: error: non-constant condition for static assertion
::    39 |     static_assert(kScenesServerMaxEndpointCount <= kEmberInvalidEndpointIndex, "Scenes endpoint count error");
::       |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: In file included from ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.cpp:19:
:: ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.h:69:58: error: size of array ‘mSceneInfoStructs’ is not an integral constant-expression
::    69 |         Structs::SceneInfoStruct::Type mSceneInfoStructs[kScenesServerMaxEndpointCount][kScenesServerMaxFabricCount];
::       |                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.h:70:40: error: size of array ‘mSceneInfoStructsCount’ is not an integral constant-expression
::    70 |         uint8_t mSceneInfoStructsCount[kScenesServerMaxEndpointCount] = { 0 };
::       |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.cpp: In member function ‘CHIP_ERROR chip::app::Clusters::ScenesManagement::ScenesServer::FabricSceneInfo::FindFabricSceneInfoIndex(chip::EndpointId, size_t&)’:
:: ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.cpp:264:78: error: ‘EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT’ was not declared in this scope; did you mean ‘EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT’?
::   264 |         emberAfGetClusterServerEndpointIndex(endpoint, ScenesManagement::Id, EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT);
::       |                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::       |                                                                              EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT
:: ../../third_party/connectedhomeip/src/app/clusters/scenes-server/scenes-server.cpp:264:78: note: maximum limit of 1000 namespaces searched for ‘EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT’
:: At global scope:
:: cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
:: [319/602] c++ obj/BUILD_DIR/gen/third_party/connectedhomeip/examples/lighting-app/lighting-common/zapgen/zap-generated/lighting-common_zapgen.IMClusterCommandHandler.cpp.o
:: [320/602] c++ obj/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server/lighting-common.wifi-network-diagnostics-server.cpp.o
:: ninja: build stopped: subcommand failed.

Workaround:

$ git diff
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 776353f..10a3359 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -54,7 +54,7 @@ parts:
     plugin: nil
     source: https://github.com/project-chip/connectedhomeip.git
     source-depth: 1
-    source-tag: master
+    source-commit: 4676d277af113d6e07e0de235c8ca8b70237109a
     source-submodules: []
     override-pull: |
       craftctl default

Commit project-chip/connectedhomeip@4676d27 is the last one before Jan 15th, but there may be other working commits after that.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/build-and-test-snap.yml
  • actions/checkout v4
  • snapcore/action-build v1
  • actions/setup-go v5
  • actions/upload-artifact v4
  • actions/upload-artifact v4

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.