diff --git a/src-admin/src/components/Bridges.js b/src-admin/src/components/Bridges.js index 99ef2baf..e30f13c5 100644 --- a/src-admin/src/components/Bridges.js +++ b/src-admin/src/components/Bridges.js @@ -15,7 +15,7 @@ import { } from '@mui/material'; import { Add, - Close, + Close, ConnectWithoutContact, ContentCopy, Delete, Edit, @@ -28,7 +28,7 @@ import { UnfoldMore, } from '@mui/icons-material'; -import {I18n, Utils} from '@iobroker/adapter-react-v5'; +import { I18n, Utils } from '@iobroker/adapter-react-v5'; import DeviceDialog, { DEVICE_ICONS } from '../DeviceDialog'; import { getText } from '../Utils'; @@ -74,7 +74,7 @@ const styles = () => ({ cursor: 'pointer', display: 'flex', alignItems: 'center', - } + }, }); class Bridges extends React.Component { @@ -440,12 +440,40 @@ class Bridges extends React.Component { ; } + renderDebugDialog() { + if (!this.state.showDebugData) { + return null; + } + return this.setState({ showDebugData: null })} + open={!0} + maxWidth="md" + > + {I18n.t('QR Code to connect ')} + +
+                    {JSON.stringify(this.props.nodeStates[this.state.showDebugData.uuid], null, 2)}
+                
+
+ + + +
; + } + renderStatus(bridge) { if (!this.props.nodeStates[bridge.uuid]) { return null; } if (this.props.nodeStates[bridge.uuid].command === 'showQRCode') { - return + return this.setState({ showQrCode: bridge })} @@ -454,6 +482,17 @@ class Bridges extends React.Component { ; } + if (this.props.nodeStates[bridge.uuid].command === 'status' && this.props.nodeStates[bridge.uuid].data === 'connecting') { + return + this.setState({ showDebugData: bridge })} + > + + + ; + } + return null; } renderBridge(bridge, bridgeIndex) { @@ -617,6 +656,7 @@ class Bridges extends React.Component { {this.renderDeleteDialog()} {this.renderEditDialog()} {this.renderQrCodeDialog()} + {this.renderDebugDialog()} { diff --git a/src/matter/BridgedDevicesNode.ts b/src/matter/BridgedDevicesNode.ts index f7d94e28..5054529c 100644 --- a/src/matter/BridgedDevicesNode.ts +++ b/src/matter/BridgedDevicesNode.ts @@ -2,7 +2,7 @@ import { CommissioningServer, MatterServer } from '@project-chip/matter-node.js' import { VendorId } from '@project-chip/matter-node.js/datatype'; import { Aggregator, DeviceTypes, OnOffPluginUnitDevice } from '@project-chip/matter-node.js/device'; -import { QrCode } from '@project-chip/matter-node.js/schema'; +import { toJson } from '@project-chip/matter.js/storage'; import { GenericDevice, Socket } from '../lib'; @@ -175,12 +175,17 @@ class BridgedDevice { // console.log(`Manual pairing code: ${manualPairingCode}`); return BridgeStates.Listening; } else { + const activeSession = this.commissioningServer.getActiveSessionInformation(); + const fabric = this.commissioningServer.getCommissionedFabricInformation(); + this.sendToGui({ uuid: this.parameters.uuid, command: 'status', data: 'connecting', + activeSession: toJson(activeSession), + fabric: toJson(fabric), }); - console.log("Device is already commissioned. Waiting for controllers to connect ..."); + console.log('Device is already commissioned. Waiting for controllers to connect ...'); return BridgeStates.Commissioned; } } diff --git a/src/matter/StorageIoBroker.ts b/src/matter/StorageIoBroker.ts index c7a43b03..3cfb8dad 100644 --- a/src/matter/StorageIoBroker.ts +++ b/src/matter/StorageIoBroker.ts @@ -1,4 +1,4 @@ -import { fromJson, Storage, StorageError, SupportedStorageTypes, toJson } from "@project-chip/matter.js/storage"; +import { fromJson, Storage, StorageError, SupportedStorageTypes, toJson } from '@project-chip/matter.js/storage'; export class StorageIoBroker implements Storage { private readonly adapter: ioBroker.Adapter;