Add quality scale file to vesync integration#156663
Conversation
|
Hey there @markperdue, @webdjoe, @TheGardenMonkey, @iprak, @SapuSeven, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Creating as draft to show the progress. I will spend more time to run through the blank items. Once that is done will set to ready for review and start adding PRs for to do items. |
|
I have reviewed the items. A few items I put as todo for future levels as needs more code review to confirm. As well docs while in okay shape I think need updates. |
joostlek
left a comment
There was a problem hiding this comment.
Let's put the things we agree on fixing in the comments in the file and merge it and improve it from there
| icon-translations: todo | ||
| reconfiguration-flow: todo | ||
| repair-issues: done | ||
| stale-devices: todo |
There was a problem hiding this comment.
You did implement async_remove_config_entry_device though, which also makes me wonder, when a device is offline, is it removed from the API? Or can we safely assume when a device is actually gone? Because in the latter I would say that we can just remove the device automatically and remove the manual method to do so
There was a problem hiding this comment.
Yes, from reading the rule my understanding is auto remove if possible. Two APIs exist in vesync. One gets a list of registered devices, another gets the status of a device. The code I added will update the device list, and compare. If missing it removes it. If offline it will still be in that list. So I listed this as to-do as I automate that on a schedule. I only want to call it from time to time though as it uses API calls. Say once a day or hour, when a device is removed it would auto remove from HA.
| @@ -0,0 +1,66 @@ | |||
| rules: | |||
There was a problem hiding this comment.
Would it make sense to at some point split the energy from the normal device coordinator?
There was a problem hiding this comment.
To clarify would this be a second coordinator?
| @@ -0,0 +1,66 @@ | |||
| rules: | |||
There was a problem hiding this comment.
_attr_available_modes can be used in the humidifer
There was a problem hiding this comment.
I am actually not sure why we collect a separate map here, as in, there are no duplicates so I think we can just create a global humdifier mode map instead of an entity specific one
There was a problem hiding this comment.
Are you able to point me to where you see that? I only see a single humidifier mode map. A different one exists for fan though.
There was a problem hiding this comment.
# Populate maps once.
for vs_mode in self.device.mist_modes:
ha_mode = _get_ha_mode(vs_mode)
if ha_mode:
self._available_modes.append(ha_mode)
self._ha_to_vs_mode_map[ha_mode] = vs_mode
self._available_modes.sort()More like, instead of using the generic map, we build a new map based on the existing values. I only think there's a benefit for this if you have humidifier modes that map to the same thing (so let's say device A has mode X and device B has mode Y and they're mapped to the same value in HA, then this would make sense as this would make sure that we don't ask for mode Y on device A)
| @@ -0,0 +1,66 @@ | |||
| rules: | |||
There was a problem hiding this comment.
Why does the display turn off when we move to sleep mode?
There was a problem hiding this comment.
This matches the behavior of the native app. We could decouple if preferred.
There was a problem hiding this comment.
Ideally we do that, the less abstractions we have on the HA side the better (as in, you might have someone who doesn't want that to happen and then you'd have to add a configuration, and that can become a slippery slope)
| @@ -0,0 +1,66 @@ | |||
| rules: | |||
There was a problem hiding this comment.
Is getting a non-int light brightness usual?
There was a problem hiding this comment.
Not sure! I believe that was carry over so haven't touched it recently. How would we track this in the quality score?
| @@ -0,0 +1,66 @@ | |||
| rules: | |||
There was a problem hiding this comment.
I think we need to get rid of the is_<type> methods at some point because they use isinstance and that's relatively expensive
There was a problem hiding this comment.
This was an effort to start moving away from rgettattr. I either need to safely detect if the data exists, or confirm the class where they exist is used. I can think on this and see if the is_supported would work but I don't think that applies across all classes.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
| @@ -0,0 +1,66 @@ | |||
| rules: | |||
There was a problem hiding this comment.
There's no place for that or a rule to explicitly deny it, but I would consider this a thing that makes the integration of good quality. You could put it under strict-typing
| @@ -0,0 +1,66 @@ | |||
| rules: | |||
There was a problem hiding this comment.
# Populate maps once.
for vs_mode in self.device.mist_modes:
ha_mode = _get_ha_mode(vs_mode)
if ha_mode:
self._available_modes.append(ha_mode)
self._ha_to_vs_mode_map[ha_mode] = vs_mode
self._available_modes.sort()More like, instead of using the generic map, we build a new map based on the existing values. I only think there's a benefit for this if you have humidifier modes that map to the same thing (so let's say device A has mode X and device B has mode Y and they're mapped to the same value in HA, then this would make sense as this would make sure that we don't ask for mode Y on device A)
| @@ -0,0 +1,66 @@ | |||
| rules: | |||
There was a problem hiding this comment.
Ideally we do that, the less abstractions we have on the HA side the better (as in, you might have someone who doesn't want that to happen and then you'd have to add a configuration, and that can become a slippery slope)
| @@ -0,0 +1,66 @@ | |||
| rules: | |||
Proposed change
Adding the quality score file and initial evaluation.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: