Announcement

Collapse
No announcement yet.

If I rename the devices, do they stay renamed?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    If I rename the devices, do they stay renamed?

    In HS2 I once renamed all the devices, just to have the plugin rename them back moments later. I believe this was fixed, but my memory might fail me.

    Before I rename 100 devices; Is this the case in HS3 or not?
    (And I'm cheating with Linq anyway...)
    HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
    Running on Windows 10 (64) virtualized
    on ESXi (Fujitsu Primergy TX150 S8).
    WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

    Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

    #2
    So it seems.


    If anybody else is interessted in how to do it easily, then just fire up tenScripting and run this Script:
    Code:
        Public Sub Main(Byval not_used_params as Object)
            For i As Integer = 1 To 6
                Dim j As Integer = CInt(i) 'Because why not! Visual Studio told me to.
                Dim devs = From d In Devices()
                           Where d.Address(Nothing).StartsWith("LMSP" & j)
    
                Dim root = (From d In devs Where d.Device_Type_String(Nothing) = "Music Root Device").First
                Dim base As String = root.Name(Nothing).Replace(" Name", "")
                Dim new_name As String = RemoveHTML(root.devString(Nothing))
                hs.WriteLog("Rename " & j, "Renaming " & base & " to " & new_name)
    
                For Each d In devs
                    d.Name(hs) = d.Name(hs).Replace(base, new_name & ", ")
                Next
    
            Next
    
        End Sub
    
        Private Function RemoveHTML(ByVal input As String) As String
            Return System.Text.RegularExpressions.Regex.Replace(input.Replace("&nbsp;", ""), "<(.|\n)*?>", String.Empty)
        End Function
    
    
        Public Function Devices() As System.Collections.Generic.List(Of Scheduler.Classes.DeviceClass)
            Dim _devices As New System.Collections.Generic.List(Of Scheduler.Classes.DeviceClass)
            Dim DE As Scheduler.Classes.clsDeviceEnumeration = hs.GetDeviceEnumerator()
    
            Do While Not DE.Finished
                _devices.Add(DE.GetNext)
            Loop
    
            Return _devices
        End Function
    Renamed "Player 4 Name" to "SB-Stue, Name" because "SB-Stue" is the name of the Squeezebox in LMS.
    HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
    Running on Windows 10 (64) virtualized
    on ESXi (Fujitsu Primergy TX150 S8).
    WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

    Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

    Comment


      #3
      Yes fixed in hs2 and in hs3 you can rename the devices. Thanks for the script to do it easily!

      Comment


        #4
        Happy to share it! You are putting in good work in this plugin, so it's the least I could do.

        It's just too bad that HS does not really support Linq in scripting properly. Yet. But tenScripting does (or rather: Visual Studio does).
        HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
        Running on Windows 10 (64) virtualized
        on ESXi (Fujitsu Primergy TX150 S8).
        WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

        Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

        Comment

        Working...
        X