MCPcopy
hub / github.com/homebridge/homebridge / setServerStatus

Method setServerStatus

src/server.ts:169–189  ·  view source on GitHub ↗

* Set the current server status and update parent via IPC * @param status

(status: ServerStatus)

Source from the content-addressed store, hash-verified

167 * @param status
168 */
169 private setServerStatus(status: ServerStatus) {
170 this.serverStatus = status
171
172 // setupURI() asserts the accessory is published. _accessoryInfo is only
173 // set post-publish, so use it as the guard — covers both the HAP-disabled
174 // case and the teardown path, where the bridge has been torn down.
175 const bridge = this.bridgeService?.bridge
176 const isPublished = !!bridge?._accessoryInfo
177
178 const statusUpdate: ServerStatusUpdate = {
179 status: this.serverStatus,
180 paired: isPublished ? (bridge?._accessoryInfo?.paired() ?? null) : null,
181 setupUri: isPublished ? (bridge?.setupURI() ?? null) : null,
182 name: this.config.bridge.name,
183 username: this.config.bridge.username,
184 pin: this.config.bridge.pin,
185 matter: this.matterManager?.getMatterStatus() ?? { enabled: false },
186 }
187
188 this.ipcService.sendMessage(IpcOutgoingEvent.SERVER_STATUS_UPDATE, statusUpdate)
189 }
190
191 public async start(): Promise<void> {
192 if (this.config.bridge.disableIpc !== true) {

Callers 3

constructorMethod · 0.95
startMethod · 0.95
teardownMethod · 0.95

Calls 2

getMatterStatusMethod · 0.80
sendMessageMethod · 0.45

Tested by

no test coverage detected