mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 21:37:21 +00:00
Use device_id instead of config entry id and node id for zwave_js (#12658)
* Use device_id instead of config entry id and node id for zwave_js * Add additional cleanup from #12642 * Revert removal of multiple config entries check * Update src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-actions-zwave_js.ts Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io> * Update src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io> Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
32a991989f
commit
5b7b0ea326
@ -145,7 +145,7 @@ export interface ZWaveJSController {
|
||||
supports_timers: boolean;
|
||||
is_heal_network_active: boolean;
|
||||
inclusion_state: InclusionState;
|
||||
nodes: number[];
|
||||
nodes: ZWaveJSNodeStatus[];
|
||||
}
|
||||
|
||||
export interface ZWaveJSNodeStatus {
|
||||
@ -200,8 +200,7 @@ export interface ZWaveJSNodeConfigParamMetadata {
|
||||
|
||||
export interface ZWaveJSSetConfigParamData {
|
||||
type: string;
|
||||
entry_id: string;
|
||||
node_id: number;
|
||||
device_id: string;
|
||||
property: number;
|
||||
property_key?: number;
|
||||
value: string | number;
|
||||
@ -427,49 +426,41 @@ export const unprovisionZwaveSmartStartNode = (
|
||||
|
||||
export const fetchZwaveNodeStatus = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string,
|
||||
node_id: number
|
||||
device_id: string
|
||||
): Promise<ZWaveJSNodeStatus> =>
|
||||
hass.callWS({
|
||||
type: "zwave_js/node_status",
|
||||
entry_id,
|
||||
node_id,
|
||||
device_id,
|
||||
});
|
||||
|
||||
export const fetchZwaveNodeMetadata = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string,
|
||||
node_id: number
|
||||
device_id: string
|
||||
): Promise<ZwaveJSNodeMetadata> =>
|
||||
hass.callWS({
|
||||
type: "zwave_js/node_metadata",
|
||||
entry_id,
|
||||
node_id,
|
||||
device_id,
|
||||
});
|
||||
|
||||
export const fetchZwaveNodeConfigParameters = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string,
|
||||
node_id: number
|
||||
device_id: string
|
||||
): Promise<ZWaveJSNodeConfigParams> =>
|
||||
hass.callWS({
|
||||
type: "zwave_js/get_config_parameters",
|
||||
entry_id,
|
||||
node_id,
|
||||
device_id,
|
||||
});
|
||||
|
||||
export const setZwaveNodeConfigParameter = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string,
|
||||
node_id: number,
|
||||
device_id: string,
|
||||
property: number,
|
||||
value: number,
|
||||
property_key?: number
|
||||
): Promise<ZWaveJSSetConfigParamResult> => {
|
||||
const data: ZWaveJSSetConfigParamData = {
|
||||
type: "zwave_js/set_config_parameter",
|
||||
entry_id,
|
||||
node_id,
|
||||
device_id,
|
||||
property,
|
||||
value,
|
||||
property_key,
|
||||
@ -479,42 +470,36 @@ export const setZwaveNodeConfigParameter = (
|
||||
|
||||
export const reinterviewZwaveNode = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string,
|
||||
node_id: number,
|
||||
device_id: string,
|
||||
callbackFunction: (message: ZWaveJSRefreshNodeStatusMessage) => void
|
||||
): Promise<UnsubscribeFunc> =>
|
||||
hass.connection.subscribeMessage(
|
||||
(message: any) => callbackFunction(message),
|
||||
{
|
||||
type: "zwave_js/refresh_node_info",
|
||||
entry_id,
|
||||
node_id,
|
||||
device_id,
|
||||
}
|
||||
);
|
||||
|
||||
export const healZwaveNode = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string,
|
||||
node_id: number
|
||||
device_id: string
|
||||
): Promise<boolean> =>
|
||||
hass.callWS({
|
||||
type: "zwave_js/heal_node",
|
||||
entry_id,
|
||||
node_id,
|
||||
device_id,
|
||||
});
|
||||
|
||||
export const removeFailedZwaveNode = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string,
|
||||
node_id: number,
|
||||
device_id: string,
|
||||
callbackFunction: (message: any) => void
|
||||
): Promise<UnsubscribeFunc> =>
|
||||
hass.connection.subscribeMessage(
|
||||
(message: any) => callbackFunction(message),
|
||||
{
|
||||
type: "zwave_js/remove_failed_node",
|
||||
entry_id,
|
||||
node_id,
|
||||
device_id,
|
||||
}
|
||||
);
|
||||
|
||||
@ -538,16 +523,14 @@ export const stopHealZwaveNetwork = (
|
||||
|
||||
export const subscribeZwaveNodeReady = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string,
|
||||
node_id: number,
|
||||
device_id: string,
|
||||
callbackFunction: (message) => void
|
||||
): Promise<UnsubscribeFunc> =>
|
||||
hass.connection.subscribeMessage(
|
||||
(message: any) => callbackFunction(message),
|
||||
{
|
||||
type: "zwave_js/node_ready",
|
||||
entry_id,
|
||||
node_id,
|
||||
device_id,
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -11,8 +11,6 @@ import { customElement, property, state } from "lit/decorators";
|
||||
import { DeviceRegistryEntry } from "../../../../../../data/device_registry";
|
||||
import {
|
||||
fetchZwaveNodeStatus,
|
||||
getZwaveJsIdentifiersFromDevice,
|
||||
ZWaveJSNodeIdentifiers,
|
||||
ZWaveJSNodeStatus,
|
||||
} from "../../../../../../data/zwave_js";
|
||||
import { haStyle } from "../../../../../../resources/styles";
|
||||
@ -20,6 +18,7 @@ import { HomeAssistant } from "../../../../../../types";
|
||||
import { showZWaveJSReinterviewNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-reinterview-node";
|
||||
import { showZWaveJSHealNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-heal-node";
|
||||
import { showZWaveJSRemoveFailedNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-remove-failed-node";
|
||||
import { getConfigEntries } from "../../../../../../data/config_entries";
|
||||
|
||||
@customElement("ha-device-actions-zwave_js")
|
||||
export class HaDeviceActionsZWaveJS extends LitElement {
|
||||
@ -29,34 +28,37 @@ export class HaDeviceActionsZWaveJS extends LitElement {
|
||||
|
||||
@state() private _entryId?: string;
|
||||
|
||||
@state() private _nodeId?: number;
|
||||
|
||||
@state() private _node?: ZWaveJSNodeStatus;
|
||||
|
||||
protected updated(changedProperties: PropertyValues) {
|
||||
public willUpdate(changedProperties: PropertyValues) {
|
||||
super.willUpdate(changedProperties);
|
||||
if (changedProperties.has("device")) {
|
||||
const identifiers: ZWaveJSNodeIdentifiers | undefined =
|
||||
getZwaveJsIdentifiersFromDevice(this.device);
|
||||
if (!identifiers) {
|
||||
return;
|
||||
}
|
||||
this._nodeId = identifiers.node_id;
|
||||
this._entryId = this.device.config_entries[0];
|
||||
|
||||
this._fetchNodeDetails();
|
||||
}
|
||||
}
|
||||
|
||||
protected async _fetchNodeDetails() {
|
||||
if (!this._nodeId || !this._entryId) {
|
||||
if (!this.device) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._node = await fetchZwaveNodeStatus(
|
||||
this.hass,
|
||||
this._entryId,
|
||||
this._nodeId
|
||||
this._node = undefined;
|
||||
|
||||
const configEntries = await getConfigEntries(this.hass, {
|
||||
domain: "zwave_js",
|
||||
});
|
||||
|
||||
const configEntry = configEntries.find((entry) =>
|
||||
this.device.config_entries.includes(entry.entry_id)
|
||||
);
|
||||
|
||||
if (!configEntry) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._entryId = configEntry.entry_id;
|
||||
|
||||
this._node = await fetchZwaveNodeStatus(this.hass, this.device.id);
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
@ -96,33 +98,30 @@ export class HaDeviceActionsZWaveJS extends LitElement {
|
||||
}
|
||||
|
||||
private async _reinterviewClicked() {
|
||||
if (!this._nodeId || !this._entryId) {
|
||||
if (!this.device) {
|
||||
return;
|
||||
}
|
||||
showZWaveJSReinterviewNodeDialog(this, {
|
||||
entry_id: this._entryId,
|
||||
node_id: this._nodeId,
|
||||
device_id: this.device.id,
|
||||
});
|
||||
}
|
||||
|
||||
private async _healNodeClicked() {
|
||||
if (!this._nodeId || !this._entryId) {
|
||||
if (!this.device) {
|
||||
return;
|
||||
}
|
||||
showZWaveJSHealNodeDialog(this, {
|
||||
entry_id: this._entryId,
|
||||
node_id: this._nodeId,
|
||||
entry_id: this._entryId!,
|
||||
device: this.device,
|
||||
});
|
||||
}
|
||||
|
||||
private async _removeFailedNode() {
|
||||
if (!this._nodeId || !this._entryId) {
|
||||
if (!this.device) {
|
||||
return;
|
||||
}
|
||||
showZWaveJSRemoveFailedNodeDialog(this, {
|
||||
entry_id: this._entryId,
|
||||
node_id: this._nodeId,
|
||||
device_id: this.device.id,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,8 @@ import {
|
||||
} from "../../../../../../data/config_entries";
|
||||
import {
|
||||
fetchZwaveNodeStatus,
|
||||
getZwaveJsIdentifiersFromDevice,
|
||||
nodeStatus,
|
||||
ZWaveJSNodeStatus,
|
||||
ZWaveJSNodeIdentifiers,
|
||||
SecurityClass,
|
||||
} from "../../../../../../data/zwave_js";
|
||||
import { haStyle } from "../../../../../../resources/styles";
|
||||
@ -29,57 +27,41 @@ export class HaDeviceInfoZWaveJS extends LitElement {
|
||||
|
||||
@property({ attribute: false }) public device!: DeviceRegistryEntry;
|
||||
|
||||
@state() private _entryId?: string;
|
||||
|
||||
@state() private _configEntry?: ConfigEntry;
|
||||
|
||||
@state() private _multipleConfigEntries = false;
|
||||
|
||||
@state() private _nodeId?: number;
|
||||
|
||||
@state() private _node?: ZWaveJSNodeStatus;
|
||||
|
||||
protected updated(changedProperties: PropertyValues) {
|
||||
public willUpdate(changedProperties: PropertyValues) {
|
||||
super.willUpdate(changedProperties);
|
||||
if (changedProperties.has("device")) {
|
||||
const identifiers: ZWaveJSNodeIdentifiers | undefined =
|
||||
getZwaveJsIdentifiersFromDevice(this.device);
|
||||
if (!identifiers) {
|
||||
return;
|
||||
}
|
||||
this._nodeId = identifiers.node_id;
|
||||
this._entryId = this.device.config_entries[0];
|
||||
|
||||
this._fetchNodeDetails();
|
||||
}
|
||||
}
|
||||
|
||||
protected async _fetchNodeDetails() {
|
||||
if (!this._nodeId || !this._entryId) {
|
||||
if (!this.device) {
|
||||
return;
|
||||
}
|
||||
|
||||
const configEntries = await getConfigEntries(this.hass, {
|
||||
domain: "zwave_js",
|
||||
});
|
||||
let zwaveJsConfEntries = 0;
|
||||
for (const entry of configEntries) {
|
||||
if (zwaveJsConfEntries) {
|
||||
this._multipleConfigEntries = true;
|
||||
}
|
||||
if (entry.entry_id === this._entryId) {
|
||||
this._configEntry = entry;
|
||||
}
|
||||
if (this._configEntry && this._multipleConfigEntries) {
|
||||
break;
|
||||
}
|
||||
zwaveJsConfEntries++;
|
||||
|
||||
this._multipleConfigEntries = configEntries.length > 1;
|
||||
|
||||
const configEntry = configEntries.find((entry) =>
|
||||
this.device.config_entries.includes(entry.entry_id)
|
||||
);
|
||||
|
||||
if (!configEntry) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._node = await fetchZwaveNodeStatus(
|
||||
this.hass,
|
||||
this._entryId,
|
||||
this._nodeId
|
||||
);
|
||||
this._configEntry = configEntry;
|
||||
|
||||
this._node = await fetchZwaveNodeStatus(this.hass, this.device.id);
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
|
@ -922,13 +922,12 @@ export class HaConfigDevicePage extends LitElement {
|
||||
}
|
||||
|
||||
private _renderIntegrationInfo(
|
||||
device,
|
||||
device: DeviceRegistryEntry,
|
||||
integrations: ConfigEntry[],
|
||||
deviceInfo: TemplateResult[],
|
||||
deviceActions: (string | TemplateResult)[]
|
||||
): TemplateResult[] {
|
||||
) {
|
||||
const domains = integrations.map((int) => int.domain);
|
||||
const templates: TemplateResult[] = [];
|
||||
if (domains.includes("mqtt")) {
|
||||
import(
|
||||
"./device-detail/integration-elements/mqtt/ha-device-actions-mqtt"
|
||||
@ -976,7 +975,6 @@ export class HaConfigDevicePage extends LitElement {
|
||||
></ha-device-actions-zwave_js>
|
||||
`);
|
||||
}
|
||||
return templates;
|
||||
}
|
||||
|
||||
private async _showSettings() {
|
||||
|
@ -24,8 +24,6 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
|
||||
@state() private entry_id?: string;
|
||||
|
||||
@state() private node_id?: number;
|
||||
|
||||
@state() private device?: DeviceRegistryEntry;
|
||||
|
||||
@state() private _status?: string;
|
||||
@ -35,14 +33,12 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
public showDialog(params: ZWaveJSHealNodeDialogParams): void {
|
||||
this.entry_id = params.entry_id;
|
||||
this.device = params.device;
|
||||
this.node_id = params.node_id;
|
||||
this._fetchData();
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this.entry_id = undefined;
|
||||
this._status = undefined;
|
||||
this.node_id = undefined;
|
||||
this.device = undefined;
|
||||
this._error = undefined;
|
||||
|
||||
@ -221,11 +217,7 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
}
|
||||
this._status = "started";
|
||||
try {
|
||||
this._status = (await healZwaveNode(
|
||||
this.hass,
|
||||
this.entry_id!,
|
||||
this.node_id!
|
||||
))
|
||||
this._status = (await healZwaveNode(this.hass, this.device!.id))
|
||||
? "finished"
|
||||
: "failed";
|
||||
} catch (err: any) {
|
||||
|
@ -15,9 +15,7 @@ import { ZWaveJSReinterviewNodeDialogParams } from "./show-dialog-zwave_js-reint
|
||||
class DialogZWaveJSReinterviewNode extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@state() private entry_id?: string;
|
||||
|
||||
@state() private node_id?: number;
|
||||
@state() private device_id?: string;
|
||||
|
||||
@state() private _status?: string;
|
||||
|
||||
@ -29,12 +27,11 @@ class DialogZWaveJSReinterviewNode extends LitElement {
|
||||
params: ZWaveJSReinterviewNodeDialogParams
|
||||
): Promise<void> {
|
||||
this._stages = undefined;
|
||||
this.entry_id = params.entry_id;
|
||||
this.node_id = params.node_id;
|
||||
this.device_id = params.device_id;
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
if (!this.entry_id) {
|
||||
if (!this.device_id) {
|
||||
return html``;
|
||||
}
|
||||
|
||||
@ -159,8 +156,7 @@ class DialogZWaveJSReinterviewNode extends LitElement {
|
||||
}
|
||||
this._subscribed = reinterviewZwaveNode(
|
||||
this.hass,
|
||||
this.entry_id!,
|
||||
this.node_id!,
|
||||
this.device_id!,
|
||||
this._handleMessage.bind(this)
|
||||
);
|
||||
}
|
||||
@ -194,8 +190,7 @@ class DialogZWaveJSReinterviewNode extends LitElement {
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this.entry_id = undefined;
|
||||
this.node_id = undefined;
|
||||
this.device_id = undefined;
|
||||
this._status = undefined;
|
||||
this._stages = undefined;
|
||||
|
||||
|
@ -18,9 +18,7 @@ import { ZWaveJSRemoveFailedNodeDialogParams } from "./show-dialog-zwave_js-remo
|
||||
class DialogZWaveJSRemoveFailedNode extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@state() private entry_id?: string;
|
||||
|
||||
@state() private node_id?: number;
|
||||
@state() private device_id?: string;
|
||||
|
||||
@state() private _status = "";
|
||||
|
||||
@ -38,13 +36,12 @@ class DialogZWaveJSRemoveFailedNode extends LitElement {
|
||||
public async showDialog(
|
||||
params: ZWaveJSRemoveFailedNodeDialogParams
|
||||
): Promise<void> {
|
||||
this.entry_id = params.entry_id;
|
||||
this.node_id = params.node_id;
|
||||
this.device_id = params.device_id;
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this._unsubscribe();
|
||||
this.entry_id = undefined;
|
||||
this.device_id = undefined;
|
||||
this._status = "";
|
||||
|
||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||
@ -56,7 +53,7 @@ class DialogZWaveJSRemoveFailedNode extends LitElement {
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
if (!this.entry_id || !this.node_id) {
|
||||
if (!this.device_id) {
|
||||
return html``;
|
||||
}
|
||||
|
||||
@ -166,8 +163,7 @@ class DialogZWaveJSRemoveFailedNode extends LitElement {
|
||||
this._status = "started";
|
||||
this._subscribed = removeFailedZwaveNode(
|
||||
this.hass,
|
||||
this.entry_id!,
|
||||
this.node_id!,
|
||||
this.device_id!,
|
||||
(message: any) => this._handleMessage(message)
|
||||
).catch((error) => {
|
||||
this._status = "failed";
|
||||
|
@ -3,7 +3,6 @@ import { DeviceRegistryEntry } from "../../../../../data/device_registry";
|
||||
|
||||
export interface ZWaveJSHealNodeDialogParams {
|
||||
entry_id: string;
|
||||
node_id: number;
|
||||
device: DeviceRegistryEntry;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
|
||||
export interface ZWaveJSReinterviewNodeDialogParams {
|
||||
entry_id: string;
|
||||
node_id: number;
|
||||
device_id: string;
|
||||
}
|
||||
|
||||
export const loadReinterviewNodeDialog = () =>
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
|
||||
export interface ZWaveJSRemoveFailedNodeDialogParams {
|
||||
entry_id: string;
|
||||
node_id: number;
|
||||
device_id: string;
|
||||
}
|
||||
|
||||
export const loadRemoveFailedNodeDialog = () =>
|
||||
|
@ -17,7 +17,6 @@ import "../../../../../components/ha-svg-icon";
|
||||
import {
|
||||
fetchZwaveDataCollectionStatus,
|
||||
fetchZwaveNetworkStatus,
|
||||
fetchZwaveNodeStatus,
|
||||
fetchZwaveProvisioningEntries,
|
||||
InclusionState,
|
||||
setZwaveDataCollectionPreference,
|
||||
@ -25,7 +24,6 @@ import {
|
||||
stopZwaveInclusion,
|
||||
ZWaveJSClient,
|
||||
ZWaveJSNetwork,
|
||||
ZWaveJSNodeStatus,
|
||||
ZwaveJSProvisioningEntry,
|
||||
} from "../../../../../data/zwave_js";
|
||||
import {
|
||||
@ -60,8 +58,6 @@ class ZWaveJSConfigDashboard extends LitElement {
|
||||
|
||||
@state() private _network?: ZWaveJSNetwork;
|
||||
|
||||
@state() private _nodes?: ZWaveJSNodeStatus[];
|
||||
|
||||
@state() private _provisioningEntries?: ZwaveJSProvisioningEntry[];
|
||||
|
||||
@state() private _status?: ZWaveJSClient["state"];
|
||||
@ -84,9 +80,8 @@ class ZWaveJSConfigDashboard extends LitElement {
|
||||
if (ERROR_STATES.includes(this._configEntry.state)) {
|
||||
return this._renderErrorScreen();
|
||||
}
|
||||
|
||||
const notReadyDevices =
|
||||
this._nodes?.filter((node) => !node.ready).length ?? 0;
|
||||
this._network?.controller.nodes.filter((node) => !node.ready).length ?? 0;
|
||||
|
||||
return html`
|
||||
<hass-tabs-subpage
|
||||
@ -414,18 +409,6 @@ class ZWaveJSConfigDashboard extends LitElement {
|
||||
this._dataCollectionOptIn =
|
||||
dataCollectionStatus.opted_in === true ||
|
||||
dataCollectionStatus.enabled === true;
|
||||
|
||||
this._fetchNodeStatus();
|
||||
}
|
||||
|
||||
private async _fetchNodeStatus() {
|
||||
if (!this._network) {
|
||||
return;
|
||||
}
|
||||
const nodeStatePromisses = this._network.controller.nodes.map((nodeId) =>
|
||||
fetchZwaveNodeStatus(this.hass, this.configEntryId!, nodeId)
|
||||
);
|
||||
this._nodes = await Promise.all(nodeStatePromisses);
|
||||
}
|
||||
|
||||
private async _addNodeClicked() {
|
||||
|
@ -61,19 +61,6 @@ const getDevice = memoizeOne(
|
||||
entries?.find((device) => device.id === deviceId)
|
||||
);
|
||||
|
||||
const getNodeId = memoizeOne(
|
||||
(device: DeviceRegistryEntry): number | undefined => {
|
||||
const identifier = device.identifiers.find(
|
||||
(ident) => ident[0] === "zwave_js"
|
||||
);
|
||||
if (!identifier) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return parseInt(identifier[1].split("-")[1]);
|
||||
}
|
||||
);
|
||||
|
||||
@customElement("zwave_js-node-config")
|
||||
class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
@ -382,12 +369,10 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
||||
}
|
||||
|
||||
private async _updateConfigParameter(target, value) {
|
||||
const nodeId = getNodeId(this._device!);
|
||||
try {
|
||||
const result = await setZwaveNodeConfigParameter(
|
||||
this.hass,
|
||||
this.configEntryId!,
|
||||
nodeId!,
|
||||
this._device!.id,
|
||||
target.property,
|
||||
value,
|
||||
target.propertyKey ? target.propertyKey : undefined
|
||||
@ -429,15 +414,9 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nodeId = getNodeId(device);
|
||||
if (!nodeId) {
|
||||
this._error = "device_not_found";
|
||||
return;
|
||||
}
|
||||
|
||||
[this._nodeMetadata, this._config] = await Promise.all([
|
||||
fetchZwaveNodeMetadata(this.hass, this.configEntryId, nodeId!),
|
||||
fetchZwaveNodeConfigParameters(this.hass, this.configEntryId, nodeId!),
|
||||
fetchZwaveNodeMetadata(this.hass, device.id),
|
||||
fetchZwaveNodeConfigParameters(this.hass, device.id),
|
||||
]);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user