-
-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature not deleted / created #556
Comments
According to this test, if the incoming feature have the same So, I see 2 solutions :
|
The external_id is not meant to change ! It's a unique way to identify a device based on external identifier. (Exemple: Philips Hue Light ID) We don't use the What's your exact use case/problem ? |
When I create a device from MQTT service, I add a light on/off feature and save my device. Then I remove this feature, by error, and create it again. It will call the update, but the feature does not exist anymore with this id. |
There might be somethings I don't understand, I don't see what's wrong with this case 🤔 If you create a device, remove a feature, then add the feature again, it should work! Based on the external_id of course... |
Try it yourself:
==> the device is refreshed but no feature is visible. What happens ? Gladys/server/lib/device/device.create.js Line 84 in efc2ef5
But as we are in the same transaction, when we get plain device at line 97, the feature Gladys/server/lib/device/device.create.js Line 97 in efc2ef5
Then we check for an update not on the |
…h the same external_id should update existing device feature
The bug was not exactly that, but the fix was simple ! As the external_id is the only source of "truth/unicity", I use it everywhere instead of "id". Now it works in the case you specified. I added some tests to ensure it stays the same in the future. |
…ame request with the same external_id should update existing device feature
Why is the "update feature" based on
feature.external_id
instead offeature.id
?Gladys/server/lib/device/device.create.js
Line 104 in efc2ef5
The text was updated successfully, but these errors were encountered: