8faf5c1c79
Import a Z-Wave JS UI (zwavejs2mqtt) network over the MQTT gateway API, mirroring the existing Zigbee pipeline: - New Z-Wave Import modal + sidebar entry (broker, prefix, gateway name) - coordinator/router/end-device typing with mesh tree from node neighbors - import to Pending section or straight to canvas - Pending Devices gains a Z-Wave source filter - shared mqtt_common helpers extracted from the zigbee service ha-relevant: yes
22 lines
953 B
TypeScript
22 lines
953 B
TypeScript
import type { NodeProperty, NodeType } from '@/types'
|
|
|
|
const ZWAVE_TYPES: NodeType[] = ['zwave_coordinator', 'zwave_router', 'zwave_enddevice']
|
|
|
|
export function isZwaveType(type: NodeType | string | undefined | null): boolean {
|
|
return !!type && (ZWAVE_TYPES as string[]).includes(type)
|
|
}
|
|
|
|
/** Build the Z-Wave ID/Vendor/Model property rows shown in the right panel.
|
|
* Matches backend `build_zwave_properties` (no LQI — Z-Wave has none). */
|
|
export function buildZwaveProperties(input: {
|
|
ieee_address?: string | null
|
|
vendor?: string | null
|
|
model?: string | null
|
|
}): NodeProperty[] {
|
|
const props: NodeProperty[] = []
|
|
if (input.ieee_address) props.push({ key: 'Z-Wave ID', value: input.ieee_address, icon: null, visible: false })
|
|
if (input.vendor) props.push({ key: 'Vendor', value: input.vendor, icon: null, visible: false })
|
|
if (input.model) props.push({ key: 'Model', value: input.model, icon: null, visible: false })
|
|
return props
|
|
}
|