Show ZwaveJS "Installer settings" based on installer_mode option (#22710)

Show "Installer settings" based on `installer_mode` option
This commit is contained in:
Petar Petrov 2024-11-20 13:06:15 +02:00 committed by GitHub
parent 940cbd42c3
commit c92bee4f1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 7 deletions

View File

@ -951,3 +951,14 @@ export const setZWaveJSLogLevel = (
entry_id,
config: { level },
});
export interface ZWaveJSIntegrationSettings {
installer_mode: boolean;
}
export const fetchZwaveIntegrationSettings = (
hass: HomeAssistant
): Promise<ZWaveJSIntegrationSettings> =>
hass.callWS({
type: "zwave_js/get_integration_settings",
});

View File

@ -10,6 +10,7 @@ import {
import { getConfigEntries } from "../../../../../../data/config_entries";
import type { DeviceRegistryEntry } from "../../../../../../data/device_registry";
import {
fetchZwaveIntegrationSettings,
fetchZwaveIsAnyOTAFirmwareUpdateInProgress,
fetchZwaveIsNodeFirmwareUpdateInProgress,
fetchZwaveNodeStatus,
@ -99,17 +100,22 @@ export const getZwaveDeviceActions = async (
showZWaveJSNodeStatisticsDialog(el, {
device,
}),
},
{
label: hass.localize(
"ui.panel.config.zwave_js.device_info.installer_settings"
),
icon: mdiWrench,
href: `/config/zwave_js/node_installer/${device.id}?config_entry=${entryId}`,
}
);
}
const integrationSettings = await fetchZwaveIntegrationSettings(hass);
if (integrationSettings.installer_mode) {
actions.push({
label: hass.localize(
"ui.panel.config.zwave_js.device_info.installer_settings"
),
icon: mdiWrench,
href: `/config/zwave_js/node_installer/${device.id}?config_entry=${entryId}`,
});
}
if (
!(
nodeStatus.ready &&