mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 04:16:34 +00:00
Allow stale ZHA coordinator entries to be deleted (#13154)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
be52ba0ea9
commit
c50cf78bb4
@ -26,6 +26,7 @@ export interface ZHADevice {
|
|||||||
power_source?: string;
|
power_source?: string;
|
||||||
area_id?: string;
|
area_id?: string;
|
||||||
device_type: string;
|
device_type: string;
|
||||||
|
active_coordinator: boolean;
|
||||||
signature: any;
|
signature: any;
|
||||||
neighbors: Neighbor[];
|
neighbors: Neighbor[];
|
||||||
pairing_status?: string;
|
pairing_status?: string;
|
||||||
|
@ -30,7 +30,7 @@ export const getZHADeviceActions = async (
|
|||||||
|
|
||||||
const actions: DeviceAction[] = [];
|
const actions: DeviceAction[] = [];
|
||||||
|
|
||||||
if (zhaDevice.device_type !== "Coordinator") {
|
if (!zhaDevice.active_coordinator) {
|
||||||
actions.push({
|
actions.push({
|
||||||
label: hass.localize("ui.dialogs.zha_device_info.buttons.reconfigure"),
|
label: hass.localize("ui.dialogs.zha_device_info.buttons.reconfigure"),
|
||||||
action: () => showZHAReconfigureDeviceDialog(el, { device: zhaDevice }),
|
action: () => showZHAReconfigureDeviceDialog(el, { device: zhaDevice }),
|
||||||
@ -58,50 +58,50 @@ export const getZHADeviceActions = async (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zhaDevice.device_type !== "Coordinator") {
|
actions.push(
|
||||||
actions.push(
|
...[
|
||||||
...[
|
{
|
||||||
{
|
label: hass.localize(
|
||||||
label: hass.localize(
|
"ui.dialogs.zha_device_info.buttons.zigbee_information"
|
||||||
"ui.dialogs.zha_device_info.buttons.zigbee_information"
|
),
|
||||||
|
action: () => showZHADeviceZigbeeInfoDialog(el, { device: zhaDevice }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: hass.localize("ui.dialogs.zha_device_info.buttons.clusters"),
|
||||||
|
action: () => showZHAClusterDialog(el, { device: zhaDevice }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: hass.localize(
|
||||||
|
"ui.dialogs.zha_device_info.buttons.view_in_visualization"
|
||||||
|
),
|
||||||
|
action: () =>
|
||||||
|
navigate(`/config/zha/visualization/${zhaDevice!.device_reg_id}`),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!zhaDevice.active_coordinator) {
|
||||||
|
actions.push({
|
||||||
|
label: hass.localize("ui.dialogs.zha_device_info.buttons.remove"),
|
||||||
|
classes: "warning",
|
||||||
|
action: async () => {
|
||||||
|
const confirmed = await showConfirmationDialog(el, {
|
||||||
|
text: hass.localize(
|
||||||
|
"ui.dialogs.zha_device_info.confirmations.remove"
|
||||||
),
|
),
|
||||||
action: () =>
|
});
|
||||||
showZHADeviceZigbeeInfoDialog(el, { device: zhaDevice }),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: hass.localize("ui.dialogs.zha_device_info.buttons.clusters"),
|
|
||||||
action: () => showZHAClusterDialog(el, { device: zhaDevice }),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: hass.localize(
|
|
||||||
"ui.dialogs.zha_device_info.buttons.view_in_visualization"
|
|
||||||
),
|
|
||||||
action: () =>
|
|
||||||
navigate(`/config/zha/visualization/${zhaDevice!.device_reg_id}`),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: hass.localize("ui.dialogs.zha_device_info.buttons.remove"),
|
|
||||||
classes: "warning",
|
|
||||||
action: async () => {
|
|
||||||
const confirmed = await showConfirmationDialog(el, {
|
|
||||||
text: hass.localize(
|
|
||||||
"ui.dialogs.zha_device_info.confirmations.remove"
|
|
||||||
),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await hass.callService("zha", "remove", {
|
await hass.callService("zha", "remove", {
|
||||||
ieee: zhaDevice.ieee,
|
ieee: zhaDevice.ieee,
|
||||||
});
|
});
|
||||||
|
|
||||||
history.back();
|
history.back();
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user