Skip to content
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

Merge devices, keep name and room #1575

Merged
merged 1 commit into from
Mar 31, 2023

Conversation

atrovato
Copy link
Contributor

Pull Request check-list

To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:

  • If your changes affects code, did your write the tests?
  • Are tests passing? (npm test on both front/server)
  • Is the linter passing? (npm run eslint on both front/server)
  • Did you run prettier? (npm run prettier on both front/server)
  • [ ] If you are adding a new features/services, did you run integration comparator? (npm run compare-translations on front)
  • Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community for testing before merging.
  • [ ] If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
  • [ ] If you are adding a new features/services which needs explanation, did you modify the user documentation? See the GitHub repo and the website.
  • [ ] Did you add fake requests data for the demo mode (front/src/config/demo.js) so that the demo website is working without a backend? (if needed) See https://demo.gladysassistant.com.

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

Fixes #1573
With z2m and Tasmota services, Gladys allows to update stored devices with discovered once. But it erase manually defined room and names.
This PR allows to merge existing device and newly discovered device, keeping some already stored attributes.

@atrovato atrovato requested review from Pierre-Gilles and VonOx July 24, 2022 12:18
@atrovato atrovato mentioned this pull request Jul 24, 2022
9 tasks
@codecov
Copy link

codecov bot commented Jul 24, 2022

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (27eba3d) 97.56% compared to head (31d8830) 97.56%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1575   +/-   ##
=======================================
  Coverage   97.56%   97.56%           
=======================================
  Files         653      653           
  Lines        9932     9946   +14     
=======================================
+ Hits         9690     9704   +14     
  Misses        242      242           
Impacted Files Coverage Δ
...ces/tasmota/lib/mqtt/tasmota.mqtt.handleMessage.js 100.00% <100.00%> (ø)
...ces/tasmota/lib/tasmota.mergeWithExistingDevice.js 100.00% <100.00%> (ø)
...er/services/tasmota/lib/tasmota.notifyNewDevice.js 100.00% <100.00%> (ø)
...r/services/zigbee2mqtt/lib/getDiscoveredDevices.js 100.00% <100.00%> (ø)
server/utils/device.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@VonOx
Copy link
Contributor

VonOx commented Jul 27, 2022

@atrovato tested right now

Edited feature name on aqara door sensor. ( With needed update on discover page )

After update all feature name revert to default.
So for some reason it's not working

@atrovato
Copy link
Contributor Author

I'm not sure to understand your test. What did you do to get the update button available?

@VonOx
Copy link
Contributor

VonOx commented Jul 27, 2022

I've some device that need update ( door sensor device temperature)

So I edited feature name before update in zigbee2mqtt integration.

After update my custom features name are gone.

@atrovato
Copy link
Contributor Author

In zigbee2mqqt, the z2m name is a part of the external_id (which is a bad practice), and for the "difference" calculation, with are based on this external_id. So in your case, we don't update a feature, but we detect the deletion of a feature, and a new feature...

@VonOx
Copy link
Contributor

VonOx commented Sep 8, 2022

@atrovato ok I understand

@atrovato atrovato force-pushed the merge-devices branch 2 times, most recently from af4712b to f38b55d Compare September 10, 2022 18:34
@Pierre-Gilles
Copy link
Contributor

@atrovato Is it ready to review/merge? Tests are good?

@atrovato
Copy link
Contributor Author

@Pierre-Gilles I just rebase on master.
I looks good to me, but I can open the question on "what field should be kept?"
Because in some case, we can override the feature category from UI...

@Pierre-Gilles
Copy link
Contributor

@atrovato In what case can we override the feature category ?

@atrovato
Copy link
Contributor Author

In Tasmota, you can change the default "swith" category to "light", editing stored device.

@Pierre-Gilles
Copy link
Contributor

@VonOx Is this working on your side in the end? I don't see any message of you saying that it works

@VonOx
Copy link
Contributor

VonOx commented Oct 10, 2022

@Pierre-Gilles My previous test-case was not suitable because of external-id change. It doesn't apply.

@Pierre-Gilles
Copy link
Contributor

@VonOx Ok. Can you try it then ? :)

@VonOx
Copy link
Contributor

VonOx commented Oct 10, 2022

I'm on.

@atrovato
Copy link
Contributor Author

I just rebase from master to avoid any side effects.

@atrovato atrovato force-pushed the merge-devices branch 2 times, most recently from 3c08dde to 86aecc7 Compare March 25, 2023 11:20
@Pierre-Gilles
Copy link
Contributor

@atrovato @VonOx Was it tested in the end?

@atrovato
Copy link
Contributor Author

I do, but as I am the developer, it has no value ;)

Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then it's ok for me, I trust you! :)

We cannot wait forever for testers ^^

Thanks for your work on this 🙏

@Pierre-Gilles Pierre-Gilles merged commit de1ff0e into GladysAssistant:master Mar 31, 2023
@relativeci
Copy link

relativeci bot commented Mar 31, 2023

Job #1203: Bundle Size — 7.21MiB (0%).

de1ff0e(current) vs b257c5b master#1202(baseline)

⚠️ Bundle contains 5 duplicate packages

Metrics (no changes)
                 Current
Job #1203
     Baseline
Job #1202
Initial JS 4.22MiB 4.22MiB
Initial CSS 300.25KiB 300.25KiB
Cache Invalidation 0% 0%
Chunks 51 51
Assets 149 149
Modules 1302 1302
Duplicate Modules 20 20
Duplicate Code 0.81% 0.81%
Packages 116 116
Duplicate Packages 4 4
Total size by type (no changes)
                 Current
Job #1203
     Baseline
Job #1202
CSS 313.38KiB 313.38KiB
Fonts 93.55KiB 93.55KiB
HTML 13.58KiB 13.58KiB
IMG 1.66MiB 1.66MiB
JS 5.13MiB 5.13MiB
Media 0B 0B
Other 15.74KiB 15.74KiB

View job #1203 reportView master branch activity

@atrovato atrovato deleted the merge-devices branch April 2, 2023 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updating device in integration override customized values
3 participants