Disable ZHA channel changing when multi-PAN is in use (#16731)

* Show baudrate and port in the ZHA network info

* Do not allow changing the Zigbee channel with the multiprotocol addon

* Include translations as well

* Update src/translations/en.json

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
puddly 2023-06-05 06:27:36 -04:00 committed by GitHub
parent 33e15eec22
commit e6bdc3a15e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 1 deletions

View File

@ -169,9 +169,16 @@ export interface ZHANetworkBackup {
node_info: ZHANetworkBackupNodeInfo;
}
export interface ZHADeviceSettings {
path: string;
baudrate?: number;
flow_control?: string;
}
export interface ZHANetworkSettings {
settings: ZHANetworkBackup;
radio_type: "ezsp" | "znp" | "deconz" | "zigate" | "xbee";
device: ZHADeviceSettings;
}
export interface ZHANetworkBackupAndMetadata {

View File

@ -46,6 +46,8 @@ import {
} from "../../../../../data/zha";
import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box";
const MULTIPROTOCOL_ADDON_URL = "socket://core-silabs-multiprotocol:9999";
export const zhaTabs: PageNavigation[] = [
{
translationKey: "ui.panel.config.zha.network.caption",
@ -181,6 +183,25 @@ class ZHAConfigDashboard extends LitElement {
>${this._networkSettings.radio_type}</span
>
</ha-settings-row>
<ha-settings-row>
<span slot="description">Serial port</span>
<span slot="heading"
>${this._networkSettings.device.path}</span
>
</ha-settings-row>
${this._networkSettings.device.baudrate &&
!this._networkSettings.device.path.startsWith("socket://")
? html`
<ha-settings-row>
<span slot="description">Baudrate</span>
<span slot="heading"
>${this._networkSettings.device.baudrate}</span
>
</ha-settings-row>
`
: ""}
</div>`
: ""}
<div class="card-actions">
@ -255,6 +276,19 @@ class ZHAConfigDashboard extends LitElement {
}
private async _showChannelMigrationDialog(): Promise<void> {
if (this._networkSettings!.device.path === MULTIPROTOCOL_ADDON_URL) {
showAlertDialog(this, {
title: this.hass.localize(
"ui.panel.config.zha.configuration_page.channel_dialog.title"
),
text: this.hass.localize(
"ui.panel.config.zha.configuration_page.channel_dialog.text"
),
warning: true,
});
return;
}
showZHAChangeChannelDialog(this, {
currentChannel: this._networkSettings!.settings.network_info.channel,
});

View File

@ -3509,7 +3509,11 @@
"download_backup": "Download Backup",
"migrate_radio": "Migrate Radio",
"network_settings_title": "Network Settings",
"change_channel": "Change channel"
"change_channel": "Change channel",
"channel_dialog": {
"title": "Multiprotocol addon in use",
"text": "Zigbee and Thread share the same radio and must use the same channel. Change the channel of both networks by reconfiguring multiprotocol from the hardware menu."
}
},
"add_device_page": {
"spinner": "Searching for Zigbee devices…",