sammachin / node-red-matter-bridge

Matter Bridge for Node-RED
10 stars 2 forks source link

Containers Docker/k8s #10

Open Slyke opened 1 week ago

Slyke commented 1 week ago

I'm using nodered/node-red:4.0.5-22 in Kubernetes.

I added this with the palette manager.

Everything seemed fine.

I added a Contact Sensor created a new Bridge, leaving everything as default: image

I noticed it said it needed to be deployed before it could work, but as soon as I deployed, NodeRed started complaining image

image

I can't even remove it from the palette manager without first individually disabling each of the nodes.

Slyke commented 1 week ago

I'm not sure if there's meant to be another "MatterBridge" node, but I don't see it: image

Slyke commented 1 week ago

Logs when trying with Light:

8 Nov 15:46:15 - [info] Started flows
(node:7) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
2024-11-08 15:46:15.614 FATAL  Logger               Unhandled error detected: Behaviors have errors
  at /data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:145:21
  at all (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:399:17)
  at /data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:389:11
  Cause #0: Error initializing a38da780c40fc56d.aggregator.67f5fd802bf4d20b.illuminanceMeasurement
    at crash (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:75:13)
    at [construct] (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:84:7)
    at initializeDeferred (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:85:73)
    at invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:305:26)
    at AsyncConstruction.start (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:86:9)
    at #createBacking (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:424:26)
    at Behaviors.activate (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:259:36)
    at initializeBehaviors (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:136:16)
    at actOffline (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/context/server/OfflineContext.js:53:14)
    at Transaction.act (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/transaction/Tx.js:92:25)
  Caused by: Validating a38da780c40fc56d.aggregator.67f5fd802bf4d20b.illuminanceMeasurement.state.minMeasuredValue: Constraint "1 to maxMeasuredValue1": Value -Infinity is not within bounds defined by constraint (135)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/constraint.js:58:17
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:171:25
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:102:24
    at Object.minMeasuredValue (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/conformance.js:38:22)
    at validateStruct (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:206:23)
    at Object.validate (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/managed/Datasource.js:61:7)
    at finalizeState (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/ServerBacking.js:52:23)
    at ClusterServerBacking.invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/ServerBacking.js:58:5)
    at ClusterServerBacking.invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/ClusterServerBacking.js:80:26)
    at [construct] (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:79:28)
8 Nov 15:46:15 - [red] Uncaught Exception:
8 Nov 15:46:15 - [error] AggregateError: Behaviors have errors
    at /data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:145:21
    at all (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:399:17)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:389:11
Slyke commented 1 week ago

It got into a crash loop when I tried to repeat this. Had to manually delete from node_modules and remove from package.json.

sammachin commented 1 week ago

Hi Slyke,

Looks like you didn't select a network interface for the Bridge to use in the config node,

unfortunatly we can't really make a default for this as different OS's use different interface names, although it is on the list of things to improve.

I should also make sure tahts a required field.

in terms of crashing node-red yes there's some work to do to catch more of that too, but if you do have a problem you can start node-red in safe mode with a --safe command line flag and that will allow you to make changes in the editor but won't start the flows until you deploy

Slyke commented 1 week ago

Install logs (WUI):


-----------------------------------------------------------
2024-11-09T10:28:26.872Z Install : @sammachin/node-red-matter-bridge 0.10.1

2024-11-09T10:28:24.886Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --omit=dev --engine-strict @sammachin/node-red-matter-bridge@0.10.1
2024-11-09T10:28:26.827Z [err] (node:42) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
2024-11-09T10:28:26.827Z [err] (Use `node --trace-warnings ...` to show where the warning was created)
2024-11-09T10:29:48.937Z [out] 
2024-11-09T10:29:48.937Z [out] added 1 package in 1m
2024-11-09T10:29:48.946Z rc=0

Install logs (Nodered logs):

9 Nov 10:29:48 - [info] Installed module: @sammachin/node-red-matter-bridge
9 Nov 10:30:03 - [info] Added node types:
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matterbridge
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matteronofflight
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matteronoffsocket
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matterdimmablelight
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matterfullcolorlight
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:mattercolortemplight
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:mattercontactsensor
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matterlightsensor
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:mattertemperaturesensor
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matteroccupancysensor
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matterpressuresensor
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matterhumiditysensor
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:mattergenericswitch
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matterwindowcovering
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matterthermostat
9 Nov 10:30:03 - [info]  - @sammachin/node-red-matter-bridge:matterdoorlock

When setting up the MatterBridge (Node added to flow, but not yet deployed): image

After deploying and editing the MatterBridge config, network adapter no longer appears: image

Nodered logs (Nodered begins its crash loop at this point):

node:7) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
9 Nov 10:32:28 - [info]

Welcome to Node-RED
===================

9 Nov 10:32:28 - [info] Node-RED version: v4.0.5
9 Nov 10:32:28 - [info] Node.js  version: v22.9.0
9 Nov 10:32:28 - [info] Linux 5.15.0-124-generic x64 LE
9 Nov 10:32:29 - [info] Loading palette nodes
9 Nov 10:32:47 - [info] Dashboard version 3.1.2 started at /ui
9 Nov 10:32:47 - [info] Settings file  : /data/settings.js
9 Nov 10:32:47 - [info] Context store  : 'default' [module=localfilesystem]
9 Nov 10:32:47 - [info] Context store  : 'memoryOnly' [module=memory]
9 Nov 10:32:47 - [info] User directory : /data
9 Nov 10:32:47 - [warn] Projects disabled : editorTheme.projects.enabled=false
9 Nov 10:32:47 - [info] Flows file     : /data/flows.json
9 Nov 10:32:47 - [info] Server now running at http://127.0.0.1:1880/
9 Nov 10:32:47 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

9 Nov 10:32:47 - [info] Starting flows
Loading Bridge node f74d81292a4a9dd6
Trying
Not Starting yet, more devices to load
2024-11-09 10:32:47.905 DEBUG  EventHandler         Set/Restore last event number: 0
2024-11-09 10:32:47.908 INFO   ServerStore          Opened f74d81292a4a9dd6 storage at /usr/src/node-red/.matter/f74d81292a4a9dd6
2024-11-09 10:32:48.034 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 locked f74d81292a4a9dd6.basicInformation.state
2024-11-09 10:32:48.035 WARN   BasicInfor~ionServer Using development values for some BasicInformation attributes: hardwareVersion: 0 softwareVersion: 0
2024-11-09 10:32:48.126 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 locked f74d81292a4a9dd6.accessControl.state
2024-11-09 10:32:48.191 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 locked f74d81292a4a9dd6.groupKeyManagement.state
2024-11-09 10:32:48.235 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 locked f74d81292a4a9dd6.generalCommissioning.state
2024-11-09 10:32:48.260 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 locked f74d81292a4a9dd6.administratorCommissioning.state
2024-11-09 10:32:48.324 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 locked f74d81292a4a9dd6.operationalCredentials.state
2024-11-09 10:32:48.438 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 locked f74d81292a4a9dd6.generalDiagnostics.state
2024-11-09 10:32:48.479 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 locked f74d81292a4a9dd6.network.state
2024-11-09 10:32:48.523 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 locked f74d81292a4a9dd6.descriptor.state
2024-11-09 10:32:48.585 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6>#1 committed and unlocked 9 resources
2024-11-09 10:32:48.591 INFO   Endpoint             f74d81292a4a9dd6 ready endpoint#: 0 type: RootNode (0x16) behaviors: 💤parts ✔index ✔basicInformation ✔accessControl ✔groupKeyManagement ✔generalCommissioning ✔administratorCommissioning ✔operationalCredentials ✔generalDiagnostics ✔commissioning ✔network 💤productDescription 💤sessions ✔descriptor
2024-11-09 10:32:48.593 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.commissioning.#initializeNode>#5 locked f74d81292a4a9dd6.commissioning.state
2024-11-09 10:32:48.594 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.commissioning.#initializeNode>#5 committed and unlocked 1 resource
Bridge Created, awaiting child nodes
Server Ready
2024-11-09 10:32:48.603 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6.aggregator>#9 locked f74d81292a4a9dd6.aggregator.descriptor.state
2024-11-09 10:32:48.604 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.descriptor.#updatePartsList>#a locked f74d81292a4a9dd6.descriptor.state
2024-11-09 10:32:48.607 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.descriptor.#updatePartsList>#a committed and unlocked 1 resource
2024-11-09 10:32:48.611 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6.aggregator>#9 committed and unlocked 1 resource
2024-11-09 10:32:48.765 INFO   Endpoint             f74d81292a4a9dd6.aggregator ready endpoint#: 1 type: Aggregator (0xe) behaviors: 💤parts ✔index ✔descriptor
Loading Device node 86006ea6047a9ebe
Registering Child......
Registering 86006ea6047a9ebe with f74d81292a4a9dd6
adding device to aggregator
Trying
Starting Bridge
2024-11-09 10:32:48.803 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6.aggregator.86006ea6047a9ebe>#18 locked f74d81292a4a9dd6.aggregator.86006ea6047a9ebe.identify.state
2024-11-09 10:32:48.909 NOTICE Node                 f74d81292a4a9dd6 going online
2024-11-09 10:32:48.912 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6.aggregator.86006ea6047a9ebe>#18 locked f74d81292a4a9dd6.aggregator.86006ea6047a9ebe.descriptor.state
2024-11-09 10:32:48.918 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.descriptor.#updatePartsList>#19 locked f74d81292a4a9dd6.descriptor.state
2024-11-09 10:32:48.918 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.aggregator.descriptor.#updatePartsList>#1a locked f74d81292a4a9dd6.aggregator.descriptor.state
2024-11-09 10:32:48.920 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.descriptor.#updatePartsList>#19 committed and unlocked 1 resource
2024-11-09 10:32:48.920 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.aggregator.descriptor.#updatePartsList>#1a committed and unlocked 1 resource
2024-11-09 10:32:48.921 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.descriptor.#updateDescriptor>#1b locked f74d81292a4a9dd6.descriptor.state
2024-11-09 10:32:48.935 DEBUG  Transaction          Transaction reactor<f74d81292a4a9dd6.descriptor.#updateDescriptor>#1b committed and unlocked 1 resource
2024-11-09 10:32:48.939 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6.aggregator.86006ea6047a9ebe>#18 locked f74d81292a4a9dd6.aggregator.86006ea6047a9ebe.bridgedDeviceBasicInformation.state
2024-11-09 10:32:48.946 ERROR  Transaction          Rolling back initialize<f74d81292a4a9dd6.aggregator.86006ea6047a9ebe>#18 due to error: Behaviors have errors
2024-11-09 10:32:48.946 DEBUG  Transaction          Transaction initialize<f74d81292a4a9dd6.aggregator.86006ea6047a9ebe>#18 rolled back and unlocked 3 resources
9 Nov 10:32:49 - [info] Started flows
(node:7) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
2024-11-09 10:32:49.301 DEBUG  UdpChannelNode       Socket created and bound remoteAddress: undefined:5353 localAddress: 0.0.0.0:5353
2024-11-09 10:32:49.303 DEBUG  UdpChannelNode       Initialize multicast address: 10.244.0.13:5353 interface: eth0 type: udp4
2024-11-09 10:32:49.303 DEBUG  UdpChannelNode       Socket created and bound remoteAddress: undefined:5353 localAddress: :::5353
2024-11-09 10:32:49.304 DEBUG  UdpChannelNode       Initialize multicast address: ::%eth0:5353 interface: eth0 type: udp6
2024-11-09 10:32:49.305 DEBUG  UdpChannelNode       Socket created and bound remoteAddress: undefined:5353 localAddress: 0.0.0.0:5353
2024-11-09 10:32:49.305 DEBUG  UdpChannelNode       Initialize multicast address: 10.244.0.13:5353 interface: eth0 type: udp4
2024-11-09 10:32:49.305 DEBUG  UdpChannelNode       Socket created and bound remoteAddress: undefined:5353 localAddress: :::5353
2024-11-09 10:32:49.305 DEBUG  UdpChannelNode       Initialize multicast address: ::%eth0:5353 interface: eth0 type: udp6
2024-11-09 10:32:49.313 DEBUG  Transaction          Transaction start-network#29 locked f74d81292a4a9dd6.productDescription.state
2024-11-09 10:32:49.318 DEBUG  Transaction          Transaction start-network#29 committed and unlocked 1 resource
2024-11-09 10:32:49.326 DEBUG  UdpChannelNode       Socket created and bound remoteAddress: undefined:5540 localAddress: :::5540
2024-11-09 10:32:49.327 DEBUG  Transaction          Transaction set<f74d81292a4a9dd6>#2c locked f74d81292a4a9dd6.network.state
2024-11-09 10:32:49.329 DEBUG  Transaction          Transaction set<f74d81292a4a9dd6>#2c committed and unlocked 1 resource
2024-11-09 10:32:49.329 DEBUG  UdpChannelNode       Socket created and bound remoteAddress: undefined:5540 localAddress: 0.0.0.0:5540
2024-11-09 10:32:49.330 DEBUG  Transaction          Transaction set<f74d81292a4a9dd6>#2d locked f74d81292a4a9dd6.network.state
2024-11-09 10:32:49.331 DEBUG  Transaction          Transaction set<f74d81292a4a9dd6>#2d committed and unlocked 1 resource
2024-11-09 10:32:49.335 FATAL  Logger               Unhandled error detected: Behaviors have errors
  at /data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:145:21
  at all (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:399:17)
  at /data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:389:11
  Cause #0: Error initializing f74d81292a4a9dd6.aggregator.86006ea6047a9ebe.illuminanceMeasurement
    at crash (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:75:13)
    at [construct] (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:84:7)
    at initializeDeferred (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:85:73)
    at invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:305:26)
    at AsyncConstruction.start (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:86:9)
    at #createBacking (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:424:26)
    at Behaviors.activate (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:259:36)
    at initializeBehaviors (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:136:16)
    at actOffline (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/context/server/OfflineContext.js:53:14)
    at Transaction.act (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/transaction/Tx.js:92:25)
  Caused by: Validating f74d81292a4a9dd6.aggregator.86006ea6047a9ebe.illuminanceMeasurement.state.minMeasuredValue: Constraint "1 to maxMeasuredValue1": Value -Infinity is not within bounds defined by constraint (135)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/constraint.js:58:17
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:171:25
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:102:24
    at Object.minMeasuredValue (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/conformance.js:38:22)
    at validateStruct (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:206:23)
    at Object.validate (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/managed/Datasource.js:61:7)
    at finalizeState (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/ServerBacking.js:52:23)
    at ClusterServerBacking.invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/ServerBacking.js:58:5)
    at ClusterServerBacking.invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/ClusterServerBacking.js:80:26)
    at [construct] (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:79:28)
9 Nov 10:32:49 - [red] Uncaught Exception:
9 Nov 10:32:49 - [error] AggregateError: Behaviors have errors
    at /data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:145:21
    at all (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:399:17)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:389:11
sammachin commented 1 week ago

@Slyke how are you running node-red and on what operating system? Is this docker?

It looks like its not persisting the network interface for some reason.

Slyke commented 1 week ago

It's running on my Kubernetes cluster (using containerd, not Docker).

This was run inside the instance:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0@if100: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1450 qdisc noqueue state UP
    link/ether c6:ca:be:54:34:c2 brd ff:ff:ff:ff:ff:ff
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:38:05Z", GoVersion:"go1.17.7", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:32:02Z", GoVersion:"go1.17.7", Compiler:"gc", Platform:"linux/amd64"}

When running from Docker in WSL2 Windows:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
93: eth0@if94: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP 
    link/ether 02:42:ac:11:00:03 brd ff:ff:ff:ff:ff:ff

I've been messing around with it for a few hours now, and I'm not sure why, but disabling IPv6 in Flannel config seems to have stopped it from erroring. I never configured the pod or service to get an IPv6 address and not sure why it matter as the pod is in its own isolated network. Issue is I need IPv6 as I run a Matter controller and a Thread network from the cluster too. Very confusing. This might be a problem with MatterJS itself.

Slyke commented 1 week ago

Actually the network adapter still shows up even when re-enabling IPv6 again, I think I have the cause:

Bridge Restarted
9 Nov 16:53:41 - [info] Connection is closed.
9 Nov 16:53:41 - [info] Stopped flows
9 Nov 16:53:41 - [info] Updated flows
9 Nov 16:53:41 - [info] Starting flows
Loading Bridge node 8d060c95b75d29e8
Trying
Not Starting yet, more devices to load
9 Nov 16:53:41 - [error] [mqtt in:9b7b9a79.fed2a8] missing broker configuration
2024-11-09 16:53:41.184 DEBUG  EventHandler         Set/Restore last event number: 2
2024-11-09 16:53:41.186 INFO   ServerStore          Opened 8d060c95b75d29e8 storage at /usr/src/node-red/.matter/8d060c95b75d29e8
2024-11-09 16:53:41.188 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8>#34 locked 8d060c95b75d29e8.basicInformation.state
2024-11-09 16:53:41.188 WARN   BasicInfor~ionServer Using development values for some BasicInformation attributes: hardwareVersion: 0 softwareVersion: 0
2024-11-09 16:53:41.195 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8>#34 locked 8d060c95b75d29e8.accessControl.state
2024-11-09 16:53:41.197 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8>#34 locked 8d060c95b75d29e8.groupKeyManagement.state
2024-11-09 16:53:41.204 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8>#34 locked 8d060c95b75d29e8.generalCommissioning.state
2024-11-09 16:53:41.209 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8>#34 locked 8d060c95b75d29e8.administratorCommissioning.state
2024-11-09 16:53:41.210 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8>#34 locked 8d060c95b75d29e8.operationalCredentials.state
2024-11-09 16:53:41.224 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8>#34 locked 8d060c95b75d29e8.generalDiagnostics.state
2024-11-09 16:53:41.228 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8>#34 locked 8d060c95b75d29e8.descriptor.state
9 Nov 16:53:41 - [error] [mqtt out:33f7ea7749f10233] missing broker configuration
2024-11-09 16:53:41.242 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8>#34 committed and unlocked 8 resources
2024-11-09 16:53:41.252 INFO   Endpoint             8d060c95b75d29e8 ready endpoint#: 0 type: RootNode (0x16) behaviors: 💤parts ✔index ✔basicInformation ✔accessControl ✔groupKeyManagement ✔generalCommissioning ✔administratorCommissioning ✔operationalCredentials ✔generalDiagnostics ✔commissioning ✔network 💤productDescription 💤sessions ✔descriptor
2024-11-09 16:53:41.254 DEBUG  Transaction          Transaction reactor<8d060c95b75d29e8.commissioning.#initializeNode>#38 locked 8d060c95b75d29e8.commissioning.state
2024-11-09 16:53:41.254 DEBUG  Transaction          Transaction reactor<8d060c95b75d29e8.commissioning.#initializeNode>#38 committed and unlocked 1 resource
9 Nov 16:53:41 - [error] [mqtt in:6bdf8b98596352ca] missing broker configuration
Bridge Created, awaiting child nodes
Server Ready
Loading Device node 1e63924afda59406
Registering Child......
Registering 1e63924afda59406 with 8d060c95b75d29e8
adding device to aggregator
Trying
Starting Bridge
2024-11-09 16:53:41.358 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8.aggregator>#3c locked 8d060c95b75d29e8.aggregator.descriptor.state
2024-11-09 16:53:41.359 NOTICE Node                 8d060c95b75d29e8 going online
2024-11-09 16:53:41.362 DEBUG  Transaction          Transaction reactor<8d060c95b75d29e8.descriptor.#updatePartsList>#3d locked 8d060c95b75d29e8.descriptor.state
2024-11-09 16:53:41.365 DEBUG  Transaction          Transaction reactor<8d060c95b75d29e8.descriptor.#updatePartsList>#3d committed and unlocked 1 resource
2024-11-09 16:53:41.367 DEBUG  Transaction          Transaction start-network#3e locked 8d060c95b75d29e8.productDescription.state
2024-11-09 16:53:41.367 DEBUG  Transaction          Transaction start-network#3e committed and unlocked 1 resource
2024-11-09 16:53:41.372 DEBUG  Transaction          Transaction initialize<8d060c95b75d29e8.aggregator>#3c committed and unlocked 1 resource
2024-11-09 16:53:41.377 INFO   Endpoint             8d060c95b75d29e8.aggregator ready endpoint#: 1 type: Aggregator (0xe) behaviors: 💤parts ✔index ✔descriptor
9 Nov 16:53:41 - [info] Started flows
2024-11-09 16:53:41.717 DEBUG  UdpChannelNode       Socket created and bound remoteAddress: undefined:5540 localAddress: :::5540
2024-11-09 16:53:41.718 DEBUG  Transaction          Transaction set<8d060c95b75d29e8>#4c locked 8d060c95b75d29e8.network.state
2024-11-09 16:53:41.718 DEBUG  Transaction          Transaction set<8d060c95b75d29e8>#4c committed and unlocked 1 resource
2024-11-09 16:53:41.719 DEBUG  UdpChannelNode       Socket created and bound remoteAddress: undefined:5540 localAddress: 0.0.0.0:5540
2024-11-09 16:53:41.719 DEBUG  Transaction          Transaction set<8d060c95b75d29e8>#4d locked 8d060c95b75d29e8.network.state
2024-11-09 16:53:41.720 DEBUG  Transaction          Transaction set<8d060c95b75d29e8>#4d committed and unlocked 1 resource
2024-11-09 16:53:41.720 FATAL  Logger               Unhandled error detected: You may not use add() here because aggregator is not installed in a Node
  at Endpoint.add (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/Endpoint.js:335:13)
  at MatterBridge.<anonymous> (/data/node_modules/@sammachin/node-red-matter-bridge/bridge.js:186:29)
  at MatterBridge.emit (node:events:519:28)
  at Node.emit (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:192:20)
  at waitforserver (/data/node_modules/@sammachin/node-red-matter-bridge/fullcolorlight.js:161:29)
  at new MatterFullColorLight (/data/node_modules/@sammachin/node-red-matter-bridge/fullcolorlight.js:164:9)
  at Object.createNode (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/util.js:190:27)
  at Flow.start (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:261:54)
  at async start (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/index.js:403:17)
9 Nov 16:53:41 - [red] Uncaught Exception:
9 Nov 16:53:41 - [error] Error: You may not use add() here because aggregator is not installed in a Node
    at Endpoint.add (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/Endpoint.js:335:13)
    at MatterBridge.<anonymous> (/data/node_modules/@sammachin/node-red-matter-bridge/bridge.js:186:29)
    at MatterBridge.emit (node:events:519:28)
    at Node.emit (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:192:20)
    at waitforserver (/data/node_modules/@sammachin/node-red-matter-bridge/fullcolorlight.js:161:29)
    at new MatterFullColorLight (/data/node_modules/@sammachin/node-red-matter-bridge/fullcolorlight.js:164:9)
    at Object.createNode (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/util.js:190:27)
    at Flow.start (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:261:54)
    at async start (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/index.js:403:17)

This error occurs when deploying.

Slyke commented 1 week ago

I have reproduced this error on a fresh Raspberry Pi 5. Here's a docker-compose.yml file:

services:
  nodered:
    image: nodered/node-red:4.0.5-22
    user: "0"
    container_name: nodered
    restart: unless-stopped
    network_mode: host
    volumes:
    - ./volumes/nodered/data:/data

Just install the addon from the palette menu and try to deploy.

Welcome to Node-RED

===================

10 Nov 14:35:02 - [info] Node-RED version: v4.0.5
10 Nov 14:35:02 - [info] Node.js  version: v22.9.0
10 Nov 14:35:02 - [info] Linux 6.6.51+rpt-rpi-2712 arm64 LE
10 Nov 14:35:02 - [info] Loading palette nodes
(node:7) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
10 Nov 14:35:06 - [info] node-red-contrib-home-assistant-websocket v0.74.2 nodes initialized
10 Nov 14:35:06 - [info] Settings file  : /data/settings.js
10 Nov 14:35:06 - [info] Context store  : 'default' [module=memory]
10 Nov 14:35:06 - [info] User directory : /data
10 Nov 14:35:06 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 Nov 14:35:06 - [info] Flows file     : /data/flows.json
10 Nov 14:35:06 - [info] Server now running at http://127.0.0.1:1880/
10 Nov 14:35:06 - [warn] 

---------------------------------------------------------------------

Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

---------------------------------------------------------------------

10 Nov 14:35:06 - [info] Starting flows
Loading Bridge node bf962a040f9e1c9b
Trying
Not Starting yet, more devices to load
Loading Device node d1055afe78be6288
10 Nov 14:35:06 - [info] Started flows
Bridge Created, awaiting child nodes

Server Ready
Registering Child......
Registering d1055afe78be6288 with bf962a040f9e1c9b
adding device to aggregator
Trying
Starting Bridge
2024-11-10 14:35:07.332 ERROR  Transaction          Rolling back initialize<bf962a040f9e1c9b.aggregator.d1055afe78be6288>#1c due to error: Behaviors have errors
2024-11-10 14:35:07.362 FATAL  Logger               Unhandled error detected: Behaviors have errors
  at /data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:145:21
  at all (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:399:17)
  at /data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:389:11
  at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
  Cause #0: Error initializing bf962a040f9e1c9b.aggregator.d1055afe78be6288.illuminanceMeasurement
    at crash (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:75:13)
    at [construct] (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:84:7)
    at initializeDeferred (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:85:73)
    at invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:305:26)
    at AsyncConstruction.start (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:86:9)
    at #createBacking (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:424:26)
    at Behaviors.activate (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:259:36)
    at initializeBehaviors (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:136:16)
    at actOffline (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/context/server/OfflineContext.js:53:14)
    at Transaction.act (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/transaction/Tx.js:92:25)
  Caused by: Validating bf962a040f9e1c9b.aggregator.d1055afe78be6288.illuminanceMeasurement.state.minMeasuredValue: Constraint "1 to maxMeasuredValue1": Value -Infinity is not within bounds defined by constraint (135)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/constraint.js:58:17
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:171:25
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:102:24
    at Object.minMeasuredValue (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/conformance.js:38:22)
    at validateStruct (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:206:23)
    at Object.validate (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/managed/Datasource.js:61:7)
    at finalizeState (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/ServerBacking.js:52:23)
    at ClusterServerBacking.invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/ServerBacking.js:58:5)
    at ClusterServerBacking.invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/ClusterServerBacking.js:80:26)
    at [construct] (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:79:28)
10 Nov 14:35:07 - [red] Uncaught Exception:
10 Nov 14:35:07 - [error] AggregateError: Behaviors have errors
    at /data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:145:21
    at all (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:399:17)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:389:11
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
sammachin commented 6 days ago

Hi @Slyke I've not fogottton about this just havn't had much time to look at things this week,

I suspect you will have issues with running a Matter device inside Docker/K8s as Matter relies on DNS-SD to discover the devices. You would likely need to have the interface bridged to the same network as your Matter controller for it to work, I'm not sure if/how you can bridge in k8s.

however the error in your latest post doesn't look network related, it seems like its failing to validate some settings for the light sensor. I've spotted the bug and its fixed on main will be in the next release this weekend, but for now if you change the minLevel to 1 instead of 0 then it should start (or throw network errors)

Slyke commented 5 days ago

Hey, yep, that was another issue I was tackling. I think I have it working in Kubernetes with some issues (still fighting some IPv6 stuff with CoreDNS and TechnitiumDNS split horizon - it has been a rabbit hole), but do have it working with Docker on a RPi5 just using Host mode for networking.

It still crashes on both Docker and Kubernetes, but glad to hear you've spotted the bug. The crashing seems to happen with most nodes I've tested, for example mattercontactsensor:

image

2024-11-16 12:31:56.061 ERROR  Transaction          Rolling back initialize<f72f11c735059bac>#1 due to error: Behaviors have errors
2024-11-16 12:31:56.066 FATAL  Logger               Unhandled error detected: Behaviors have errors
  at /data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:145:21
  at all (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:399:17)
  at /data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:389:11
  Cause #0: Error initializing f72f11c735059bac.accessControl
    at crash (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:75:13)
    at [construct] (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:84:7)
    at initializeDeferred (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:85:73)
    at invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:305:26)
    at AsyncConstruction.start (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:86:9)
    at #createBacking (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:424:26)
    at Behaviors.activate (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:259:36)
    at initializeBehaviors (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:136:16)
    at actOffline (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/context/server/OfflineContext.js:53:14)
    at Transaction.act (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/transaction/Tx.js:92:25)
  Caused by: Validating f72f11c735059bac.accessControl.state.acl.0.subjects.0: Value "18446744060824715265" is not a number or bigint (141)
    at assertNumeric (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/assertions.js:61:9)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:170:5
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/conformance.js:38:22
    at validateEntries (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:249:11)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:259:22
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:102:24
    at Object.subjects (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/conformance.js:38:22)
    at validateStruct (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:206:23)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/conformance.js:38:22
    at validateEntries (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:249:11)
  Cause #1: Error initializing f72f11c735059bac.operationalCredentials
    at crash (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:75:13)
    at [construct] (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/internal/BehaviorBacking.js:84:7)
    at initializeDeferred (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:85:73)
    at invokeInitializer (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:305:26)
    at AsyncConstruction.start (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:86:9)
    at #createBacking (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:424:26)
    at Behaviors.activate (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:259:36)
    at initializeBehaviors (/data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:136:16)
    at actOffline (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/context/server/OfflineContext.js:53:14)
    at Transaction.act (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/transaction/Tx.js:92:25)
  Caused by: Validating f72f11c735059bac.operationalCredentials.state.fabrics.0.fabricId: Value "9842778807215354858" is not a number or bigint (141)
    at assertNumeric (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/assertions.js:61:9)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:170:5
    at Object.fabricId (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/conformance.js:38:22)
    at validateStruct (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:206:23)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/conformance.js:38:22
    at validateEntries (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:249:11)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:259:22
    at Object.fabrics (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/conformance.js:38:22)
    at validateStruct (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/validation/ValueValidator.js:206:23)
    at Object.validate (/data/node_modules/@project-chip/matter.js/dist/cjs/behavior/state/managed/Datasource.js:61:7)
16 Nov 12:31:56 - [red] Uncaught Exception:
16 Nov 12:31:56 - [error] AggregateError: Behaviors have errors
    at /data/node_modules/@project-chip/matter.js/dist/cjs/endpoint/properties/Behaviors.js:145:21
    at all (/data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:399:17)
    at /data/node_modules/@project-chip/matter.js/dist/cjs/util/Construction.js:389:11

This crashing starts happening immediately after commissioning it to Google Home. I haven't tested with Python Matter Server in Home Assistant (or standalone).

sammachin commented 5 days ago

Crash after commisioning is very strange, it won't matter in this case what node's you're using as its the bridge thats commisioned and the errors you are getting are from the ACL between the Bridge and the Admin (controller)

What is the filesystem for the container? the matter nodes currently store details of the fabric in ~/.matter/ so I'm wondering if something there is getting corrupted?

Its on the roadmap to move this storage from the filesystem into Node-RED.

sammachin commented 5 days ago

I've just renamed the issue so we can focus it on tracking issues with running Matter Bridge in containers

Slyke commented 4 days ago

Being stored in ~/.matter/ is probably the issue. While the container runs as root, the ~/.matter/ directory is not mounted and so when the container restarts, the ~/.matter/ won't exist anymore.

sammachin commented 3 days ago

Being stored in ~/.matter/ is probably the issue. While the container runs as root, the ~/.matter/ directory is not mounted and so when the container restarts, the ~/.matter/ won't exist anymore.

Yeah in which case it will need to wait till I've implemeted a storage plugin for matter.js to use the nodes own storage