Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

add support for core 600s eu version #40

Merged
merged 1 commit into from
Jul 31, 2022

Conversation

yasen-pavlov
Copy link
Contributor

A small PR to add support for the eu version of the core 600s.

I also fixed several small errors I was getting with the number, switch and light entities.

Thanks a lot for the great custom component!

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 30, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.42%.

Quality metrics Before After Change
Complexity 1.83 ⭐ 1.88 ⭐ 0.05 👎
Method Length 26.73 ⭐ 27.37 ⭐ 0.64 👎
Working memory 4.05 ⭐ 4.16 ⭐ 0.11 👎
Quality 89.08% 88.66% -0.42% 👎
Other metrics Before After Change
Lines 595 604 9
Changed files Quality Before Quality After Quality Change
custom_components/vesync/const.py 85.80% ⭐ 85.53% ⭐ -0.27% 👎
custom_components/vesync/light.py 84.62% ⭐ 83.64% ⭐ -0.98% 👎
custom_components/vesync/number.py 93.41% ⭐ 93.43% ⭐ 0.02% 👍
custom_components/vesync/switch.py 89.92% ⭐ 89.92% ⭐ 0.00%

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
custom_components/vesync/light.py VeSyncBaseLight.turn_on 5 ⭐ 127 😞 10 😞 60.56% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Copy link
Owner

@vlebourl vlebourl left a comment

Choose a reason for hiding this comment

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

Hey, thanks for your help. As I don't own the devices, I trust you tested and it works.

@@ -226,7 +226,10 @@ def brightness(self):
@property
def is_on(self):
"""Return True if night light is on."""
return self.smarthumidifier.details["night_light_brightness"] > 0
if self.device.config_dict['module'] == 'VeSyncAirBypass':
Copy link
Owner

Choose a reason for hiding this comment

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

Some fans don't have the config_dict object, in particular the PUR131S. I suppose line 53 would be false so this should be ok, but I'm not 100% sure...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh i didn't notice that. I was going to check the device type with isinstance, but then I saw the module property in the dict and thought that it would be cleaner to use it instead. I can change it to that if you think that it would safer.

@vlebourl
Copy link
Owner

vlebourl commented Jul 30, 2022

I'll merge as soon as the style is fixed. You can use

pip3 install pre-commit
pre-commit install
pre-commit run --all-files

To run the style before committing.

@yasen-pavlov yasen-pavlov force-pushed the add_support_core_600s_eu branch from cd47d33 to 9e2b00d Compare July 30, 2022 21:44
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@yasen-pavlov
Copy link
Contributor Author

Hey, thanks for your help. As I don't own the devices, I trust you tested and it works.

I have a LAP-C601S-WEU and I wanted to get it to work with HA for some time now, with your latest changes and these small fixes it seems to be working great so far.

Thanks again for the great work!

@vlebourl vlebourl merged commit f7d1947 into vlebourl:main Jul 31, 2022
@yasen-pavlov yasen-pavlov deleted the add_support_core_600s_eu branch July 31, 2022 11:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants