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

Fix entity category for sensor fails mqtt sensor platform setup #103449

Merged
merged 3 commits into from Nov 7, 2023

Conversation

jbouwh
Copy link
Contributor

@jbouwh jbouwh commented Nov 5, 2023

Proposed change

This PR introduces a grace period of 3 months to allow MQTT sensors to have an invalid entity category.
It partly reverts changes make by #103210 for binary_sensor as this is also not wanted for the patch release.
#103210 disallowed sensors and binary sensors to have an entity_category set to config, this PR changes that behavior to an issue registration instead of failing setup.

Validation for entity category was added to the sensor core component #101471 but it's correct use was already communicated at october 2021.

Related: #103511

Screenshot:

afbeelding

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

  • This PR fixes or closes issue:
  • This PR is related to issue:
  • Link to documentation pull request:

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 Nov 5, 2023

Hey there @emontnemery, mind taking a look at this pull request as it has been labeled with an integration (mqtt) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of mqtt 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 mqtt Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@jbouwh jbouwh requested a review from edenhaus November 5, 2023 16:28
@jbouwh jbouwh changed the title Fix entiy category for sensor fails mqtt sensor platform setup Fix entity category for sensor fails mqtt sensor platform setup Nov 5, 2023
@jbouwh jbouwh added this to the 2023.11.2 milestone Nov 5, 2023
@jbouwh jbouwh requested a review from elupus November 5, 2023 16:34
Copy link
Contributor

@elupus elupus left a comment

Choose a reason for hiding this comment

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

I like this approach a lot. I assume it will still break due to the check in the sensor base platform component for other users. But at least handling mqtt sound like a very good approach.

Needs @frenck 's blessing thou.

@jbouwh jbouwh force-pushed the mqtt-warn-for-invalid-entity_category branch from 0249f54 to 64c5764 Compare November 5, 2023 17:42
@jbouwh jbouwh added the second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. label Nov 5, 2023
@jbouwh jbouwh requested a review from frenck November 6, 2023 08:42
@home-assistant
Copy link

home-assistant bot commented Nov 6, 2023

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft November 6, 2023 11:45
@jbouwh jbouwh marked this pull request as ready for review November 6, 2023 13:10
@frenck
Copy link
Member

frenck commented Nov 6, 2023

We haven't introduced this for binary sensors, this accidentally came in a patch release and is reverted in #103499

For just sensors, this could help (but I am not too sure if we should ship this in a patch release tbh).

@jbouwh
Copy link
Contributor Author

jbouwh commented Nov 6, 2023

We haven't introduced this for binary sensors, this accidentally came in a patch release and is reverted in #103499

For just sensors, this could help (but I am not too sure if we should ship this in a patch release tbh).

For sensor this PR might make sense as it pops out an invalid config entity_category it that is set for sensors.
But the question is indeed if it is worth time to split the implementation.

So I could take out the binary_sensor implementation part from this PR. And split it to another PR.

@jbouwh
Copy link
Contributor Author

jbouwh commented Nov 6, 2023

Removed the binary_sensor implementation to be added in a new PR #103511

Copy link
Contributor

@edenhaus edenhaus left a comment

Choose a reason for hiding this comment

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

Thanks @jbouwh 👍

@frenck Are you fine with shipping it with the next patch release?

@jbouwh jbouwh force-pushed the mqtt-warn-for-invalid-entity_category branch from fe1c6d2 to f68fdf0 Compare November 7, 2023 15:31
@jbouwh jbouwh added the smash Indicator this PR is close to finish for merging or closing label Nov 7, 2023
@frenck
Copy link
Member

frenck commented Nov 7, 2023

Let's do it 👍

@frenck frenck merged commit cbccdbc into dev Nov 7, 2023
53 checks passed
@frenck frenck deleted the mqtt-warn-for-invalid-entity_category branch November 7, 2023 23:03
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2023
@frenck
Copy link
Member

frenck commented Nov 10, 2023

This PR conflicts with the stable release, and cannot be cleanly pulled in for patch releasing.

@frenck frenck removed this from the 2023.11.2 milestone Nov 10, 2023
@jbouwh
Copy link
Contributor Author

jbouwh commented Nov 10, 2023

This PR conflicts with the stable release, and cannot be cleanly pulled in for patch releasing.

Thnx! Then well wait till the stable release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bugfix by-code-owner cla-signed core deprecation Indicates a breaking change to happen in the future has-tests integration: mqtt Quality Scale: gold second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. smash Indicator this PR is close to finish for merging or closing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants