canonical / matter-pi-gpio-commander

Matter Raspberry Pi GPIO Commander - Turn your Pi into a Matter lighting device!
Apache License 2.0
90 stars 3 forks source link

Upgrade to use v1.1.0.1 SDK #20

Closed MonicaisHer closed 1 year ago

MonicaisHer commented 1 year ago

This PR might resolve #19

Testing

I have tested the matter-pi-gpio-commander snap built from this PR locally, with the chip-tool snap built from this PR, and they both work as expected using the same version of Matter SDK v1.1.0.1. The matter-pi-gpio-commander snap could be commissioned and controlled by chip-tool snap.

build:

snapcraft -v --debug

install and setup matter-pi-gpio-commander:

sudo snap install ./matter-pi-gpio-commander_0.3.0_arm64.snap --dangerous
sudo snap set matter-pi-gpio-commander gpio=26

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

install and setup chip-tool:

sudo snap install ./chip-tool_v1.1.0.1+snap_arm64.snap --dangerous
sudo snap connect chip-tool:avahi-observe
sudo snap connect chip-tool:bluez

commison and control:

sudo chip-tool pairing onnetwork 110 20202021
sudo chip-tool onoff toggle 110 1

Upon successful execution, the LED on the Pi should be controlled by Chip Tool, turning it on or off.

farshidtz commented 1 year ago

Remote build fails for arm64:

:: + [[ arm64 == \a\r\m\6\4 ]]
:: + ZAP_VERSION=v2023.05.04
:: + set -x
:: + mkdir -p /opt/zap-v2023.05.04
:: + git clone https://github.com/project-chip/zap.git /opt/zap-v2023.05.04
:: Cloning into '/opt/zap-v2023.05.04'...
:: + cd /opt/zap-v2023.05.04
:: + git checkout -b v2023.05.04
:: Switched to a new branch 'v2023.05.04'
:: + npm ci
:: npm WARN tarball tarball data for app-builder-bin@3.7.1 (sha512-ql93vEUq6WsstGXD+SBLSIQw6SNnhbDEM0swzgugytMxLp3rT24Ag/jcC80ZHxiPRTdew1niuR7P3/FCrDqIjw==) seems to be corrupted. Trying one more time.
:: npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/6202/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
::
:: > utf-8-validate@5.0.10 install /opt/zap-v2023.05.04/node_modules/utf-8-validate
:: > node-gyp-build
::
:: make: Entering directory '/opt/zap-v2023.05.04/node_modules/utf-8-validate/build'
::   CC(target) Release/obj.target/validation/src/validation.o
::   SOLINK_MODULE(target) Release/obj.target/validation.node
::   COPY Release/validation.node
:: make: Leaving directory '/opt/zap-v2023.05.04/node_modules/utf-8-validate/build'
::
:: > sqlite3@5.1.4 install /opt/zap-v2023.05.04/node_modules/sqlite3
:: > node-pre-gyp install --fallback-to-build
::
:: [sqlite3] Success: "/opt/zap-v2023.05.04/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-arm64/node_sqlite3.node" is installed via remote
::
:: > core-js@3.27.1 postinstall /opt/zap-v2023.05.04/node_modules/core-js
:: > node -e "try{require('./postinstall')}catch(e){}"
::
[16/Jun/2023:09:36:48 +0000] "CONNECT github.com:443 HTTP/1.1" 200 3772 "-" "-"
:: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
::
:: The project needs your help! Please consider supporting of core-js:
:: > https://opencollective.com/core-js 
:: > https://patreon.com/zloirock 
:: > bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz 
::
:: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
::
::
:: > canvas@2.11.2 install /opt/zap-v2023.05.04/node_modules/canvas
:: > node-pre-gyp install --fallback-to-build --update-binary
::
:: node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v72-linux-glibc-arm64.tar.gz
:: node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@12.22.12 (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
:: node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v72-linux-glibc-arm64.tar.gz
:: Package pangocairo was not found in the pkg-config search path.
:: Perhaps you should add the directory containing `pangocairo.pc'
:: to the PKG_CONFIG_PATH environment variable
:: No package 'pangocairo' found
:: gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
:: gyp ERR! configure error
:: gyp ERR! stack Error: `gyp` failed with exit code: 1
:: gyp ERR! stack     at ChildProcess.onCpExit (/snap/node/6202/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
:: gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
:: gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
:: gyp ERR! System Linux 5.4.0-149-generic
:: gyp ERR! command "/snap/node/6202/bin/node" "/snap/node/6202/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/opt/zap-v2023.05.04/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/opt/zap-v2023.05.04/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
:: gyp ERR! cwd /opt/zap-v2023.05.04/node_modules/canvas
:: gyp ERR! node -v v12.22.12
:: gyp ERR! node-gyp -v v5.1.0
:: gyp ERR! not ok
:: node-pre-gyp ERR! build error
:: node-pre-gyp ERR! stack Error: Failed to execute '/snap/node/6202/bin/node /snap/node/6202/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/opt/zap-v2023.05.04/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/opt/zap-v2023.05.04/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
:: node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/opt/zap-v2023.05.04/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
:: node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
:: node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1022:16)
:: node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
:: node-pre-gyp ERR! System Linux 5.4.0-149-generic
:: node-pre-gyp ERR! command "/snap/node/6202/bin/node" "/opt/zap-v2023.05.04/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
:: node-pre-gyp ERR! cwd /opt/zap-v2023.05.04/node_modules/canvas
:: node-pre-gyp ERR! node -v v12.22.12
:: node-pre-gyp ERR! node-pre-gyp -v v1.0.10
:: node-pre-gyp ERR! not ok
:: Failed to execute '/snap/node/6202/bin/node /snap/node/6202/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/opt/zap-v2023.05.04/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/opt/zap-v2023.05.04/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
:: npm ERR! code ELIFECYCLE
:: npm ERR! errno 1
:: npm ERR! canvas@2.11.2 install: `node-pre-gyp install --fallback-to-build --update-binary`
:: npm ERR! Exit status 1
:: npm ERR!
:: npm ERR! Failed at the canvas@2.11.2 install script.
:: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
::
:: npm ERR! A complete log of this run can be found in:
:: npm ERR!     /root/.npm/_logs/2023-06-16T09_36_50_920Z-debug.log
'override-build' in part 'lighting' failed with code 1.
MonicaisHer commented 1 year ago

The changes on separate parts have been reverted due to building failure on arm64. Node.js and Zap installations need to be separated into a standalone part for better caching and clarity. I have created an issue for this purpose, which can be found https://github.com/canonical/matter-pi-gpio-commander/issues/21.