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
21 stars 4 forks source link

EMiscFlag.SetDoesNotChangeLastChange default #258

Closed BernoldNL closed 2 years ago

BernoldNL commented 2 years ago

Environment and System Config

Describe the issue The documentation for EMiscFlag.SetDoesNotChangeLastChange says "if set, any set to a device value will not reset last change. This is not set by default for backward compatibility". But it is set by default. If you simply create a feature the checkmark is set. It requires an additional FeatureFactory.WithoutMiscFlags(EMiscFlag.SetDoesNotChangeLastChange) to remove this flag. So either the documentation is incorrect, or default behavior is not as intended (I did not create any plugin prior to HS4, so I'm not sure what would make it backward compatible).

Steps to Reproduce Steps to reproduce the behavior:```

        //Default this WILL set checkmark under Feature tab

        DeviceFactory deviceFactory = DeviceFactory.CreateDevice(Id);
        deviceFactory.WithName("Device name");
        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);
        }

        //Only if you Remove the flag with an additional WithoutMiscFlags() it will be unset.

        DeviceFactory deviceFactory = DeviceFactory.CreateDevice(Id);
        deviceFactory.WithName("Device name");
        NewDeviceData newDeviceData = deviceFactory.PrepareForHs();
        int deviceRefId = HomeSeerSystem.CreateDevice(newDeviceData);
        if (deviceRefId > 0)
        {
            FeatureFactory featureFactory = FeatureFactory.CreateFeature(Id);
            featureFactory.OnDevice(deviceRefId);
            featureFactory.WithName("Feature name");
            featureFactory.WithoutMiscFlags(EMiscFlag.SetDoesNotChangeLastChange);
            NewFeatureData newFeatureData = featureFactory.PrepareForHs();
            int featureRef = HomeSeerSystem.CreateFeatureForDevice(newFeatureData);
        }


**Expected behavior**
EMiscFlag.SetDoesNotChangeLastChange not set

-----

**Screenshots**
![afbeelding](https://user-images.githubusercontent.com/99019707/153890463-dfe116ab-632a-44ac-81d0-a73ae347d44b.png)

**Logs**
N/A

**Additional info**
N/A
spudwebb commented 2 years ago

The documentation is incorrect, it should have been updated when we changed the behavior of FeatureFactory to set SetDoesNotChangeLastChange by default. There is no backward compatibility problem because the flag is only set when creating a new HS4 feature. The doc will be fixed. Tracked as PSDK-244 Thank you for reporting

spudwebb commented 2 years ago

The doc has been updated in v1.4.0.0