Announcement

Collapse
No announcement yet.

Copy / paste HS3 device attributes

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

  • Copy / paste HS3 device attributes

    I have 16 (sixteen) uniform HS3 devices. Is it possible to setup the attributes for one of them and than copy to the rest. By attributes I mean everything that is setup in the "Status graphics" tab. The devices were created automatically by a plug-in so the idea to manually start with one device and copying it many times won't work. I just need to copy and paste the attributes of existing devices.

  • #2
    It could be done with a script, but no other way that I know of.
    HS 3.0.0.548: 1976 Devices 1156 Events
    Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

    Comment


    • #3
      Any guidance about the script? This clicking back and forth is so annoying that I may opt for the script but haven't done one since the time of HS2.

      Comment


      • #4
        I have some scripts that create very specific devices and then sets the various status/graphics items. I'll post one, but it would need to be modified to work with existing devices.
        HS 3.0.0.548: 1976 Devices 1156 Events
        Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

        Comment


        • #5
          Here's one. The subroutine at the bottom modifies the device.

          Code:
          Imports System.IO
          Imports System.Net
          
          Sub Main(ByVal player As String)
              Dim logName As String = "LG Smart TV Remote Create"            'set log name for HS log
              Dim Debug As Boolean = False
          
              Dim dv As Scheduler.Classes.DeviceClass = Nothing
          
              Dim PlayerIP() As String
              PlayerIP = player.split(".")
          
              Dim RemValues = New Integer() {1,0,22,46,47,410,3,4,5,6,7,8,9,10,11,50,2,0,24,404,27,900,400,901,25,26,28,0,21,417,12,14,20,15,13,23,413,412,31,30,32,0,29,0,51,406,406,35,33,34,37,36,40,409,45,411}
              Dim RemStatus = New String() {"Power Off","","Menu","Ratio","Input","TV/Radio","1","2","3","4","5","6","7","8","9","List","0","","Vol +","Favorites","CH +","","3D","","Vol -","Mute","CH -","","Home","My Apps","Up","Left","Ok","Right","Down","Back","Guide","Exit","Red","Green","Yellow","","Blue","","TeleText","Text Option","Quick Menu","Stop","Play","Pause","Rewind","Fast Forward","Record","Energy","Info","SIMPLINK"}
              Dim RemImages = New String() {"power","","menu","ratio","input","tvradio","1","2","3","4","5","6","7","8","9","list","0","","volup","fav","chup","vol","3d","ch","voldown","mute","chdown","","home","myapps","up","left","ok","right","down","back","guide","exit","red","green","yellow","","blue","","teletext","textoption","qmenu","stop","play","pause","rew","ffw","record","energy","info","simplink"}
              Dim hiddenValues = New Integer() {38,39,41,42,43,44,48,49,52,401,402,403,404,407,408,414,415,416,100,101,0}
              Dim hiddenStatus = New String() {"Skip Forward","Skip Backward","Recording List","Repeat","Live TV","EPG","PIP","Subtitle","Mark","3D L/R","-","Prev Channel","Favorite Channel","Audio Description","Netcast","PIP CH +","PIP CH -","Prim/Sec Video","Pairing Request","Pair",""}
              Dim Index As Integer
          
              Dim rcDev As Long = hs.DeviceExistsAddress("LG" & PlayerIP(3) & "RC" , True)
              If rcDev = -1 Then
                  dv = hs.GetDeviceByRef(hs.NewDeviceRef("LG TV Remote"))
                  dv.Address(hs) = "LG" & PlayerIP(3) & "RC"
                  dv.Location(hs) = "LG TV"
                  dv.Location2(hs) = "LG TV"
                  dv.Last_Change(hs) = Now
                  dv.Device_Type_String(hs) = "LG TV Device"
                  dv.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES)
                  hs.DeviceVGP_ClearAll(dv.Ref(hs), True)
                  hs.DeviceVSP_ClearAll(dv.Ref(hs), True)
                  rcDev = hs.DeviceExistsAddress("LG" & PlayerIP(3) & "RC" , True)
              End If
          
              Dim row As Integer = 1
              Dim col As Integer = 1
              Dim colspan As Integer = 1
          
              For index = 0 To RemValues.GetUpperBound(0)
                  colspan = 1
                  If RemValues(index) = 12 Then colspan = 3
                  If RemValues(index) = 13 Then colspan = 3
                 If Debug Then hs.writelog(logName,CStr(rcDev) & "," & RemStatus(index) & "," & CStr(RemValues(index)) & "," & Cstr(row) & "," & Cstr(col) & "," & Cstr(colspan) & "," & RemImages(index))
                  If RemValues(index) > 0 Then CreateVSVG(CStr(rcDev) & "," & RemStatus(index) & "," & CStr(RemValues(index)) & "," & Cstr(row) & "," & Cstr(col) & "," & Cstr(colspan) & "," & RemImages(index))
                  col = col + 1
                  If RemValues(index) = 12 Then
                      col = 1
                      row = row + 1
                  End If
                  If RemValues(index) = 13 Then
                      col = 1
                      row = row + 1
                  End If
                  If col = 4 Then
                      row = row + 1
                      col = 1
                  End If
              Next
          
              For index = 0 To hiddenValues.GetUpperBound(0)
                  row = 0
                  col = 0
                  colspan = 0
                 If Debug Then hs.writelog(logName,CStr(rcDev) & "," & hiddenStatus(index) & "," & CStr(hiddenValues(index)) & "," & Cstr(row) & "," & Cstr(col) & "," & Cstr(colspan) & "," & "")
                  If RemValues(index) > 0 Then CreateVSVG(CStr(rcDev) & "," & hiddenStatus(index) & "," & CStr(hiddenValues(index)) & "," & Cstr(row) & "," & Cstr(col) & "," & Cstr(colspan) & "," & "")
              Next
          
          End Sub
          
          
          Sub CreateVSVG(ByVal Parms As String)
          
              Dim logName As String = "Create VS VG"                        'set log type for HS log
              Dim Debug As Boolean = False                                'set to True if the script give you errors and it will provide additional info in the HS3 log to help troubleshoot
              Dim ParmArray() As String = Parms.tostring.split(",")        'split parameter into an array
              Dim refDev As Integer = CInt(ParmArray(0))        ' dev code
              Dim vsName As String = ParmArray(1)        '
              Dim vsValue As Integer = CInt(ParmArray(2))        ' dev code
              Dim row As Integer = Cint(ParmArray(3))
              Dim col As Integer = Cint(ParmArray(4))
              Dim colspan As Integer = Cint(ParmArray(5))
              Dim iconName As String = ParmArray(6)        '
          
              dim GPair as VGPair
              dim SPair as VSPair
          
              SPair = New VSPair (HomeSeerAPI.ePairStatusControl.Both)
              SPair.PairType = VSVGPairType.SingleValue
              Spair.Render_Location.Row = row
              Spair.Render_Location.Column = col
              Spair.Render_Location.ColumnSpan = colspan
              Spair.Value = vsValue
              Spair.Status = vsName
          
              If iconName > "" Then
                  Spair.Render = 5
                  Spair.PairButtonImageType = 1
                  GPair = New VGPair
                  GPair.PairType = VSVGPairType.SingleValue
                  GPair.Set_Value = vsValue
                  GPair.Graphic = "/images/lgtv/remote/" & iconName & ".png"
                  hs.DeviceVGP_AddPair(refDev, GPair)
              End If
              hs.DeviceVSP_AddPair(refDev, SPair)
          
          end sub
          HS 3.0.0.548: 1976 Devices 1156 Events
          Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

          Comment


          • #6
            sparkman Thanks for sharing. I'll give it a try.

            Comment


            • #7
              I was in the same position. I had to move 165 devices from system to another. I was using the Elk M1G to control our lighting (CBus) with a plugin and interface board. But due to bugs in the firmware of the interface I moved to MQTT (mcsMQTT, cgateweb, cgate).

              You can easily copy name, location1, and location2. But I couldn't find anyway of copying existing device value/status and value/graphic pairs. You can SET them using a script, but I couldn't see any way of GETting them. So I had to add a series of if/then to specify VS and VG pairs depending on the type of device (light, blind, power socket etc).

              I've attached my script. You need to edit it to suit your needs, in particular the VSPs and VGPs You can either pass parameters to it, or set up the array in pairs (destination device, source device). Comments in the script should help you understand how it works. Don't forget to change the extension .txt to .vb.

              Hope it is of some use.

              Attached Files
              iCore5 Win 10 Pro x64 SSD

              HS3 Pro Edition 3.0.0.435 Windows

              BLOccupied:,Device History:,Yamaha:,UltraMon3:,mcsXap:,Restart:,UltraNetatmo3:, UltraM1G3:,Ultra1Wire3:,BLBackup:,Harmony Hub:,DoorBird:,UltraECM3:,Nanoleaf 3P:,UltraRachio3:,Z-Wave:,SDJ-Health:,BLGarbage:,Blue-Iris:,Chromecast:,Pushover 3P:,EasyTrigger:

              Comment


              • #8
                Thanks.

                Comment

                Working...
                X