Announcement

Collapse
No announcement yet.

Flexible root devices

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

    Flexible root devices

    Hi!

    If I remember correctly, there was some flexibility in choosing a root device for one or more MQTT child devices. I can't seem to find anything like that in the HS4 version. I realize a root device is now a requirement for all HS4 features (childs), but it would be awesome if there was some more flexibility on how to group my MQTT devices/features.

    Did I miss it somewhere or is this no longer possible? If so, please consider this as a feature request.

    Thanks!
    stefxx

    #2
    I was looking at the same thing today. I'm running HS4 mcsShelly and thought that I might need to change to mcsMQTT to find that option. I'm adding some Tasmota devices now and would like to re-group child devices instead of having multiple parents for the one Tasmota device.

    Comment


      #3
      McsMQTT and mcsShelly should operate the same. Let me look as to why that option no longer exists. It has been a struggle to provide a seamless HS3 to HS4 migration path.

      Comment


        #4
        I had this implemented in the HS4 plugin, but then excluded it when the behavior was not as expected. In HS3 the grouping was done by changing the pointers in the AssociatedDevices property of the parent and child. When I do this in HS4 I can single step and confirm the logic is working as expected. The child feature becomes invisible/deleted and the existing parent device to which it is being mapped does not reflect the additional AssociatedDevices link.

        The code that does this is attached for reference.

        Do you have any experience with changing a feature's parent in HS4? My next approach would be to capture the feature object and then add that object to the desired parent device. Another approach is to create a new child device for the desired parent and clone the properties managed by mcsMQTT.
        Attached Files

        Comment


          #5
          Hi,

          I did some testing, and adding an existing feature to a root device works just fine. Just modify the AssociatedDevices property on both the device and the feature.

          Remove the feature from the old root doesn't seem to stick. Both removing the feature from the root AssociatedDevices, and removing the root from the feature's AssociatedDevices do not save. In the code the AssociatedDevices update just fine, but it doesn't get saved. So now the feature belongs to 2 root devices

          I'm afraid we hit a bug in HS4.

          Oh, please do not recreate the feature. That will create a disaster in events, HSTouch etc etc.
          stefxx

          Comment


            #6
            I did some investigation in the SDK and was not able to find a way to add an existing feature to a device. There are no explicit provisions for moving features. As we both discovered, trying to force it with the AssociatedDevices property does not work at this time. I will submit an issue to GitHub.

            Comment

            Working...
            X