diff --git a/src/data/zwave_js.ts b/src/data/zwave_js.ts index fd5ee1b4c20e..e1744d6ec858 100644 --- a/src/data/zwave_js.ts +++ b/src/data/zwave_js.ts @@ -219,8 +219,9 @@ export interface ZwaveJSNodeMetadata { device_database_url: string; } -export interface ZwaveJSNodeComments { +export interface ZwaveJSNodeAlerts { comments: ZWaveJSNodeComment[]; + is_embedded: boolean | null; } export interface ZWaveJSNodeConfigParams { @@ -601,12 +602,12 @@ export const fetchZwaveNodeMetadata = ( device_id, }); -export const fetchZwaveNodeComments = ( +export const fetchZwaveNodeAlerts = ( hass: HomeAssistant, device_id: string -): Promise => +): Promise => hass.callWS({ - type: "zwave_js/node_comments", + type: "zwave_js/node_alerts", device_id, }); diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts index c7510dad68b6..b2a92735096f 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts @@ -1,5 +1,5 @@ import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; -import { fetchZwaveNodeComments } from "../../../../../../data/zwave_js"; +import { fetchZwaveNodeAlerts } from "../../../../../../data/zwave_js"; import { HomeAssistant } from "../../../../../../types"; import { DeviceAlert } from "../../../ha-config-device-page"; @@ -7,14 +7,27 @@ export const getZwaveDeviceAlerts = async ( hass: HomeAssistant, device: DeviceRegistryEntry ): Promise => { - const nodeComments = await fetchZwaveNodeComments(hass, device.id); + const nodeAlerts = await fetchZwaveNodeAlerts(hass, device.id); + const deviceAlerts: DeviceAlert[] = []; - if (!nodeComments?.comments?.length) { - return []; + if (nodeAlerts?.is_embedded === false) { + deviceAlerts.push({ + level: "info", + text: hass.localize( + "ui.panel.config.zwave_js.device_info.custom_device_config" + ), + }); } - return nodeComments.comments.map((comment) => ({ - level: comment.level, - text: comment.text, - })); + if (!nodeAlerts?.comments?.length) { + return deviceAlerts; + } + + deviceAlerts.push( + ...nodeAlerts.comments.map((comment) => ({ + level: comment.level, + text: comment.text, + })) + ); + return deviceAlerts; }; diff --git a/src/translations/en.json b/src/translations/en.json index 21ffaa7549fa..8392b17f2f7c 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -4064,7 +4064,8 @@ "unknown": "Unknown", "zwave_plus": "Z-Wave Plus", "zwave_plus_version": "Version {version}", - "node_statistics": "Statistics" + "node_statistics": "Statistics", + "custom_device_config": "This device is using a custom device config file not provided by Z-Wave JS. If you want to use the default device config provided by Z-Wave JS, you must remove the custom device config file from the folder that Z-Wave JS is reading from." }, "hard_reset_controller": { "NotStarted": {