Skip to content

Commit

Permalink
show pairing status for bridges around the ui
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Nov 16, 2024
1 parent 0aa6843 commit 9d686d7
Show file tree
Hide file tree
Showing 37 changed files with 127 additions and 67 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ All notable changes to `homebridge-config-ui-x` will be documented in this file.
- use native language for validation messages where available
- currently available for `de` `en` `es` `fr` `it` `pt` `zh`
- switch from a top menu to a sidebar menu
- show pairing status for bridges around the ui

### Other Changes

Expand Down
1 change: 1 addition & 0 deletions src/modules/server/server.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class ServerService {
private readonly accessoryInfoPath: string

public setupCode: string | null = null
public paired: boolean = false

constructor(
private readonly configService: ConfigService,
Expand Down
3 changes: 3 additions & 0 deletions src/modules/status/status.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class StatusService {

if (data?.setupUri) {
this.serverService.setupCode = data.setupUri
this.serverService.paired = data.paired
}

this.homebridgeStatusChange.next(this.homebridgeStatus)
Expand Down Expand Up @@ -271,6 +272,7 @@ export class StatusService {
return {
pin: this.configService.homebridgeConfig.bridge.pin,
setupUri: await this.serverService.getSetupCode(),
paired: this.serverService.paired,
}
}

Expand Down Expand Up @@ -337,6 +339,7 @@ export class StatusService {
port: this.configService.homebridgeConfig.bridge.port,
pin: this.configService.homebridgeConfig.bridge.pin,
setupUri: await this.serverService.getSetupCode(),
paired: this.serverService.paired,
packageVersion: this.configService.package.version,
status: await this.checkHomebridgeStatus(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class RestartHomebridgeComponent {
this.$api.put('/platform-tools/hb-service/set-full-service-restart-flag', {}).subscribe({
next: () => {
this.$router.navigate(['/restart'])
this.$activeModal.close()
},
error: (error) => {
console.error(error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,29 @@ <h5 class="primary-text mb-0">
</ngb-alert>
</div>
<div *ngIf="deviceInfo[item._bridge?.username]" class="mt-3">
<div *ngIf="!deviceInfo[item._bridge?.username]._isPaired" class="w-100 d-flex flex-column">
<div class="w-100 d-flex flex-column text-center">
<app-qrcode
[data]="deviceInfo[item._bridge?.username]._setupCode"
class="mx-auto my-2"
style="width: 180px; height: 180px"
style="width: 120px; height: 120px"
>
</app-qrcode>
<p class="mx-auto text-center">{{ deviceInfo[item._bridge?.username].pincode }}</p>
<p class="grey-text mx-auto text-center" style="max-width: 400px">
{{ 'status.code_scan' | translate }}
<p class="mx-auto my-1">{{ deviceInfo[item._bridge?.username].pincode }}</p>
<p class="grey-text mx-auto small mb-1" style="max-width: 400px">
<i
class="fas fa-fw fa-link"
[ngClass]="{
'green-text': deviceInfo[item._bridge?.username]._isPaired,
'red-text': !deviceInfo[item._bridge?.username]._isPaired
}"
></i>
{{ (deviceInfo[item._bridge?.username]._isPaired ? 'status.widget.qr_paired' :
'status.widget.qr_unpaired') | translate }}
<span *ngIf="!deviceInfo[item._bridge?.username]._isPaired">
&middot; {{ 'status.code_scan' | translate }}
</span>
</p>
</div>
<div *ngIf="deviceInfo[item._bridge?.username]._isPaired">
<div class="text-center">
<i class="fa fa-fw fa-check-circle primary-text mb-4" style="font-size: 75px"></i>
<p>{{ 'child_bridge.bridge_paired' | translate }}</p>
</div>
</div>
<div *ngIf="$settings.env.serviceMode">
<div
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ <h5 class="modal-title">{{ 'reset.clear_cache_bridge.title' | translate }}</h5>
<span>
{{ item.displayName }} ({{ item._main ? 'Homebridge' : (item._category | titlecase) }})
<br />
<small class="grey-text">{{ item._username }}</small>
<small class="grey-text">
<i
class="fas fa-fw fa-link"
[ngClass]="{
'green-text': item._isPaired,
'red-text': !item._isPaired
}"
></i>
{{ (item._isPaired ? 'status.widget.qr_paired' : 'status.widget.qr_unpaired') | translate }} &middot; {{
item._username }}
</small>
</span>
<button
class="btn btn-danger"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@ <h5 class="modal-title">{{ 'reset.bridges_single.title' | translate }}</h5>
<span>
{{ item.displayName }} ({{ item._main ? 'Homebridge' : (item._category | titlecase) }})
<br />
<small class="grey-text">{{ item._username }}</small>
<small class="grey-text">
<i
class="fas fa-fw fa-link"
[ngClass]="{
'green-text': item._isPaired,
'red-text': !item._isPaired
}"
></i>
{{ (item._isPaired ? 'status.widget.qr_paired' : 'status.widget.qr_unpaired') | translate }} &middot; {{
item._username }}
</small>
</span>
<button
class="btn btn-danger"
Expand Down
1 change: 1 addition & 0 deletions ui/src/app/modules/status/status.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class StatusComponent implements OnInit, OnDestroy {
enabled: this.isLayoutUnlocked(),
},
gridType: 'verticalFixed',
margin: 8,
minCols: 20,
maxCols: 20,
minRows: 20,
Expand Down
5 changes: 3 additions & 2 deletions ui/src/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"backup.title_backup": "Backup",
"child_bridge.about": "Homebridge allows you to run your plugin's platform or accessory as an isolated child bridge. This can improve the general responsiveness and reliability of Homebridge.",
"child_bridge.bridge_connect": "Connect to HomeKit",
"child_bridge.bridge_paired": "Bridge Paired",
"child_bridge.bridge_settings": "Child Bridge Config",
"child_bridge.bridges": "Child Bridges",
"child_bridge.bridges_paired": "Each child bridge platform or accessory will need to be paired with HomeKit separately.",
Expand Down Expand Up @@ -389,7 +388,7 @@
"setup_wizard_message_complete_message": "The setup procedure is complete and you're now ready to start using Homebridge.",
"setup_wizard_message_complete_title": "Congratulations!",
"setup_wizard_message_restore": "Restore From Backup",
"status.code_scan": "Сканирайте, за да добавите към Homekit.",
"status.code_scan": "Сканирайте, за да добавите към Homekit",
"status.cpu.load": "Използва",
"status.cpu.temp": "Темп.",
"status.cpu.title_cpu": "Процесор",
Expand Down Expand Up @@ -454,6 +453,8 @@
"status.widget.network.refresh_interval": "Refresh Interval",
"status.widget.network.refresh_note": "Refresh the page after saving for changes to take effect.",
"status.widget.network.seconds": "seconds",
"status.widget.qr_paired": "Paired",
"status.widget.qr_unpaired": "Not Paired",
"status.widget.show_hide": "Show/Hide Widgets",
"status.widget.title_manage_widget": "Manage Widget",
"status.widget.uptime.label_process": "Process",
Expand Down
5 changes: 3 additions & 2 deletions ui/src/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"backup.title_backup": "Backup",
"child_bridge.about": "Homebridge permet executar la plataforma o accessori del plugin com un pont fill aïllat. Això pot ajudar a millorar la capacitat general de resposta i la fiabilitat de Homebridge.",
"child_bridge.bridge_connect": "Connectar a HomeKit",
"child_bridge.bridge_paired": "Pont aparellat",
"child_bridge.bridge_settings": "Configuració del pont",
"child_bridge.bridges": "Ponts fills",
"child_bridge.bridges_paired": "Cada pont fill de plataforma o accessori ha de ser aparellat a HomeKit per separat.",
Expand Down Expand Up @@ -389,7 +388,7 @@
"setup_wizard_message_complete_message": "El procediment de configuració s'ha completat i ja estàs preparat per començar a utilitzar Homebridge.",
"setup_wizard_message_complete_title": "Felicitats!",
"setup_wizard_message_restore": "Restore From Backup",
"status.code_scan": "Escaneja per afegir a HomeKit.",
"status.code_scan": "Escaneja per afegir a HomeKit",
"status.cpu.load": "Càrrega",
"status.cpu.temp": "Temperatura",
"status.cpu.title_cpu": "CPU",
Expand Down Expand Up @@ -454,6 +453,8 @@
"status.widget.network.refresh_interval": "Interval d'actualització",
"status.widget.network.refresh_note": "Actualitza la pàgina perquè els canvis tinguin efecte.",
"status.widget.network.seconds": "segons",
"status.widget.qr_paired": "Aparellat",
"status.widget.qr_unpaired": "No aparellat",
"status.widget.show_hide": "Show/Hide Widgets",
"status.widget.title_manage_widget": "Gestionar widget",
"status.widget.uptime.label_process": "Procés",
Expand Down
5 changes: 3 additions & 2 deletions ui/src/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"backup.title_backup": "Záloha",
"child_bridge.about": "Homebridge umožňuje spustit platformu nebo příslušenství zásuvného modulu jako izolovaný podřízený most. To může zlepšit celkovou odezvu a spolehlivost systému Homebridge.",
"child_bridge.bridge_connect": "Připojit k HomeKitu",
"child_bridge.bridge_paired": "Most Spárován",
"child_bridge.bridge_settings": "Nastavení Mostu",
"child_bridge.bridges": "Podřízený Most",
"child_bridge.bridges_paired": "Každou platformu nebo příslušenství podřazeného můstku je třeba spárovat se systémem HomeKit samostatně.",
Expand Down Expand Up @@ -389,7 +388,7 @@
"setup_wizard_message_complete_message": "Postup nastavení je dokončen. Nyní můžete začít používat Homebridge.",
"setup_wizard_message_complete_title": "Gratulujeme!",
"setup_wizard_message_restore": "Restore From Backup",
"status.code_scan": "Naskenováním přidejte do HomeKit.",
"status.code_scan": "Naskenováním přidejte do HomeKit",
"status.cpu.load": "Zatížení",
"status.cpu.temp": "Teplota",
"status.cpu.title_cpu": "Procesor",
Expand Down Expand Up @@ -454,6 +453,8 @@
"status.widget.network.refresh_interval": "Refresh Interval",
"status.widget.network.refresh_note": "Refresh the page after saving for changes to take effect.",
"status.widget.network.seconds": "seconds",
"status.widget.qr_paired": "Spárováno",
"status.widget.qr_unpaired": "Nespárováno",
"status.widget.show_hide": "Show/Hide Widgets",
"status.widget.title_manage_widget": "Spravovat widgety",
"status.widget.uptime.label_process": "Proces",
Expand Down
5 changes: 3 additions & 2 deletions ui/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"backup.title_backup": "Backup",
"child_bridge.about": "Homebridge erlaubt es dir, die Plattform oder Geräte deiner Plugins als eine isolierten Unter-Bridge zu betreiben. Das kann die allgemeine Reaktionsfähigkeit und Zuverlässigkeit von Homebridge verbessern.",
"child_bridge.bridge_connect": "Verbinde zu HomeKit",
"child_bridge.bridge_paired": "Gekoppelte Bridge",
"child_bridge.bridge_settings": "Bridge Einstellungen",
"child_bridge.bridges": "Unter-Bridges",
"child_bridge.bridges_paired": "Jede Unter-Bridge Plattform oder Gerät muss separat mit HomeKit gekoppelt werden.",
Expand Down Expand Up @@ -389,7 +388,7 @@
"setup_wizard_message_complete_message": "Der Einrichtungsvorgang ist abgeschlossen und du kannst Homebridge jetzt verwenden.",
"setup_wizard_message_complete_title": "Herzlichen Glückwunsch!",
"setup_wizard_message_restore": "Restore From Backup",
"status.code_scan": "Scannen, um es zu HomeKit hinzuzufügen.",
"status.code_scan": "Scannen, um es zu HomeKit hinzuzufügen",
"status.cpu.load": "Auslastung",
"status.cpu.temp": "Temperatur",
"status.cpu.title_cpu": "Prozessor",
Expand Down Expand Up @@ -454,6 +453,8 @@
"status.widget.network.refresh_interval": "Aktualisierungsintervall",
"status.widget.network.refresh_note": "Aktualisiere die Seite, damit die Änderungen des Aktualisierungsintervalls wirksam werden.",
"status.widget.network.seconds": "Sekunden",
"status.widget.qr_paired": "Gekoppelte",
"status.widget.qr_unpaired": "Nicht Gekoppelte",
"status.widget.show_hide": "Show/Hide Widgets",
"status.widget.title_manage_widget": "Widget verwalten",
"status.widget.uptime.label_process": "Prozess",
Expand Down
5 changes: 3 additions & 2 deletions ui/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"backup.title_backup": "Backup",
"child_bridge.about": "Homebridge allows you to run your plugin's platform or accessory as an isolated child bridge. This can improve the general responsiveness and reliability of Homebridge.",
"child_bridge.bridge_connect": "Connect to HomeKit",
"child_bridge.bridge_paired": "Bridge Paired",
"child_bridge.bridge_settings": "Child Bridge Config",
"child_bridge.bridges": "Child Bridges",
"child_bridge.bridges_paired": "Each child bridge platform or accessory will need to be paired with HomeKit separately.",
Expand Down Expand Up @@ -389,7 +388,7 @@
"setup_wizard_message_complete_message": "The setup procedure is complete and you're now ready to start using Homebridge.",
"setup_wizard_message_complete_title": "Congratulations!",
"setup_wizard_message_restore": "Restore From Backup",
"status.code_scan": "Scan to add to HomeKit.",
"status.code_scan": "Scan to add to HomeKit",
"status.cpu.load": "Load",
"status.cpu.temp": "Temp",
"status.cpu.title_cpu": "CPU",
Expand Down Expand Up @@ -454,6 +453,8 @@
"status.widget.network.refresh_interval": "Refresh Interval",
"status.widget.network.refresh_note": "Refresh the page after saving for changes to take effect.",
"status.widget.network.seconds": "seconds",
"status.widget.qr_paired": "Paired",
"status.widget.qr_unpaired": "Not Paired",
"status.widget.show_hide": "Show/Hide Widgets",
"status.widget.title_manage_widget": "Manage Widget",
"status.widget.uptime.label_process": "Process",
Expand Down
3 changes: 2 additions & 1 deletion ui/src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"backup.title_backup": "Respaldar",
"child_bridge.about": "Homebridge permite ejecutar la plataforma o accesorio del plugin como un puente hijo aislado. Esto puede ayudar a mejorar la capacidad general de respuesta y la fiabilidad de Homebridge.",
"child_bridge.bridge_connect": "Conectar a HomeKit",
"child_bridge.bridge_paired": "Puente emparejado",
"child_bridge.bridge_settings": "Ajustes de Puente",
"child_bridge.bridges": "Puentes Hijos",
"child_bridge.bridges_paired": "Cada puente hijo de plataforma o accesorio deberá ser emparejado a HomeKit por separado.",
Expand Down Expand Up @@ -454,6 +453,8 @@
"status.widget.network.refresh_interval": "Intervalo de actualización",
"status.widget.network.refresh_note": "Actualiza la página después de guardar para que los cambios surtan efecto.",
"status.widget.network.seconds": "segundos",
"status.widget.qr_paired": "Emparejado",
"status.widget.qr_unpaired": "No emparejado",
"status.widget.show_hide": "Mostrar/Ocultar Widgets",
"status.widget.title_manage_widget": "Gestionar Widget",
"status.widget.uptime.label_process": "Proceso",
Expand Down
5 changes: 3 additions & 2 deletions ui/src/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"backup.title_backup": "Varmuuskopioi",
"child_bridge.about": "Homebridgen avulla voit käyttää laajennuksen alustaa tai lisälaitetta erillisenä ali-siltana. Tämä voi parantaa Homebridgen yleistä reagointikykyä ja luotettavuutta.",
"child_bridge.bridge_connect": "Yhdistä HomeKit",
"child_bridge.bridge_paired": "Silta paritettu",
"child_bridge.bridge_settings": "Ali-sillan asetukset",
"child_bridge.bridges": "Ali-sillat",
"child_bridge.bridges_paired": "Jokainen ali-silta, alusta ja laite täytyy parittaa HomeKit:in kanssa erikseen.",
Expand Down Expand Up @@ -389,7 +388,7 @@
"setup_wizard_message_complete_message": "Asetukset ovat valmiit ja Homebridge on valmis käyttöön.",
"setup_wizard_message_complete_title": "Onnea!",
"setup_wizard_message_restore": "Palauta varmuuskopiosta",
"status.code_scan": "Skannaa lisätäksesi HomeKit järjestelmään.",
"status.code_scan": "Skannaa lisätäksesi HomeKit järjestelmään",
"status.cpu.load": "Käyttöaste",
"status.cpu.temp": "Lämpötila",
"status.cpu.title_cpu": "CPU",
Expand Down Expand Up @@ -454,6 +453,8 @@
"status.widget.network.refresh_interval": "Päivityksen aikaväli ",
"status.widget.network.refresh_note": "lataa sivu uudelleen nähdäksesi muutokset.",
"status.widget.network.seconds": "sekuntia",
"status.widget.qr_paired": "Paritettu",
"status.widget.qr_unpaired": "Ei paritettu",
"status.widget.show_hide": "Show/Hide Widgets",
"status.widget.title_manage_widget": "Hallitse sovelmaa",
"status.widget.uptime.label_process": "Prosessi",
Expand Down
5 changes: 3 additions & 2 deletions ui/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"backup.title_backup": "Sauvegarder",
"child_bridge.about": "Homebridge vous permet de faire fonctionner la plateforme ou l'accessoire géré par votre plugin en tant que pont secondaire isolé. Cela peut améliorer la réactivité et la fiabilité générale d'Homebridge.",
"child_bridge.bridge_connect": "Connecter à HomeKit",
"child_bridge.bridge_paired": "Pont appairé",
"child_bridge.bridge_settings": "Réglages du Pont",
"child_bridge.bridges": "Ponts secondaires",
"child_bridge.bridges_paired": "Chaque plateforme ou accessoire d'un Pont secondaire devra être appairé avec Homebridge de manière séparée.",
Expand Down Expand Up @@ -389,7 +388,7 @@
"setup_wizard_message_complete_message": "La procédure d'installation est terminée et vous êtes maintenant prêt à utiliser Homebridge.",
"setup_wizard_message_complete_title": "Félicitations!",
"setup_wizard_message_restore": "Restore From Backup",
"status.code_scan": "Scannez pour ajouter à HomeKit.",
"status.code_scan": "Scannez pour ajouter à HomeKit",
"status.cpu.load": "Charge",
"status.cpu.temp": "Temp",
"status.cpu.title_cpu": "CPU",
Expand Down Expand Up @@ -454,6 +453,8 @@
"status.widget.network.refresh_interval": "Refresh Interval",
"status.widget.network.refresh_note": "Refresh the page after saving for changes to take effect.",
"status.widget.network.seconds": "seconds",
"status.widget.qr_paired": "Appairé",
"status.widget.qr_unpaired": "Non appairé",
"status.widget.show_hide": "Show/Hide Widgets",
"status.widget.title_manage_widget": "Gérer le Widget",
"status.widget.uptime.label_process": "Process",
Expand Down
3 changes: 2 additions & 1 deletion ui/src/i18n/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"backup.title_backup": "גיבוי",
"child_bridge.about": "Homebridge allows you to run your plugin's platform or accessory as an isolated child bridge. This can improve the general responsiveness and reliability of Homebridge.",
"child_bridge.bridge_connect": "Connect to HomeKit",
"child_bridge.bridge_paired": "מגשר מחובר",
"child_bridge.bridge_settings": "הגדרות מגשר",
"child_bridge.bridges": "מגשר ילד",
"child_bridge.bridges_paired": "Each child bridge platform or accessory will need to be paired with HomeKit separately.",
Expand Down Expand Up @@ -454,6 +453,8 @@
"status.widget.network.refresh_interval": "Refresh Interval",
"status.widget.network.refresh_note": "Refresh the page after saving for changes to take effect.",
"status.widget.network.seconds": "seconds",
"status.widget.qr_paired": "מְחוּבָּר",
"status.widget.qr_unpaired": "לא מחובר",
"status.widget.show_hide": "Show/Hide Widgets",
"status.widget.title_manage_widget": "נהל ווידג'טים",
"status.widget.uptime.label_process": "תהליך",
Expand Down
Loading

0 comments on commit 9d686d7

Please sign in to comment.