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

Add new integration dyson_local #53801

Closed
wants to merge 1 commit into from

Conversation

shenxn
Copy link
Contributor

@shenxn shenxn commented Jul 31, 2021

Proposed change

This PR adds a new integration dyson_local. This merges the custom integration ha-dyson. This PR only contains the support to Dyson 360 Eye vacuum. Supports to more devices will be added in followup PRs.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@shenxn
Copy link
Contributor Author

shenxn commented Jul 31, 2021

Working on the documentation

Copy link
Contributor

@milanmeu milanmeu left a comment

Choose a reason for hiding this comment

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


from .const import CONF_CREDENTIAL, CONF_DEVICE_TYPE, CONF_SERIAL, DATA_DEVICES, DOMAIN

_PLATFORMS = ["binary_sensor", "sensor", "vacuum"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Limit initial PR to 1 platform.

Comment on lines +19 to +24
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
"""Set up Dyson integration."""
hass.data[DOMAIN] = {
DATA_DEVICES: {},
}
return True
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this to async_setup_entry so async_setup can be removed.

Comment on lines +40 to +43
for component in _PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for component in _PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
)
hass.config_entries.async_setup_platforms(entry, PLATFORMS)


from .const import CONF_CREDENTIAL, CONF_DEVICE_TYPE, CONF_SERIAL, DATA_DEVICES, DOMAIN

_PLATFORMS = ["binary_sensor", "sensor", "vacuum"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
_PLATFORMS = ["binary_sensor", "sensor", "vacuum"]
PLATFORMS = ["binary_sensor", "sensor", "vacuum"]

return unload_ok


class DysonEntity(Entity):
Copy link
Contributor

Choose a reason for hiding this comment

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

Use entity class or instance attributes instead of properties if possible:
https://developers.home-assistant.io/docs/core/entity/#entity-class-or-instance-attributes

"""Dyson local config flow."""

VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
Copy link
Contributor

Choose a reason for hiding this comment

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

This was moved to the manifest.

Suggested change
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH

Comment on lines +118 to +129


class CannotConnect(HomeAssistantError):
"""Represents connection failure."""


class CannotFind(HomeAssistantError):
"""Represents discovery failure."""


class InvalidAuth(HomeAssistantError):
"""Represents invalid authentication."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Not used.

Suggested change
class CannotConnect(HomeAssistantError):
"""Represents connection failure."""
class CannotFind(HomeAssistantError):
"""Represents discovery failure."""
class InvalidAuth(HomeAssistantError):
"""Represents invalid authentication."""

@milanmeu
Copy link
Contributor

milanmeu commented Aug 1, 2021

Hi @shenxn, thanks for the integration PR.

Can the current Dyson integration be replaced by this one?

According to the analytics data, there are no users. And in issues #46400, etheralm/libpurecool#37 users indicate that the current integration is not working since 11/01/2021. Can you confirm that the current integration is no longer working for anyone?

@MartinHjelmare
Copy link
Member

Yeah, we should probably merge this into the existing dyson integration, ie replace that with this code under the domain dyson.

@shenxn
Copy link
Contributor Author

shenxn commented Aug 3, 2021

Will do.

@Jc2k
Copy link
Member

Jc2k commented Aug 23, 2021

Would it be easier to review if we got rid of the existing dyson integration first and then we could review @shenxn's without the old integration getting in the way? I don't think there is a sensible migration path from the old integration to this one, and apparently there are no users anyway.

I could pick that up if it would be helpful.

Regarding putting it in dyson_local vs dyson, I think it's worth pointing out that there is a dyson_local and a dyson_cloud. The existing integration was sort of both to some extent. I don't know the plans for dyson_cloud but I think its worth pointing out as it might impact the naming decision.

@Kernald
Copy link
Contributor

Kernald commented Aug 23, 2021

Would it be easier to review if we got rid of the existing dyson integration first and then we could review @shenxn's without the old integration getting in the way? I don't think there is a sensible migration path from the old integration to this one, and apparently there are no users anyway.

Some people reported being able to use the old integration by signing in on the mobile app just before or something like that at some point, but I think the analytics mostly report that because nobody is able to use it anymore, confirming that it's entirely broken today. I for one still have it enabled and configured - it just fails to start.

@Jc2k
Copy link
Member

Jc2k commented Aug 23, 2021

Yeah i spent some time trying to get it working (having had it configured and working previously) and it wouldn't. It just doesn't know the device credentials if it can't login to dyson cloud (as it doesn't cache them AIUI) so (again AIUI) it can't possibly ever work. I think the dyson cloud API has changed again since those people were able to trick it into working with the mobile app.

(For comparison for reviewers not familiar, this new integration is able to use the password printed on a sticker that came with the fan and completely bypass their cloud, worked first time. It's great).

@MartinHjelmare
Copy link
Member

Would it be easier to review if we got rid of the existing dyson integration first and then we could review @shenxn's without the old integration getting in the way?

Yes, we can create a separate target branch, copied from dev, then PR a removal of the old dyson integration to that branch, and then rebase here onto that branch.

@epenet
Copy link
Contributor

epenet commented Nov 9, 2021

Since this is kind of not moving forward, I have created the removal PR #59401.
Then the decision can be made to either re-use the "liberated" domain or not.

@Kakise
Copy link

Kakise commented Dec 15, 2021

This PR should probably be closed, shenxn is currently too busy to maintain the dyson_local repo anymore. I took over the maintenance of the integration, I can make a new PR to integrate it here.

@MartinHjelmare
Copy link
Member

Ok, I'll close here for now.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants