mirror of
				https://github.com/home-assistant/frontend.git
				synced 2025-10-26 12:09:47 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			20250509.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 { 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 { 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 { 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") | @customElement("ha-device-actions-zwave_js") | ||||||
| export class HaDeviceActionsZWaveJS extends LitElement { | export class HaDeviceActionsZWaveJS extends LitElement { | ||||||
| @@ -33,25 +34,36 @@ export class HaDeviceActionsZWaveJS extends LitElement { | |||||||
|  |  | ||||||
|   @state() private _node?: ZWaveJSNodeStatus; |   @state() private _node?: ZWaveJSNodeStatus; | ||||||
|  |  | ||||||
|   protected updated(changedProperties: PropertyValues) { |   public willUpdate(changedProperties: PropertyValues) { | ||||||
|     if (changedProperties.has("device")) { |     if (changedProperties.has("device")) { | ||||||
|  |       this._fetchNodeDetails(); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   protected async _fetchNodeDetails() { | ||||||
|  |     this._node = undefined; | ||||||
|  |  | ||||||
|     const identifiers: ZWaveJSNodeIdentifiers | undefined = |     const identifiers: ZWaveJSNodeIdentifiers | undefined = | ||||||
|       getZwaveJsIdentifiersFromDevice(this.device); |       getZwaveJsIdentifiersFromDevice(this.device); | ||||||
|     if (!identifiers) { |     if (!identifiers) { | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     this._nodeId = identifiers.node_id; |     this._nodeId = identifiers.node_id; | ||||||
|       this._entryId = this.device.config_entries[0]; |  | ||||||
|  |  | ||||||
|       this._fetchNodeDetails(); |     const configEntries = await getConfigEntries(this.hass, { | ||||||
|     } |       domain: "zwave_js", | ||||||
|   } |     }); | ||||||
|  |  | ||||||
|   protected async _fetchNodeDetails() { |     const configEntry = configEntries.find((entry) => | ||||||
|     if (!this._nodeId || !this._entryId) { |       this.device.config_entries.includes(entry.entry_id) | ||||||
|  |     ); | ||||||
|  |  | ||||||
|  |     if (!configEntry) { | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     this._entryId = configEntry.entry_id; | ||||||
|  |  | ||||||
|     this._node = await fetchZwaveNodeStatus( |     this._node = await fetchZwaveNodeStatus( | ||||||
|       this.hass, |       this.hass, | ||||||
|       this._entryId, |       this._entryId, | ||||||
| @@ -137,3 +149,9 @@ export class HaDeviceActionsZWaveJS extends LitElement { | |||||||
|     ]; |     ]; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | declare global { | ||||||
|  |   interface HTMLElementTagNameMap { | ||||||
|  |     "ha-device-actions-zwave_js": HaDeviceActionsZWaveJS; | ||||||
|  |   } | ||||||
|  | } | ||||||
|   | |||||||
| @@ -39,41 +39,39 @@ export class HaDeviceInfoZWaveJS extends LitElement { | |||||||
|  |  | ||||||
|   @state() private _node?: ZWaveJSNodeStatus; |   @state() private _node?: ZWaveJSNodeStatus; | ||||||
|  |  | ||||||
|   protected updated(changedProperties: PropertyValues) { |   public willUpdate(changedProperties: PropertyValues) { | ||||||
|     if (changedProperties.has("device")) { |     if (changedProperties.has("device")) { | ||||||
|  |       this._fetchNodeDetails(); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   protected async _fetchNodeDetails() { | ||||||
|  |     this._node = undefined; | ||||||
|  |  | ||||||
|     const identifiers: ZWaveJSNodeIdentifiers | undefined = |     const identifiers: ZWaveJSNodeIdentifiers | undefined = | ||||||
|       getZwaveJsIdentifiersFromDevice(this.device); |       getZwaveJsIdentifiersFromDevice(this.device); | ||||||
|     if (!identifiers) { |     if (!identifiers) { | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     this._nodeId = identifiers.node_id; |     this._nodeId = identifiers.node_id; | ||||||
|       this._entryId = this.device.config_entries[0]; |  | ||||||
|  |  | ||||||
|       this._fetchNodeDetails(); |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   protected async _fetchNodeDetails() { |  | ||||||
|     if (!this._nodeId || !this._entryId) { |  | ||||||
|       return; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     const configEntries = await getConfigEntries(this.hass, { |     const configEntries = await getConfigEntries(this.hass, { | ||||||
|       domain: "zwave_js", |       domain: "zwave_js", | ||||||
|     }); |     }); | ||||||
|     let zwaveJsConfEntries = 0; |  | ||||||
|     for (const entry of configEntries) { |     this._configEntry = configEntries.find((entry) => | ||||||
|       if (zwaveJsConfEntries) { |       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._multipleConfigEntries = true; | ||||||
|     } |     } | ||||||
|       if (entry.entry_id === this._entryId) { |  | ||||||
|         this._configEntry = entry; |  | ||||||
|       } |  | ||||||
|       if (this._configEntry && this._multipleConfigEntries) { |  | ||||||
|         break; |  | ||||||
|       } |  | ||||||
|       zwaveJsConfEntries++; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     this._node = await fetchZwaveNodeStatus( |     this._node = await fetchZwaveNodeStatus( | ||||||
|       this.hass, |       this.hass, | ||||||
|   | |||||||
| @@ -895,13 +895,12 @@ export class HaConfigDevicePage extends LitElement { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   private _renderIntegrationInfo( |   private _renderIntegrationInfo( | ||||||
|     device, |     device: DeviceRegistryEntry, | ||||||
|     integrations: ConfigEntry[], |     integrations: ConfigEntry[], | ||||||
|     deviceInfo: TemplateResult[], |     deviceInfo: TemplateResult[], | ||||||
|     deviceActions: (string | TemplateResult)[] |     deviceActions: (string | TemplateResult)[] | ||||||
|   ): TemplateResult[] { |   ) { | ||||||
|     const domains = integrations.map((int) => int.domain); |     const domains = integrations.map((int) => int.domain); | ||||||
|     const templates: TemplateResult[] = []; |  | ||||||
|     if (domains.includes("mqtt")) { |     if (domains.includes("mqtt")) { | ||||||
|       import( |       import( | ||||||
|         "./device-detail/integration-elements/mqtt/ha-device-actions-mqtt" |         "./device-detail/integration-elements/mqtt/ha-device-actions-mqtt" | ||||||
| @@ -949,7 +948,6 @@ export class HaConfigDevicePage extends LitElement { | |||||||
|         ></ha-device-actions-zwave_js> |         ></ha-device-actions-zwave_js> | ||||||
|       `); |       `); | ||||||
|     } |     } | ||||||
|     return templates; |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   private async _showSettings() { |   private async _showSettings() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user