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

Check supported features in calls to vacuum services #95833

Merged
merged 3 commits into from Jul 10, 2023

Conversation

emontnemery
Copy link
Contributor

@emontnemery emontnemery commented Jul 4, 2023

Proposed change

Check supported features in calls to vacuum services

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)
  • Deprecation (breaking change to happen in the future)
  • 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
  • I have followed the perfect PR recommendations
  • 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.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Jul 4, 2023

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (vacuum) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of vacuum can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign vacuum Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@emontnemery emontnemery requested a review from jbouwh as a code owner July 4, 2023 10:06
Copy link
Contributor

@jbouwh jbouwh left a comment

Choose a reason for hiding this comment

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

LGTM,
Thnx @emontnemery 👍

@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Jul 5, 2023
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

@MartinHjelmare
Copy link
Member

We should do a developer blog too for custom integrations.

Go ahead and merge when all affected core integrations are handled.

@emontnemery
Copy link
Contributor Author

emontnemery commented Jul 5, 2023

Go ahead and merge when all affected core integrations are handled.

I have reviewed and double reviewed the core integrations, and I believe they all set the feature flags correctly 👍

Copy link
Contributor

@xeniter xeniter left a comment

Choose a reason for hiding this comment

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

try to clear up confusion deprecated VacuumEntity and StateVacuumEntity
specially for defines what are the vacuums supporting

@@ -77,19 +77,19 @@
class VacuumEntityFeature(IntFlag):
"""Supported features of the vacuum entity."""

TURN_ON = 1
TURN_OFF = 2
TURN_ON = 1 # Deprecated, not supported by StateVacuumEntity
Copy link
Contributor

Choose a reason for hiding this comment

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

why not remove it to avoid confusion?

there are only 3 lefts which are not StateVacuumEntity) if i count right:

StateVacuumEntity
demo
litterrobot
mqtt
neato
roborock
romy
roomba
sharkiq
template
tuya
xiaommmmi_miio

VacuumEntity (wich is deprecated)
demo
mqtt
ecovacs

cause demo does not count and mqtt is generic, only ecovacs will be hard to test after porting?
at least i would mark the demo and the class VacuumEntity

personal i would prefer removing VacuumEntity completly don't know side effects/effort here but it would help a lot for new vacuum implementation that they don't get confused

SEND_COMMAND = 256
LOCATE = 512
CLEAN_SPOT = 1024
MAP = 2048
STATE = 4096
STATE = 4096 # Must be set by vacuum platforms derived from StateVacuumEntity
START = 8192


Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this? cause the deprecated uses of VacuumEntity (demo, mqtt, ecovacs) uses the wrong define -> VacuumEntityFeature.TURN_ON anyhow

SUPPORT_TURN_ON:
is not used at all

SUPPORT_TURN_OFF:
is used only in test/components/alexa we should remove it since its for new StateVacuumEntity deprecated anyhow

SUPPORT_PAUSE:
used in test/components/alexa/test_smart_home.py -> we should change it to enum VacuumEntityFeature.PAUSE
used in test/components/google/test_trait.py -> we should change it to enum VacuumEntityFeature.PAUSE

SUPPORT_STOP:
used in test/components/alexa/test_smart_home.py -> we should change it to enum VacuumEntityFeature.SUPPORT_STOP
used in test/components/google/test_trait.py -> we should change it to enum VacuumEntityFeature.SUPPORT_STOP

SUPPORT_RETURN_HOME
used in test/components/alexa/test_smart_home.py -> we should change it to enum VacuumEntityFeature.RETURN_HOME
used in test/components/homekit/test_get_accessories.py -> we should change it to enum VacuumEntityFeature.RETURN_HOME

SUPPORT_FAN_SPEED
used in test/components/alexa/test_smart_home.py -> we should change it to enum VacuumEntityFeature.FAN_SPEED

SUPPORT_BATTERY
used in components/google_assistant/traits.py -> we should change it to enum VacuumEntityFeature.SUPPORT_BATTERY
used in test/components/google/test_trait.py -> we should change it to enum VacuumEntityFeature.SUPPORT_BATTERY

SUPPORT_STATUS -> not used at all
SUPPORT_SEND_COMMAND -> not used at all

SUPPORT_LOCATE
used in components/google_assistant/traits.py -> we should change it to enum VacuumEntityFeature.SUPPORT_LOCATE
used in test/components/google/test_trait.py -> we should change it to enum VacuumEntityFeature.SUPPORT_LOCATE

SUPPORT_CLEAN_SPOT -> not used at all
SUPPORT_MAP -> not used at all
SUPPORT_STATE -> not used at all

SUPPORT_START
used in test/components/alexa/test_smart_home.py -> we should change it to enum VacuumEntityFeature.START
used in test/components/homekit/test_get_accessories.py -> we should change it to enum VacuumEntityFeature.SUPPORT_START

can prepare a merge if you like?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, please prepare a PR cleaning up the use of the deprecated constants

Copy link
Contributor

Choose a reason for hiding this comment

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

created: #96202

@frenck frenck removed the smash Indicator this PR is close to finish for merging or closing label Jul 8, 2023
@emontnemery emontnemery merged commit 96c71b2 into dev Jul 10, 2023
51 checks passed
@emontnemery emontnemery deleted the vacuum_services_check_features branch July 10, 2023 11:05
@github-actions github-actions bot locked and limited conversation to collaborators Jul 11, 2023
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.

None yet

5 participants