mirror of
				https://github.com/home-assistant/frontend.git
				synced 2025-11-04 00:19:47 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			20250210.0
			...
			zwave-js-m
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					e5f64bb26d | 
@@ -20,6 +20,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 {
 | 
			
		||||
@@ -33,24 +34,35 @@ export class HaDeviceActionsZWaveJS extends LitElement {
 | 
			
		||||
 | 
			
		||||
  @state() private _node?: ZWaveJSNodeStatus;
 | 
			
		||||
 | 
			
		||||
  protected updated(changedProperties: PropertyValues) {
 | 
			
		||||
  public willUpdate(changedProperties: PropertyValues) {
 | 
			
		||||
    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) {
 | 
			
		||||
    this._node = undefined;
 | 
			
		||||
 | 
			
		||||
    const identifiers: ZWaveJSNodeIdentifiers | undefined =
 | 
			
		||||
      getZwaveJsIdentifiersFromDevice(this.device);
 | 
			
		||||
    if (!identifiers) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    this._nodeId = identifiers.node_id;
 | 
			
		||||
 | 
			
		||||
    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,
 | 
			
		||||
@@ -137,3 +149,9 @@ export class HaDeviceActionsZWaveJS extends LitElement {
 | 
			
		||||
    ];
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
declare global {
 | 
			
		||||
  interface HTMLElementTagNameMap {
 | 
			
		||||
    "ha-device-actions-zwave_js": HaDeviceActionsZWaveJS;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -39,40 +39,38 @@ export class HaDeviceInfoZWaveJS extends LitElement {
 | 
			
		||||
 | 
			
		||||
  @state() private _node?: ZWaveJSNodeStatus;
 | 
			
		||||
 | 
			
		||||
  protected updated(changedProperties: PropertyValues) {
 | 
			
		||||
  public willUpdate(changedProperties: PropertyValues) {
 | 
			
		||||
    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) {
 | 
			
		||||
    this._node = undefined;
 | 
			
		||||
 | 
			
		||||
    const identifiers: ZWaveJSNodeIdentifiers | undefined =
 | 
			
		||||
      getZwaveJsIdentifiersFromDevice(this.device);
 | 
			
		||||
    if (!identifiers) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    this._nodeId = identifiers.node_id;
 | 
			
		||||
 | 
			
		||||
    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._configEntry = configEntries.find((entry) =>
 | 
			
		||||
      this.device.config_entries.includes(entry.entry_id)
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    if (!this._configEntry) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this._entryId = this._configEntry.entry_id;
 | 
			
		||||
 | 
			
		||||
    if (configEntries.length > 1) {
 | 
			
		||||
      this._multipleConfigEntries = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this._node = await fetchZwaveNodeStatus(
 | 
			
		||||
 
 | 
			
		||||
@@ -895,13 +895,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"
 | 
			
		||||
@@ -949,7 +948,6 @@ export class HaConfigDevicePage extends LitElement {
 | 
			
		||||
        ></ha-device-actions-zwave_js>
 | 
			
		||||
      `);
 | 
			
		||||
    }
 | 
			
		||||
    return templates;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private async _showSettings() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user