mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-26 22:37:21 +00:00
Add direct link to zwave_js device's device DB page (#9797)
Co-authored-by: Charles Garwood <cgarwood@newdealmultimedia.com> Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
5bd92d04d9
commit
900efe8a36
@ -24,12 +24,22 @@ export interface ZWaveJSController {
|
|||||||
is_heal_network_active: boolean;
|
is_heal_network_active: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ZWaveJSNode {
|
export interface ZWaveJSNodeStatus {
|
||||||
node_id: number;
|
node_id: number;
|
||||||
ready: boolean;
|
ready: boolean;
|
||||||
status: number;
|
status: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ZwaveJSNodeMetadata {
|
||||||
|
node_id: number;
|
||||||
|
exclusion: string;
|
||||||
|
inclusion: string;
|
||||||
|
manual: string;
|
||||||
|
wakeup: string;
|
||||||
|
reset: string;
|
||||||
|
device_database_url: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ZWaveJSNodeConfigParams {
|
export interface ZWaveJSNodeConfigParams {
|
||||||
[key: string]: ZWaveJSNodeConfigParam;
|
[key: string]: ZWaveJSNodeConfigParam;
|
||||||
}
|
}
|
||||||
@ -132,13 +142,24 @@ export const fetchNodeStatus = (
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entry_id: string,
|
entry_id: string,
|
||||||
node_id: number
|
node_id: number
|
||||||
): Promise<ZWaveJSNode> =>
|
): Promise<ZWaveJSNodeStatus> =>
|
||||||
hass.callWS({
|
hass.callWS({
|
||||||
type: "zwave_js/node_status",
|
type: "zwave_js/node_status",
|
||||||
entry_id,
|
entry_id,
|
||||||
node_id,
|
node_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const fetchNodeMetadata = (
|
||||||
|
hass: HomeAssistant,
|
||||||
|
entry_id: string,
|
||||||
|
node_id: number
|
||||||
|
): Promise<ZwaveJSNodeMetadata> =>
|
||||||
|
hass.callWS({
|
||||||
|
type: "zwave_js/node_metadata",
|
||||||
|
entry_id,
|
||||||
|
node_id,
|
||||||
|
});
|
||||||
|
|
||||||
export const fetchNodeConfigParameters = (
|
export const fetchNodeConfigParameters = (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entry_id: string,
|
entry_id: string,
|
||||||
|
@ -16,7 +16,7 @@ import {
|
|||||||
fetchNodeStatus,
|
fetchNodeStatus,
|
||||||
getIdentifiersFromDevice,
|
getIdentifiersFromDevice,
|
||||||
nodeStatus,
|
nodeStatus,
|
||||||
ZWaveJSNode,
|
ZWaveJSNodeStatus,
|
||||||
ZWaveJSNodeIdentifiers,
|
ZWaveJSNodeIdentifiers,
|
||||||
} from "../../../../../../data/zwave_js";
|
} from "../../../../../../data/zwave_js";
|
||||||
import { haStyle } from "../../../../../../resources/styles";
|
import { haStyle } from "../../../../../../resources/styles";
|
||||||
@ -36,7 +36,7 @@ export class HaDeviceInfoZWaveJS extends LitElement {
|
|||||||
|
|
||||||
@state() private _nodeId?: number;
|
@state() private _nodeId?: number;
|
||||||
|
|
||||||
@state() private _node?: ZWaveJSNode;
|
@state() private _node?: ZWaveJSNodeStatus;
|
||||||
|
|
||||||
protected updated(changedProperties: PropertyValues) {
|
protected updated(changedProperties: PropertyValues) {
|
||||||
if (changedProperties.has("device")) {
|
if (changedProperties.has("device")) {
|
||||||
|
@ -15,7 +15,7 @@ import {
|
|||||||
NodeStatus,
|
NodeStatus,
|
||||||
setDataCollectionPreference,
|
setDataCollectionPreference,
|
||||||
ZWaveJSNetwork,
|
ZWaveJSNetwork,
|
||||||
ZWaveJSNode,
|
ZWaveJSNodeStatus,
|
||||||
} from "../../../../../data/zwave_js";
|
} from "../../../../../data/zwave_js";
|
||||||
import {
|
import {
|
||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
@ -53,7 +53,7 @@ class ZWaveJSConfigDashboard extends LitElement {
|
|||||||
|
|
||||||
@state() private _network?: ZWaveJSNetwork;
|
@state() private _network?: ZWaveJSNetwork;
|
||||||
|
|
||||||
@state() private _nodes?: ZWaveJSNode[];
|
@state() private _nodes?: ZWaveJSNodeStatus[];
|
||||||
|
|
||||||
@state() private _status = "unknown";
|
@state() private _status = "unknown";
|
||||||
|
|
||||||
|
@ -34,8 +34,10 @@ import {
|
|||||||
} from "../../../../../data/device_registry";
|
} from "../../../../../data/device_registry";
|
||||||
import {
|
import {
|
||||||
fetchNodeConfigParameters,
|
fetchNodeConfigParameters,
|
||||||
|
fetchNodeMetadata,
|
||||||
setNodeConfigParameter,
|
setNodeConfigParameter,
|
||||||
ZWaveJSNodeConfigParams,
|
ZWaveJSNodeConfigParams,
|
||||||
|
ZwaveJSNodeMetadata,
|
||||||
ZWaveJSSetConfigParamResult,
|
ZWaveJSSetConfigParamResult,
|
||||||
} from "../../../../../data/zwave_js";
|
} from "../../../../../data/zwave_js";
|
||||||
import "../../../../../layouts/hass-tabs-subpage";
|
import "../../../../../layouts/hass-tabs-subpage";
|
||||||
@ -89,6 +91,8 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
@property({ type: Array })
|
@property({ type: Array })
|
||||||
private _deviceRegistryEntries?: DeviceRegistryEntry[];
|
private _deviceRegistryEntries?: DeviceRegistryEntry[];
|
||||||
|
|
||||||
|
@state() private _nodeMetadata?: ZwaveJSNodeMetadata;
|
||||||
|
|
||||||
@state() private _config?: ZWaveJSNodeConfigParams;
|
@state() private _config?: ZWaveJSNodeConfigParams;
|
||||||
|
|
||||||
@state() private _results: Record<string, ZWaveJSSetConfigParamResult> = {};
|
@state() private _results: Record<string, ZWaveJSSetConfigParamResult> = {};
|
||||||
@ -162,7 +166,11 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.zwave_js.node_config.attribution",
|
"ui.panel.config.zwave_js.node_config.attribution",
|
||||||
"device_database",
|
"device_database",
|
||||||
html`<a href="https://devices.zwave-js.io/" target="_blank"
|
html`<a
|
||||||
|
rel="noreferrer noopener"
|
||||||
|
href="${this._nodeMetadata?.device_database_url ||
|
||||||
|
"https://devices.zwave-js.io"}"
|
||||||
|
target="_blank"
|
||||||
>${this.hass.localize(
|
>${this.hass.localize(
|
||||||
"ui.panel.config.zwave_js.node_config.zwave_js_device_database"
|
"ui.panel.config.zwave_js.node_config.zwave_js_device_database"
|
||||||
)}</a
|
)}</a
|
||||||
@ -421,11 +429,10 @@ class ZWaveJSNodeConfig extends SubscribeMixin(LitElement) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._config = await fetchNodeConfigParameters(
|
[this._nodeMetadata, this._config] = await Promise.all([
|
||||||
this.hass,
|
fetchNodeMetadata(this.hass, this.configEntryId, nodeId!),
|
||||||
this.configEntryId,
|
fetchNodeConfigParameters(this.hass, this.configEntryId, nodeId!),
|
||||||
nodeId!
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user