HomeSeer / Plugin-SDK

Plugin development kit for the 4th major edition of the HomeSeer platform.
https://www.nuget.org/packages/HomeSeer-PluginSDK/
GNU Affero General Public License v3.0
20 stars 4 forks source link

FeatureFactory WithLocation() and WithLocation2() #312

Open BernoldNL opened 2 years ago

BernoldNL commented 2 years ago

Environment

HomeSeer

OS

Windows

HS Version

4.2.14.0

Development

PSDK Version

1.4.2

Language

C#

IDE

VS2022

Dev OS

Windows

Plugin

What plugin is this issue for? Any

Problem

Description

Describe the issue you are encountering. What happened? Documentation of FeatureFactory's WithLocation() and WithLocation2() has the following remark: "You should only adjust this if the location on the owning device is insufficient for this feature. This will be a location IN ADDITION to the device location.". This suggests that a feature's Location and Location2 will be inherited from the device. Instead the features Room (Location) gets the plugin's Id and the Floor (Location2) is set to "Plugin".

Expected Behavior

What did you expect to happen? I expect the feature's Location and Location2 to be inherited from its device. Or, as a second possibility, for them to be null unless set.

Steps to Reproduce

Provide steps so the HomeSeer team can reproduce the reported problem:
            DeviceFactory deviceFactory = DeviceFactory.CreateDevice(Id);
            deviceFactory.WithName("Device name");
            deviceFactory.WithLocation("Location");
            deviceFactory.WithLocation2("Location2");
            NewDeviceData newDeviceData = deviceFactory.PrepareForHs();
            int deviceRefId = HomeSeerSystem.CreateDevice(newDeviceData);
            if (deviceRefId > 0)
            {
                FeatureFactory featureFactory = FeatureFactory.CreateFeature(Id);
                featureFactory.OnDevice(deviceRefId);
                featureFactory.WithName("Feature name");
                NewFeatureData newFeatureData = featureFactory.PrepareForHs();
                int featureRef = HomeSeerSystem.CreateFeatureForDevice(newFeatureData);
            }

Screenshots

If applicable, add screenshots to help explain your problem. afbeelding

The device gets created as expected:

afbeelding

Logs

If applicable, include log output from the plugin console and/or the HomeSeer logs. If the logs take up more than a few lines, consider attaching a file. N/A

spudwebb commented 2 years ago

I agree, this needs some clarification. We will get back to you Tracked as PSDK-290