Announcement

Collapse
No announcement yet.

hs.DeleteDevice question

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

  • hs.DeleteDevice question

    If I delete a root device in the HS web interface, it removes all of the associated child devices.

    If i execute hs.DeleteDevice(dvRef) it only removes the root and leave the orphaned child devices.

    Bug or intentional?
    Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

  • #2
    Interesting one - imagine the function has been passed on from HS2 which didn't have the relationships arrangement so a sort of bug or missed feature, guess that you'll have to write a little function that examines whether or not the device to delete is a parent device and then delete the children?
    My Plugins:

    Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
    Yeelight 3P | Nanoleaf 3P

    Comment


    • #3
      Yup, did just that, but it is a little inconsistent in behavior.
      Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

      Comment


      • #4
        Here's a snippet to remove the root node and any children associated with that root node:

        Code:
        If (ref > 0) Then
                    dv = hs.GetDeviceByRef(ref)
                    assocDevices = dv.AssociatedDevices(hs)
                    For y = 0 To dv.AssociatedDevices_Count(hs) - 1
                        hs.DeleteDevice(assocDevices(y))
                    Next
                    hs.DeleteDevice(ref)
                    hs.SaveEventsDevices()
                End If
        HS3Pro Running on a Raspberry Pi3
        64 Z-Wave Nodes, 168 Events, 280 Devices
        UPB modules via OMNI plugin/panel
        Plugins: Z-Wave, BLRF, OMNI, HSTouch, weatherXML, EasyTrigger
        HSTouch Clients: 3 Android, 1 Joggler

        Comment

        Working...
        X