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

[Fabric-Sync] Simplify and update the fabric sync guide #34993

Merged
merged 5 commits into from
Aug 15, 2024
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
108 changes: 73 additions & 35 deletions docs/guides/fabric_synchronization_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

- [Fabric Synchronization Guide](#fabric-synchronization-guide)
- [Fabric Sync Example Applications](#fabric-sync-example-applications)
- [Run Fabric Sync Demo on RP4](#run-fabric-sync-demo-on-rp4)
- [Bootstrap Fabric Sync Demo on Linux](#bootstrap-fabric-sync-demo-on-linux)
- [Bootstrap Fabric Sync Demo on RP4](#bootstrap-fabric-sync-demo-on-rp4)
- [Run Fabric Sync Demo](#run-fabric-sync-demo)

## Fabric Sync Example Applications

Expand Down Expand Up @@ -38,57 +40,71 @@ enables a seamless and efficient synchronization process.

[Fabric-Bridge](https://github.com/project-chip/connectedhomeip/tree/master/examples/fabric-bridge-app/linux/README.md)

## Run Fabric Sync Demo on RP4
## Bootstrap Fabric Sync Demo on Linux

### Setup Fabric Source
### Start Fabric Synchronization on Ecosystem 1

Connect to the Fabric Source server:
Run the Fabric Synchronization script:

```
ssh ubuntu@xxx.xxx.xxx.xxx
./examples/fabric-admin/scripts/run_fabric_sync.sh
```

Password: <password>
### Start Fabric Synchronization on Ecosystem 2

Run the Fabric Source script:
Run the Fabric Synchronization script:

```
./run_fabric_source.sh
./examples/fabric-admin/scripts/run_fabric_sync.sh
```

### Setup Fabric Sink
## Bootstrap Fabric Sync Demo on RP4

Connect to the Fabric Sink server:
### Start Fabric Synchronization on Ecosystem 1

Connect to the Ecosystem 1 server:

```
ssh ubuntu@xxx.xxx.xxx.xxx
```

Password: <password>

Run the Fabric Sink script:
Run the Fabric Synchronization script:

```
./run_fabric_sink.sh
./run_fabric_sync.sh
```

### Fabric Sync Setup
### Start Fabric Synchronization on Ecosystem 2

Connect to the Ecosystem 2 server:

```
ssh ubuntu@xxx.xxx.xxx.xxx
```

Enable Fabric Auto Sync:
Password: <password>

In Fabric-Sync console:
Run the Fabric Synchronization script:

```
fabricsync enable-auto-sync 1
./run_fabric_sync.sh
```

Pair the Fabric-Source bridge to Fabric-Sync with node ID 1:
## Run Fabric Sync Demo

### Fabric Sync Setup

In Ecosystem 1 Fabric-Admin console:

Pair the Ecosystem 2 bridge to Ecosystem 1 with node ID 2:

```
fabricsync add-bridge 1 <fabric-source-bridge-ip>
fabricsync add-bridge 2 <e2-fabric-bridge-ip>
```

### Pair Light Example to Fabric-Source
### Pair Light Example to Ecosystem 2

Since Fabric-Bridge also functions as a Matter server, running it alongside the
Light Example app on the same machine would cause conflicts. Therefore, you need
Expand All @@ -114,36 +130,54 @@ Pair the Light Example with node ID 3 using its payload number:
pairing already-discovered 3 20202021 <ip> 5540
```

After the Light Example is successfully paired in Fabric-Source, it will be
synced to Fabric-Sink with a new assigned node ID.
After the device is successfully added, you will observe the following on
Ecosystem 2 with the newly assigned Node ID:

```
>>> New device with Node ID: 0x3 has been successfully added.
```

Additionally, you should also get notified when a new device is added to
Ecosystem 2 from the Ecosystem 1:

```
>>> A new device is added on Endpoint 3.
```

### Synchronize Light Example to Ecosystem 1

After the Light Example is successfully paired in Ecosystem 2, we can start to
synchronize the light device to Ecosystem 1 using the new assigned dynamic
endpointid on Ecosystem 2.

```
fabricsync sync-device <endpointid>
```

Toggle the Light Example:

From Fabric-Source:
From Ecosystem 1:

```
onoff on <node-id> 1
onoff off <node-id> 1
```

From Fabric-Sink: (Use the node ID assigned)
From Ecosystem 2: (Use the node ID assigned)

```
onoff on x 1
onoff off x 1
```

### Remove Light Example from Fabric-Source
### Remove Light Example from Ecosystem

Unpair the Light Example:

```
pairing unpair <node-id>
```

After the Light Example is successfully unpaired from Fabric-Source, it will
also be removed from the Fabric-Sink.

### Pair Commercial Switch to Fabric-Source

Pair the switch using its payload number:
Expand All @@ -154,32 +188,36 @@ In Fabric-Source console:
pairing code-wifi <node-id> <ssid> <passwd> <payload>
```

After the switch is successfully paired in Fabric-Source, it will be synced to
Fabric-Sink with a new assigned node ID.
### Synchronize Switch to Ecosystem 1

After the switch is successfully paired in Ecosystem 2, we can start to
synchronize it to Ecosystem 1 using the new assigned dynamic endpointid on
Ecosystem 2..

```
fabricsync sync-device <endpointid>
```

Toggle the switch:

From Fabric-Source:
From Ecosystem 1:

```
onoff on <node-id> 1
onoff off <node-id> 1
```

From Fabric-Sink: (Use the node ID assigned)
From Ecosystem 2: (Use the node ID assigned)

```
onoff on <node-id> 1
onoff off <node-id> 1
```

### Remove Switch from Fabric-Source
### Remove Switch from Ecosystem

Unpair the switch:

```
pairing unpair <node-id>
```

After the switch is successfully unpaired from Fabric-Source, it will also be
removed from the Fabric-Sink.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ CHIP_ERROR FabricAutoSyncCommand::RunCommand(bool enableAutoSync)

// print to console
fprintf(stderr, "Auto Fabric Sync is %s.\n", enableAutoSync ? "enabled" : "disabled");
fprintf(stderr,
"WARNING: The auto-sync command is currently under development and may contain bugs. Use it at your own risk.\n");

return CHIP_NO_ERROR;
}
3 changes: 2 additions & 1 deletion examples/fabric-admin/device_manager/DeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ void DeviceManager::HandleAttributeData(const app::ConcreteDataAttributePath & p
// Process added endpoints
for (const auto & endpoint : addedEndpoints)
{
ChipLogProgress(NotSpecified, "Endpoint added: %u", endpoint);
// print to console
fprintf(stderr, "A new devie is added on Endpoint: %u\n", endpoint);

if (mAutoSyncEnabled)
{
Expand Down
78 changes: 0 additions & 78 deletions examples/fabric-admin/scripts/run_fabric_sink.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ fi
echo "Admin path: $FABRIC_ADMIN_PATH"
echo "Bridge path: $FABRIC_BRIDGE_APP_PATH"

# Determine the path to stop_fabric_source.sh based on the location of run_fabric_source.sh
RUN_FABRIC_SOURCE_PATH=$(find_binary "$SCRIPT_DIR/run_fabric_source.sh")
# Determine the path to stop_fabric_sync.sh based on the location of run_fabric_sync.sh
RUN_FABRIC_SOURCE_PATH=$(find_binary "$SCRIPT_DIR/run_fabric_sync.sh")
if [[ $? -ne 0 ]]; then
echo >&2 "Could not find the run_fabric_source.sh script"
echo >&2 "Could not find the run_fabric_sync.sh script"
exit 1
fi
STOP_FABRIC_SOURCE_PATH="${RUN_FABRIC_SOURCE_PATH/run_fabric_source/stop_fabric_source}"
STOP_FABRIC_SYNC_PATH="${RUN_FABRIC_SOURCE_PATH/run_fabric_sync/stop_fabric_sync}"

# Stop any running instances and clean up
if [[ -e "$STOP_FABRIC_SOURCE_PATH" ]]; then
"$STOP_FABRIC_SOURCE_PATH"
if [[ -e "$STOP_FABRIC_SYNC_PATH" ]]; then
"$STOP_FABRIC_SYNC_PATH"
else
echo >&2 "Could not find the stop_fabric_source.sh script"
echo >&2 "Could not find the stop_fabric_sync.sh script"
exit 1
fi

Expand Down
Loading