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

Use dataclass to carry data in ping #99803

Merged
merged 3 commits into from Oct 20, 2023
Merged

Conversation

jpbede
Copy link
Member

@jpbede jpbede commented Sep 7, 2023

Proposed change

Use a dataclass to transfer the privileged state (and maybe others later) between platforms. Also add myself as a code owner.

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: fixes #
  • 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:

@jpbede jpbede marked this pull request as draft September 7, 2023 18:41
@jpbede jpbede marked this pull request as ready for review September 7, 2023 20:52
@jpbede jpbede requested a review from bdraco September 7, 2023 20:53
Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

LGTM

@bdraco
Copy link
Member

bdraco commented Sep 10, 2023

testing on production now

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

All ping sensors are showing unavailable after this change

@home-assistant
Copy link

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 September 10, 2023 17:41
@bdraco
Copy link
Member

bdraco commented Sep 10, 2023

I don't see any obvious errors or anything in the logs so I'm not sure where the problem is unfortunately.

@bdraco
Copy link
Member

bdraco commented Sep 10, 2023

Might be a race as I restarted again and now they are off

@bdraco
Copy link
Member

bdraco commented Sep 10, 2023

I think we have an existing bug here, but I can't find it

@bdraco
Copy link
Member

bdraco commented Sep 10, 2023

Still haven't found the bug. Seems to happen even without this PR so I don't think the problem is coming in here.

@jpbede
Copy link
Member Author

jpbede commented Sep 11, 2023

I'll now run this on my production system as well, have only tested this on dev. Maybe I can find this.

@jpbede
Copy link
Member Author

jpbede commented Sep 12, 2023

Interestingly, I cannot reproduce this on either prod or dev. Even if I restart HA while it is still setting up, my ping binary_sensors immediately returns to the previous state (no unavailable sensor).

Prod is Using icmplib in privileged=True mode
Dev is Using icmplib in privileged=False mode

@bdraco
Copy link
Member

bdraco commented Sep 12, 2023

I'll try to dig in some more today. I don't expect this PR is the cause.

If I can't find the problem, I'll set up a clean system to test this so we can get it moving forward

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

I went back and tested with dev and the problem has gone away. I wish I could explain it, but its clear its not caused by this PR

@bdraco bdraco marked this pull request as ready for review October 20, 2023 19:29
@home-assistant home-assistant bot requested a review from bdraco October 20, 2023 19:29
@bdraco bdraco added the smash Indicator this PR is close to finish for merging or closing label Oct 20, 2023
@jpbede
Copy link
Member Author

jpbede commented Oct 20, 2023

Thanks for testing this again @bdraco 👍

@bdraco
Copy link
Member

bdraco commented Oct 20, 2023

Thanks @jpbede

Sorry I took so long to get back to this one.

@bdraco bdraco merged commit 3c45539 into home-assistant:dev Oct 20, 2023
23 checks passed
@jpbede jpbede deleted the ping-dataclass branch October 21, 2023 03:49
@github-actions github-actions bot locked and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed code-quality integration: ping Quality Scale: internal 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

2 participants