Can't seem to find this in the docs... what is the correct way to enumerate thru devices to find the node number of a Z-Wave device?
Announcement
Collapse
No announcement yet.
Script to find Z-wave node
Collapse
X
-
The best place to get that is the Node Information page in the Z-Wave plugin. If you still want a script, here's a quick one that will report the nodes to a .txt file:
Code:Public Sub Main(ByVal parm As Object) Dim dev As Scheduler.Classes.DeviceClass Dim sw As System.IO.StreamWriter Dim pdata As clsPlugExtraData = Nothing Dim pk() As String Dim s As Object Dim x As Integer Try sw = New System.IO.StreamWriter("DumpZWaveDevices.txt", False) Dim EN As Scheduler.Classes.clsDeviceEnumeration EN = hs.GetDeviceEnumerator If EN Is Nothing Then Throw New Exception("failed to get a device enumerator from HomeSeer.") Do dev = EN.GetNext If dev Is Nothing Then Continue Do pdata = dev.PlugExtraData_Get(hs) If (pdata IsNot Nothing) Then pk = pdata.GetNamedKeys() If (pk IsNot Nothing) Then For x = 0 To pk.Length() - 1 s = pdata.GetNamed(pk(x)) If (pk(x) = "node_id") Then sw.WriteLine("ref=(" & dev.ref(hs) & ") - " & dev.Location(hs) & " - " & dev.Location2(hs) & " - " & dev.Name(hs) & ": " & pk(x).ToString() & " = " & s.ToString()) End If Next End If End If Loop Until EN.Finished Catch ex As Exception hs.WriteLog("DumpZWaveDevices", ex.Message) Finally If (Not sw Is Nothing) Then sw.Close() End Try End Sub
HS4Pro on a Raspberry Pi4
54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI
HSTouch Clients: 1 Android
Comment
-
Originally posted by rmasonjr View PostThe best place to get that is the Node Information page in the Z-Wave plugin. If you still want a script, here's a quick one that will report the nodes to a .txt file:
Code:Public Sub Main(ByVal parm As Object) Dim dev As Scheduler.Classes.DeviceClass Dim sw As System.IO.StreamWriter Dim pdata As clsPlugExtraData = Nothing Dim pk() As String Dim s As Object Dim x As Integer Try sw = New System.IO.StreamWriter("DumpZWaveDevices.txt", False) Dim EN As Scheduler.Classes.clsDeviceEnumeration EN = hs.GetDeviceEnumerator If EN Is Nothing Then Throw New Exception("failed to get a device enumerator from HomeSeer.") Do dev = EN.GetNext If dev Is Nothing Then Continue Do pdata = dev.PlugExtraData_Get(hs) If (pdata IsNot Nothing) Then pk = pdata.GetNamedKeys() If (pk IsNot Nothing) Then For x = 0 To pk.Length() - 1 s = pdata.GetNamed(pk(x)) If (pk(x) = "node_id") Then sw.WriteLine(dev.Location(hs) & " - " & dev.Location2(hs) & " - " & dev.Name(hs) & ": " & pk(x).ToString() & " = " & s.ToString()) End If Next End If End If Loop Until EN.Finished Catch ex As Exception hs.WriteLog("DumpZWaveDevices", ex.Message) Finally If (Not sw Is Nothing) Then sw.Close() End Try End Sub
Comment
-
Originally posted by numgis View PostBy the way, is there a way to modify the script to show list of device numbers instead, or even better both node and device numbers? I get errors like this in the log but have no idea which device is #580...
Mar-11 10:51:00 PM Z-Wave Error Device 580 is being set to an invalid value: 0
Try that and see if that works for you...HS4Pro on a Raspberry Pi4
54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI
HSTouch Clients: 1 Android
Comment
-
Originally posted by rmasonjr View PostThe best place to get that is the Node Information page in the Z-Wave plugin. If you still want a script, here's a quick one that will report the nodes to a .txt file:
Code:Public Sub Main(ByVal parm As Object) Dim dev As Scheduler.Classes.DeviceClass Dim sw As System.IO.StreamWriter Dim pdata As clsPlugExtraData = Nothing Dim pk() As String Dim s As Object Dim x As Integer Try sw = New System.IO.StreamWriter("DumpZWaveDevices.txt", False) Dim EN As Scheduler.Classes.clsDeviceEnumeration EN = hs.GetDeviceEnumerator If EN Is Nothing Then Throw New Exception("failed to get a device enumerator from HomeSeer.") Do dev = EN.GetNext If dev Is Nothing Then Continue Do pdata = dev.PlugExtraData_Get(hs) If (pdata IsNot Nothing) Then pk = pdata.GetNamedKeys() If (pk IsNot Nothing) Then For x = 0 To pk.Length() - 1 s = pdata.GetNamed(pk(x)) If (pk(x) = "node_id") Then sw.WriteLine("ref=(" & dev.ref(hs) & ") - " & dev.Location(hs) & " - " & dev.Location2(hs) & " - " & dev.Name(hs) & ": " & pk(x).ToString() & " = " & s.ToString()) End If Next End If End If Loop Until EN.Finished Catch ex As Exception hs.WriteLog("DumpZWaveDevices", ex.Message) Finally If (Not sw Is Nothing) Then sw.Close() End Try End Sub
Comment
Comment