Announcement

Collapse
No announcement yet.

re Scripting .. how to find Device name from Ref #

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

    re Scripting .. how to find Device name from Ref #

    I can see how to do the reverse, but is there a way to find a device name based on the Device Reference ID (or #).

    #2
    I don't think there is a scripting function that will do it. What is the circumstance where you need the capability?

    Jon00 has a 'Device List Viewer' that makes it easy to find the device name if you know the Ref ID. Does that do what you want?
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      Code:
      Sub Main(p as string)
      
          Dim dvRef
          Dim dv
      
          dvRef = hs.GetDeviceRefByName("Kitchen Desk Lights")
          if dvRef > 0 then
              dv = hs.GetDeviceByRef(dvRef)
              hs.WriteLog("Info","The name for the device is " & dv.name(hs))
              hs.WriteLog("Info","The location for the device is " & dv.location(hs))
              hs.WriteLog("Info","The location2 for the device is " & dv.location2(hs))
          else
              hs.WriteLog("Error","Could not find the reference for the device specified.")
          end if
      
      End Sub
      Output:

      Code:
      Jan-20 7:23:27 PM	 	Info	The location2 for the device is Lighting
      Jan-20 7:23:27 PM	 	Info	The location for the device is Kitchen
      Jan-20 7:23:27 PM	 	Info	The name for the device is Desk Lights

      Comment


        #4
        HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
        2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit

        Comment


          #5
          Originally posted by Steve Q View Post
          Go to HS3 settings/custom and turn on the column for “device reference”. Then sort the web page by “ref”.




          Sent from my iPad using Tapatalk
          Sadly, RefID is not a sortable column. That is one of many reasons Jon00's Device List Viewer is useful.
          HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

          Comment


            #6
            hs.devicename(refid) will return the device name, not a documented call but a handy one.

            Comment


              #7
              Uncle Mike.

              This is a tremendous stride forward, from the "geekie" (not a users) perspective of the device list. I have to congratulate the creator of this tool.

              However, I am looking for a way in a script, knowing the "Ref ID", find out "Name" that the user has given the device. Users like to work with words, computers with numbers .. Once I have the Name, then it will combined with other device info and then an email sent to a designated address. This must work in an unattended enviromnement.

              Again, thanks for this info .. now I need to find a way to expand it so that it can be the solution I am looking for ...

              Thanks for your help ...

              Comment


                #8
                Mr Happy

                If this works then great ... why would anyone hide such tools that help others .. I just do not understand the development/tech staff at HS .. they were very user oriented when I first use HS1 .. but now it is geek city.

                One stride forward .. 3 back .. too bad .. these are usual signs of impending demise.

                I have been in IT for over 50 years and seen this happen toooooo many times.

                Get off the soap box Don .. and Thanks .. .

                Don

                Comment


                  #9
                  MrHappy .. that worked like a charm .. thank you .. thank you ...

                  To bad we need to hide our candles under bushels .. .

                  Thanks for your help ...

                  Don

                  Comment


                    #10
                    Originally posted by rprade View Post
                    Sadly, RefID is not a sortable column. That is one of many reasons Jon00's Device List Viewer is useful.
                    HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
                    2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit

                    Comment

                    Working...
                    X