Announcement

Collapse
No announcement yet.

Sample Creating a Device

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rick Tinker
    replied
    Mark,

    If the device is owned by a plug-in (Interface property is not empty) then HomeSeer will assign default value/status pairs.

    Yes, you should set up your own. Here is some code you can copy - this sets up a Z-Wave device with standard options, so it is pretty close to the same as the HomeSeer standard device. The difference being that the HomeSeer device treats 100 as full on, and this treats 99 as full on, and 255 has a special meaning too. In fact, 255 has different text for the control button than what it shows for the status, so you can see how you can set up special situations like that - when you control a device to set it to the value 255, the button displays "On Last Level" (turns it on to the level it was last left at), but if the value read from the device is 255, it shows "On".

    In this case here, just like with HomeSeer, I give it a single value range for the dim values and the HomeSeer UI takes care of creating the drop-down list. If the difference between the upper and lower end of the range is too large, HomeSeer automatically divides up the range into values that will allow for a drop-list that does not have too many values. If you wanted to do your own, you can do that, but keep in mind that if you set the values 5, 10, 15 etc. and then set the value to 7, it will not display a status. If you want 5, 10, 15 specifically and do want to be able to set values such as 7, then you create multiple range entries such as 0 through 4.999999, 5 through 9.999999, 10 through 14.999999 - etc. Look at the graphic pairs in the example below to see that.

    The Default_VS_Pairs_AddUpdateUtil I can post if you need it but I think it is in the sample plug-ins. It just verifies that the pair does not already exist before adding it.


    Code:
                Dim Pair As VSPair = Nothing
                Dim GPair As VGPair = Nothing
    
                If Dimmable Then
                    Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Control)
                    Pair.PairType = VSVGPairType.SingleValue
                    Pair.Value = 255
                    Pair.Status = "On Last Level"
                    Pair.Render = Enums.CAPIControlType.Button
                    Pair.Render_Location.Row = 1
                    Pair.Render_Location.Column = 3
                    Default_VS_Pairs_AddUpdateUtil(zd.dvRef, Pair)
    
                    Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Status)
                    Pair.PairType = VSVGPairType.SingleValue
                    Pair.Value = 255
                    Pair.Status = "On"
                    Pair.Render = Enums.CAPIControlType.Button
                    Pair.Render_Location.Row = 1
                    Pair.Render_Location.Column = 2
                    Default_VS_Pairs_AddUpdateUtil(zd.dvRef, Pair)
    
                    Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                    Pair.PairType = VSVGPairType.SingleValue
                    Pair.Value = 99
                    Pair.Status = "On"
                    Pair.Render = Enums.CAPIControlType.Button
                    Pair.Render_Location.Row = 1
                    Pair.Render_Location.Column = 2
                    Default_VS_Pairs_AddUpdateUtil(zd.dvRef, Pair)
                Else
                    Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                    Pair.PairType = VSVGPairType.SingleValue
                    Pair.Value = 255
                    Pair.Status = "On"
                    Pair.Render = Enums.CAPIControlType.Button
                    Pair.Render_Location.Row = 1
                    Pair.Render_Location.Column = 2
                    Default_VS_Pairs_AddUpdateUtil(zd.dvRef, Pair)
                End If
    
                Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                Pair.PairType = VSVGPairType.SingleValue
                Pair.Value = 0
                Pair.Status = "Off"
                Pair.Render = Enums.CAPIControlType.Button
                Pair.Render_Location.Row = 1
                Pair.Render_Location.Column = 1
                Default_VS_Pairs_AddUpdateUtil(zd.dvRef, Pair)
    
                If Dimmable Then
                    Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Both)
                    Pair.PairType = VSVGPairType.Range
                    Pair.RangeStart = 1
                    Pair.RangeEnd = 99
                    Pair.RangeStatusPrefix = "Dim "
                    Pair.RangeStatusSuffix = "%"
                    Pair.Render = Enums.CAPIControlType.ValuesRangeSlider
                    Pair.Render_Location.Row = 2
                    Pair.Render_Location.Column = 1
                    Pair.Render_Location.ColumnSpan = 3
                    Default_VS_Pairs_AddUpdateUtil(zd.dvRef, Pair)
                End If
    
                ' --------------------- GRAPHIC PAIRS -----------------------------
    
                If Dimmable Then
                    GPair = New VGPair
                    GPair.PairType = VSVGPairType.SingleValue
                    GPair.Set_Value = 99
                    GPair.Graphic = "/images/HomeSeer/status/on.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
                End If
                GPair = New VGPair
                GPair.PairType = VSVGPairType.SingleValue
                GPair.Set_Value = 255
                GPair.Graphic = "/images/HomeSeer/status/on.gif"
                Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                GPair = New VGPair
                GPair.PairType = VSVGPairType.SingleValue
                GPair.Set_Value = 0
                GPair.Graphic = "/images/HomeSeer/status/off.gif"
                Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
    
                If Dimmable Then
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 1
                    GPair.RangeEnd = 5.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-00.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 6
                    GPair.RangeEnd = 15.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-10.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 16
                    GPair.RangeEnd = 25.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-20.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 26
                    GPair.RangeEnd = 35.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-30.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 36
                    GPair.RangeEnd = 45.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-40.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 46
                    GPair.RangeEnd = 55.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-50.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 56
                    GPair.RangeEnd = 65.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-60.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 66
                    GPair.RangeEnd = 75.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-70.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 76
                    GPair.RangeEnd = 85.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-80.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 86
                    GPair.RangeEnd = 95.99999999
                    GPair.Graphic = "/images/HomeSeer/status/dim-90.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                    GPair = New VGPair()
                    GPair.PairType = VSVGPairType.Range
                    GPair.RangeStart = 96
                    GPair.RangeEnd = 98.99999999
                    GPair.Graphic = "/images/HomeSeer/status/on.gif"
                    Default_VG_Pairs_AddUpdateUtil(zd.dvRef, GPair)
    
                End If

    Leave a comment:


  • mnsandler
    replied
    Standard On, Off btns and Dim Level Dropdown?

    are these no longer created by default on new devices that are set to Enums.dvMISC.SHOW_VALUES

    If i create a device manually from the ui, it creates an On and Off btn with a blank dropdown after that. What's that

    so what's the recommended approach here:
    Add my own On, Off and Range list?

    how do i create a range that increments by 10?I don't want values 0 to 100 by 1s

    Leave a comment:


  • Rick Tinker
    replied
    Originally posted by Sgt. Shultz View Post
    Actually, B was based on BCPL, which was in turn based on CPL. There was no A.
    I know nut-ting.... NUT-TING!!!! Harrrumph!

    Leave a comment:


  • Moskus
    replied
    Originally posted by Rick Tinker View Post
    Which was based upon A, but the point is, programmers do not like typing so they used a single letter for the new language they developed! Those whacky Bell Labs people...
    ... which is why even lazier programmers created IntelliSense.

    Leave a comment:


  • Sgt. Shultz
    replied
    Actually, B was based on BCPL, which was in turn based on CPL. There was no A.

    Leave a comment:


  • Rick Tinker
    replied
    Originally posted by Sgt. Shultz View Post
    Because the language it was based on was B.
    Which was based upon A, but the point is, programmers do not like typing so they used a single letter for the new language they developed! Those whacky Bell Labs people...

    Leave a comment:


  • Sgt. Shultz
    replied
    Originally posted by Rick Tinker View Post
    Did you ever wonder where the programming language "C" got its name?
    Because the language it was based on was B.

    Leave a comment:


  • Rick Tinker
    replied
    Yes, dvParent is no different than dv - just the name I gave to an object that is DeviceClass.

    Note the AssociatedDevices calls - this is where the actual relationship is set up. The system does not prevent you from associating 5 devices to 5 other devices each, but what I refer to as a true parent/child relationship is where the parent is associated with all of the child devices (so its AssociatedDevices contains several entries) but each child only has one association, which is to the parent device.

    Code:
           ' This device is a child device, the parent being the root device for the entire security system. 
            ' As such, this device needs to be associated with the root (Parent) device.
            If dvParent.AssociatedDevices_Count(hs) < 1 Then
                ' There are none added, so it is OK to add this one.
                dvParent.AssociatedDevice_Add(hs, dvRef)
            Else
                Dim Found As Boolean = False
                For Each ref As Integer In dvParent.AssociatedDevices(hs)
                    If ref = dvRef Then
                        Found = True
                        Exit For
                    End If
                Next
                If Not Found Then
                    dvParent.AssociatedDevice_Add(hs, dvRef)
                Else
                    ' This is an error condition likely as this device's reference ID should not already be associated.
                End If
            End If

    Leave a comment:


  • dcorsus
    replied
    Originally posted by dcorsus View Post
    is there something missing in this example? Where is dvParent being assigned?

    Dirk
    Think I figured it out. dvParent is supposed to be pointing to

    dvParent = hs.GetDeviceByRef(parentDevice)

    where parentDevice is the reference to the parent

    Dirk

    Leave a comment:


  • dcorsus
    replied
    Originally posted by Rick Tinker View Post
    Wade I think is working on a simplification of the Sample plug-in (thanks Wade) but for those of you having trouble with device creation, let me see if this sample code snippet helps...

    It is also as a VB module in the enclosed zip so you can add it to a plug-in and view it in all its full color glory (and copy/paste as desired!)


    Code:
            Dim dvRef As Integer
            Try
                dvRef = hs.NewDeviceRef("My Device Name")
            Catch ex As Exception
                dvRef = -1
            End Try
            If dvRef < 1 Then
                ' Log an error
                Exit Sub
            End If
    
            ' Force HomeSeer to save changes to devices and events so we can find our new device
            hs.SaveEventsDevices()
    
            ' Get the new device.
            Dim dv As Scheduler.Classes.DeviceClass = Nothing
            Try
                dv = hs.GetDeviceByRef(dvRef)
            Catch ex As Exception
                dv = Nothing
            End Try
            If dv Is Nothing Then
                ' Log an error
                Exit Sub
            End If
    
            ' Make the value/status pairs show drop-down control options.
            dv.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES)
    
            dv.Location(hs) = "My Plugin Location"
            dv.Location2(hs) = "First Floor"
            dv.Interface(hs) = IFACE_NAME
            dv.InterfaceInstance(hs) = "Instance, if applicable"
            dv.Address(hs) = "XYZ-04-PDQ"
            dv.Code(hs) = hs.GetNextVirtualCode
    
            Dim DT As New DeviceTypeInfo
            DT.Device_API = DeviceTypeInfo.eDeviceAPI.Security
            DT.Device_Type = DeviceTypeInfo.eDeviceType_Security.Keypad
            DT.Device_SubType = 4
            DT.Device_SubType_Description = "Keypad Address 4"
            dv.DeviceType_Set(hs) = DT
            dv.Device_Type_String(hs) = IFACE_NAME & " Keypad"
    
            ' Make sure we can have control options on this device by verifying that the status only bit is cleared.
            dv.MISC_Clear(hs, Enums.dvMISC.STATUS_ONLY)
            ' Also make sure that the option to prevent the value/status pairs from displaying as trigger options is cleared.
            dv.MISC_Clear(hs, Enums.dvMISC.NO_STATUS_TRIGGER)
    
    
            ' Mark the device that we can be polled for status.
            dv.Status_Support(hs) = True
    
            ' Make sure our device's string value is not set, as that will override the value/status pairs:
            hs.SetDeviceString(dvRef, "", False)
    
            ' This device is a child device, the parent being the root device for the entire security system. 
            ' As such, this device needs to be associated with the root (Parent) device.
            If dvParent.AssociatedDevices_Count(hs) < 1 Then
                ' There are none added, so it is OK to add this one.
                dvParent.AssociatedDevice_Add(hs, dvRef)
            Else
                Dim Found As Boolean = False
                For Each ref As Integer In dvParent.AssociatedDevices(hs)
                    If ref = dvRef Then
                        Found = True
                        Exit For
                    End If
                Next
                If Not Found Then
                    dvParent.AssociatedDevice_Add(hs, dvRef)
                Else
                    ' This is an error condition likely as this device's reference ID should not already be associated.
                End If
            End If
    
            ' Now, we want to make sure our child device also reflects the relationship by adding the parent to
            '   the child's associations.
            dv.AssociatedDevice_ClearAll(hs)  ' There can be only one parent, so make sure by wiping these out.
            dv.AssociatedDevice_Add(hs, dvParent.Ref(hs))
    
            ' Now, let's store some information our plug-in uses in the device...
            Dim PData As clsPlugExtraData = Nothing
            PData = dv.PlugExtraData_Get(hs)
            If PData Is Nothing Then PData = New clsPlugExtraData
            ' I am going to store the security keypad codes in the device - nobody would think to look there! 
            PData.AddNamed("KeyPadData", SecurityData)
            ' Now we need to put the data back...
            dv.PlugExtraData_Set(hs) = PData
    
            ' OK, now we need to add our status and control pairs....
            ' In this part of the demo, we are going to set it up as if it were something that shows us 
            '   the temperature, but has a control option for requesting a temperature update, just to make it
            '   interesting because I could not think of a good example for a 'range' value/status pair continuing
            '   with the security system example!
            Dim Pair As VSPair = Nothing
            Dim GPair As VGPair = Nothing
    
            ' First, clear away anything that was put there by default by HomeSeer
            hs.DeviceVSP_ClearAll(dvRef, True)
    
            ' This pair will display the temperature.
            Pair = New VSPair(HomeSeerAPI.ePairStatusControl.Status)
            Pair.PairType = VSVGPairType.Range
            Pair.RangeStart = -500  'This is a bit chilly
            Pair.RangeEnd = 1000  'This is pretty warm!
            Pair.RangeStatusPrefix = ""
            Pair.RangeStatusSuffix = " " & VSPair.ScaleReplace
            Pair.IncludeValues = True
            Pair.ValueOffset = 0
            Pair.HasScale = True
            If Not hs.DeviceVSP_AddPair(dvRef, Pair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding pair failed.", COLOR_RED)
    
            ' These two pairs will result in a control button (Update) being available, and when that is selected
            '   the status will change to "Getting Temperature..." until a new temperature is set.
            Pair = New VSPair(ePairStatusControl.Control)   ' This is what appears in the device actions...
            Pair.PairType = VSVGPairType.SingleValue
            Pair.Render = VSVGPairRender.Button
            Pair.Status = "Update"
            Pair.Value = -1000 ' This is outside the range used by temperature.
            If Not hs.DeviceVSP_AddPair(dvRef, Pair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding pair failed.", COLOR_RED)
    
            Pair = New VSPair(ePairStatusControl.Status)  ' This is what appears for the status...
            Pair.PairType = VSVGPairType.SingleValue
            Pair.Status = "Getting Temperature..."
            Pair.Value = -1000 ' This is outside the range used by temperature.
            If Not hs.DeviceVSP_AddPair(dvRef, Pair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding pair failed.", COLOR_RED)
    
    
    
    
            ' Now, let's set up the graphics, but first we need to wipe out the HomeSeer defaults...
            hs.DeviceVGP_ClearAll(dvRef, True)
    
            ' We won't bother setting up a graphic for the -1000 value (update) as it should not be displayed for very long.
    
            ' Set up the ranges for Fahrenheit for the graphics.
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = -50
            GPair.RangeEnd = 5
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-00.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 5.00000001
            GPair.RangeEnd = 15.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-10.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 16
            GPair.RangeEnd = 25.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-20.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 26
            GPair.RangeEnd = 35.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-30.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 36
            GPair.RangeEnd = 45.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-40.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 46
            GPair.RangeEnd = 55.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-50.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 56
            GPair.RangeEnd = 65.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-60.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 66
            GPair.RangeEnd = 75.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-70.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 76
            GPair.RangeEnd = 85.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-80.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 86
            GPair.RangeEnd = 95.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-90.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 96
            GPair.RangeEnd = 104.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-100.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    
            GPair = New VGPair()
            GPair.PairType = VSVGPairType.Range
            GPair.RangeStart = 105
            GPair.RangeEnd = 150.99999999
            GPair.Graphic = "/images/HomeSeer/status/Thermometer-110.png"
            If Not hs.DeviceVGP_AddPair(dvRef, GPair) Then hs.WriteLogEx(IFACE_NAME & " Error", "Adding graphic pair failed.", COLOR_RED)
    is there something missing in this example? Where is dvParent being assigned?

    Dirk

    Leave a comment:


  • Rick Tinker
    replied
    Originally posted by donstephens View Post
    Not to hijack this thread; I'd love to see you break down triggers and conditions like this excellent example.
    I think that was the intent when Wade created the sample plug-in "simple" - check that out and see if it helps.

    Leave a comment:


  • donstephens
    replied
    Not to hijack this thread; I'd love to see you break down triggers and conditions like this excellent example.

    Leave a comment:


  • Rick Tinker
    replied
    From my earlier post...

    So a parent device will have multiple associated devices, but child devices will have 1. For an added measure, there is a "Root" enum for the device types (music, thermostat, security, etc.) that can be used as an added measure to indicate the parent (root) device.

    Leave a comment:


  • reidfo
    replied
    Originally posted by wetlip View Post
    parent devices are associated with child devices and vice versa, how does homeseer knows which is the parent ? :

    PHP Code:
    dv.AssociatedDevice_Add(hsdvParent.Ref(hs)) 
    Your plugin will have to make that determination, most likely by the device type and/or subtype. In my case with themostats there is a device type for the thermostat root device. If you're doing something other than thermostats you could use the subtype property to define different types of child devices.

    Leave a comment:


  • wetlip
    replied
    Originally posted by reidfo View Post
    I'm interested in learning a little more about parent/child devices.
    Code:
    dvParent.AssociatedDevice_Add(hs, dvRef)
    This makes sense, and I've added it to my code. Is there anything that will change the way parent and child devices are displayed on the device management page? It would be really nice if the child devices were grouped visually underneath the parent. Maybe I'm missing something.
    parent devices are associated with child devices and vice versa, how does homeseer knows which is the parent ? :

    PHP Code:
    dv.AssociatedDevice_Add(hsdvParent.Ref(hs)) 

    Leave a comment:

Working...
X