Navigation Menu

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

Ewelink discover fix and enhancements #1044

Merged
merged 5 commits into from Oct 25, 2021

Conversation

NickDub-old
Copy link
Contributor

@NickDub-old NickDub-old commented Jan 16, 2021

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)
  • 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.json) 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

Please provide a description of the change here. It's always best with screenshots, so don't hesitate to add some!

@codecov
Copy link

codecov bot commented Jan 16, 2021

Codecov Report

Merging #1044 (48cb671) into master (213ba3b) will decrease coverage by 0.02%.
The diff coverage is 97.60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1044      +/-   ##
==========================================
- Coverage   96.66%   96.64%   -0.03%     
==========================================
  Files         686      684       -2     
  Lines        8970     8990      +20     
==========================================
+ Hits         8671     8688      +17     
- Misses        299      302       +3     
Impacted Files Coverage Δ
server/services/ewelink/lib/features/humidity.js 90.90% <90.90%> (ø)
...erver/services/ewelink/lib/features/temperature.js 90.90% <90.90%> (ø)
server/services/ewelink/lib/device/poll.js 97.82% <96.96%> (-2.18%) ⬇️
server/lib/device/device.pollAll.js 100.00% <100.00%> (ø)
server/services/ewelink/lib/device/discover.js 100.00% <100.00%> (ø)
server/services/ewelink/lib/device/setValue.js 100.00% <100.00%> (ø)
server/services/ewelink/lib/features/binary.js 100.00% <100.00%> (ø)
server/services/ewelink/lib/features/index.js 100.00% <100.00%> (ø)
server/services/ewelink/lib/utils/constants.js 100.00% <100.00%> (ø)
server/services/ewelink/lib/utils/externalId.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 213ba3b...48cb671. Read the comment docs.

@NickDub-old NickDub-old force-pushed the ewelink-discover-fix branch 3 times, most recently from ca44317 to 5c375d0 Compare January 17, 2021 21:23
@NickDub-old NickDub-old force-pushed the ewelink-discover-fix branch 3 times, most recently from 8687431 to 953dc52 Compare February 2, 2021 18:44
@NickDub-old NickDub-old marked this pull request as ready for review February 18, 2021 18:53
Copy link
Contributor

@atrovato atrovato left a comment

Choose a reason for hiding this comment

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

Looks fine to me (code only), didn't try in real mode.

I really like the fact you upgrade the eWelink service package version :)

One question, my device is offline, why can't I add it to Gladys?

image

server/services/ewelink/lib/device/poll.js Outdated Show resolved Hide resolved
server/services/ewelink/lib/device/poll.js Outdated Show resolved Hide resolved
server/services/ewelink/lib/features/energyPower.js Outdated Show resolved Hide resolved
server/services/ewelink/lib/features/index.js Outdated Show resolved Hide resolved
@NickDub-old
Copy link
Contributor Author

One question, my device is offline, why can't I add it to Gladys?

If the device is offline, we cannot detect the available features and therefore, for the moment, we cannot add it.
In the future, I will add the ability to add and update an unhandled device.

atrovato
atrovato previously approved these changes Feb 22, 2021
Copy link
Contributor

@atrovato atrovato left a comment

Choose a reason for hiding this comment

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

Looks good to me, but I don't have any ewelink device anymore, maybe @VonOx have some to test it in real life.

@Pierre-Gilles
Copy link
Contributor

@VonOx could you try this ? :) Looks good to me too, looking for a real world review before merging

@atrovato
Copy link
Contributor

@VonOx do you still have eWelink devices?

@VonOx
Copy link
Contributor

VonOx commented Mar 10, 2021

Yes sorry guys for delay, will test this week end.

@VonOx
Copy link
Contributor

VonOx commented Mar 12, 2021

Some testing ( With sonoff basic ):

  • Account setup OK
  • Device discover ok
  • Device added to dashboard ok ( but initial state was wrong , displayed on but was off )
  • Switch to off , nothing happen ( ok because initial state was wrong )
  • Turn on ( OK )
  • Turn off ( NOK ) - Displayed off in dashboard but device is on
  • After waiting device poll, real state is displayed in dashboard
  • Turn off OK

Maybe polling related problem or maybe I'm too fast while testing
PR Seem's ok

EDIT: Got this error from nowhere after testing ( ❤️ ITEAD server )

2021-03-12T17:34:37+0100 <error> device.poll.js:23 (DeviceManager.poll) There was an error while polling device ewelink-1000fb237d
2021-03-12T17:34:37+0100 <error> device.poll.js:24 (DeviceManager.poll) Error403: eWeLink: Authentication failed
    at EweLinkHandler.throwErrorIfNeeded (/home/vonox/repos/GladysEwilink/server/services/ewelink/lib/device/index.js:57:13)
    at EweLinkHandler.poll (/home/vonox/repos/GladysEwilink/server/services/ewelink/lib/device/poll.js:68:14)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async DeviceManager.poll (/home/vonox/repos/GladysEwilink/server/lib/device/device.poll.js:21:5) {
  status: 403,
  code: 'FORBIDDEN'
}

@Pierre-Gilles
Copy link
Contributor

Pierre-Gilles commented Mar 15, 2021

Thanks for your testing @VonOx :)

Device added to dashboard ok ( but initial state was wrong , displayed on but was off )
Switch to off , nothing happen ( ok because initial state was wrong )

So it seems there is an initial state problem? So PR is ok or not ? ^^

@NickDub-old
Copy link
Contributor Author

NickDub-old commented Apr 1, 2021

The pr is OK, but there are vulnerabilities.
Can you check it ?

atrovato
atrovato previously approved these changes May 23, 2021
Copy link
Contributor

@atrovato atrovato left a comment

Choose a reason for hiding this comment

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

Ok looks good to me.

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.

Hi! Thanks for your PR :)

I wrote a few very minor changes related to code only.

On the functional side, was this PR tested properly ?

The bug reported by @VonOx in previous messages were fixed ?

If it's all good, and it has been tested, I'm good to merge! 🙂

server/services/ewelink/lib/device/index.js Outdated Show resolved Hide resolved
server/services/ewelink/lib/device/index.js Outdated Show resolved Hide resolved
server/services/ewelink/lib/device/discover.js Outdated Show resolved Hide resolved
@NickDub-old NickDub-old force-pushed the ewelink-discover-fix branch 2 times, most recently from 6a424fe to e78df21 Compare June 4, 2021 12:38
@Pierre-Gilles
Copy link
Contributor

Hello! Just saw your changes, looks better!

On the functional side, was this PR tested properly ?

The bug reported by @VonOx in previous messages were fixed ?

@NickDub-old
Copy link
Contributor Author

The bug reported by @VonOx in previous messages were fixed ?

Not yet. I'm trying to reproduce it...
Otherwise, everything is OK.

@Pierre-Gilles
Copy link
Contributor

Hello! Just wanted to know the status of this PR ? :)

If you need help, don't hesitate to ping me on the forum.

@NickDub-old
Copy link
Contributor Author

I don't have any more ewelink devices to test, but if it's ok for you, this PR is ready to be merged...

@VonOx
Copy link
Contributor

VonOx commented Oct 13, 2021

I have one, can test if you need.

@Pierre-Gilles
Copy link
Contributor

OK @VonOx Let me know if the bug you previously saw is indeed fixed :)

@VonOx
Copy link
Contributor

VonOx commented Oct 19, 2021

@Pierre-Gilles Not reproduced , so yes it's fixed

@Pierre-Gilles
Copy link
Contributor

Do you confirm that this PR is retro-compatible with existing connected ewelink device ?

There is no breaking change, like users don't need to re-connect their device to make them work ?

External_id used did not change?

@NickDub-old
Copy link
Contributor Author

There is no change to the External_id.
This PR is retro-compatible with existing connected ewelink device ;)

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.

Thanks for the PR then! :)

I'm merging this !

@Pierre-Gilles Pierre-Gilles merged commit a755d55 into GladysAssistant:master Oct 25, 2021
@relativeci
Copy link

relativeci bot commented Oct 25, 2021

Job #132: Bundle Size — 6.67MB (~-0.01%).

a755d55 vs 213ba3b

Changed metrics (2/8)
Metric Current Baseline
Initial JS 2.87MB(~-0.01%) 2.87MB
Cache Invalidation 42.81% 0%
Changed assets by type (1/7)
            Current     Baseline
JS 4.76MB (~-0.01%) 4.76MB

View Job #132 report on app.relative-ci.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants