mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
ZwaveJS: Handle S2 inclusion via Inclusion Controller (#23100)
This commit is contained in:
parent
af049274d9
commit
e02736b4e2
@ -398,6 +398,11 @@ export interface ZWaveJSRemovedNode {
|
|||||||
label: string;
|
label: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ZWaveJSS2InclusionValidateDskAndEnterPinMessage {
|
||||||
|
event: "validate dsk and enter pin";
|
||||||
|
dsk: string;
|
||||||
|
}
|
||||||
|
|
||||||
export const enum NodeStatus {
|
export const enum NodeStatus {
|
||||||
Unknown,
|
Unknown,
|
||||||
Asleep,
|
Asleep,
|
||||||
@ -808,6 +813,21 @@ export const subscribeZwaveNodeStatistics = (
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const subscribeS2Inclusion = (
|
||||||
|
hass: HomeAssistant,
|
||||||
|
entry_id: string,
|
||||||
|
callbackFunction: (
|
||||||
|
message: ZWaveJSS2InclusionValidateDskAndEnterPinMessage
|
||||||
|
) => void
|
||||||
|
): Promise<UnsubscribeFunc> =>
|
||||||
|
hass.connection.subscribeMessage(
|
||||||
|
(message: any) => callbackFunction(message),
|
||||||
|
{
|
||||||
|
type: "zwave_js/subscribe_s2_inclusion",
|
||||||
|
entry_id,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export const fetchZwaveIsNodeFirmwareUpdateInProgress = (
|
export const fetchZwaveIsNodeFirmwareUpdateInProgress = (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
device_id: string
|
device_id: string
|
||||||
|
@ -105,11 +105,21 @@ class DialogZWaveJSAddNode extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async showDialog(params: ZWaveJSAddNodeDialogParams): Promise<void> {
|
public async showDialog(params: ZWaveJSAddNodeDialogParams): Promise<void> {
|
||||||
|
if (this._status) {
|
||||||
|
// already started
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._params = params;
|
this._params = params;
|
||||||
this._entryId = params.entry_id;
|
this._entryId = params.entry_id;
|
||||||
this._status = "loading";
|
this._status = "loading";
|
||||||
this._checkSmartStartSupport();
|
this._checkSmartStartSupport();
|
||||||
this._startInclusion();
|
if (params.dsk) {
|
||||||
|
this._status = "validate_dsk_enter_pin";
|
||||||
|
this._dsk = params.dsk;
|
||||||
|
this._startInclusion(undefined, params.dsk);
|
||||||
|
} else {
|
||||||
|
this._startInclusion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@query("#pin-input") private _pinInput?: HaTextField;
|
@query("#pin-input") private _pinInput?: HaTextField;
|
||||||
|
@ -2,6 +2,7 @@ import { fireEvent } from "../../../../../common/dom/fire_event";
|
|||||||
|
|
||||||
export interface ZWaveJSAddNodeDialogParams {
|
export interface ZWaveJSAddNodeDialogParams {
|
||||||
entry_id: string;
|
entry_id: string;
|
||||||
|
dsk?: string;
|
||||||
onStop?: () => void;
|
onStop?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ import {
|
|||||||
fetchZwaveProvisioningEntries,
|
fetchZwaveProvisioningEntries,
|
||||||
InclusionState,
|
InclusionState,
|
||||||
setZwaveDataCollectionPreference,
|
setZwaveDataCollectionPreference,
|
||||||
|
subscribeS2Inclusion,
|
||||||
subscribeZwaveControllerStatistics,
|
subscribeZwaveControllerStatistics,
|
||||||
} from "../../../../../data/zwave_js";
|
} from "../../../../../data/zwave_js";
|
||||||
import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow";
|
import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow";
|
||||||
@ -102,6 +103,13 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) {
|
|||||||
this._statistics = message;
|
this._statistics = message;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
subscribeS2Inclusion(this.hass, this.configEntryId, (message) => {
|
||||||
|
showZWaveJSAddNodeDialog(this, {
|
||||||
|
entry_id: this.configEntryId,
|
||||||
|
dsk: message.dsk,
|
||||||
|
onStop: () => setTimeout(() => this._fetchData(), 100),
|
||||||
|
});
|
||||||
|
}),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user