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

Mark Duotecno entities unavailable when tcp goes down #114325

Merged
merged 10 commits into from
May 15, 2024

Conversation

Cereal2nd
Copy link
Contributor

@Cereal2nd Cereal2nd commented Mar 27, 2024

Proposed change

When the tcp connection to the duotecno smartbox goes down, mark all entities as unavailble.

This depends on #114320
Can we also add this to 2024.4.0? This will greatly improve the usability of duotecno.

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 Ruff (ruff format 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:

@Cereal2nd Cereal2nd changed the title Mark Duotecno entities as unavailable if the network connection is br… Mark Duotecno entities unavailable when tcp goes down Mar 27, 2024
@Cereal2nd Cereal2nd marked this pull request as ready for review March 28, 2024 06:57
Copy link
Contributor

@davet2001 davet2001 left a comment

Choose a reason for hiding this comment

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

Looks good to me!
Thanks @Cereal2nd 👍

Copy link
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

Now this does update the state only when the entity is created, which is probably what's wanted here?

@Cereal2nd
Copy link
Contributor Author

i was just testing this, and no the state can be updated during the runtime, and it seems that this is not happening, so i think we still need the property

@rytilahti
Copy link
Member

Yes, either a property or setting it inside the update callback. I think both are fine, setting the variable directly saves a bit code and is generally preferred, but the original way you had is also fine. Your call!

This reverts commit f26b4e6.
@Cereal2nd
Copy link
Contributor Author

I just reverted my fix

Copy link
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @Cereal2nd! 👍

@rytilahti rytilahti added this to the 2024.5.4 milestone May 15, 2024
@rytilahti rytilahti merged commit d5a1587 into home-assistant:dev May 15, 2024
24 checks passed
@Cereal2nd Cereal2nd deleted the duotecnoavailable branch May 15, 2024 13:14
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2024
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

4 participants