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 update entity platform #68248

Merged
merged 13 commits into from
Mar 21, 2022
Merged

Add update entity platform #68248

merged 13 commits into from
Mar 21, 2022

Conversation

frenck
Copy link
Member

@frenck frenck commented Mar 16, 2022

Proposed change

This PR adds a new entity platform to Home Assistant: update.
Based on the original work by @ludeeus in #66552, but this time as an entity platform.

A screen recorder from earlier in the development process, to give an idea of what this entity can do (will update with a new one, once I finish the demo integration part)

2022-03-16 21 29 26

The next step is to adjust the frontend to handle this entity and show pending updates in the configuration screen.

TODO:

  • Finish Demo integration implementation
  • Developer documentation PR
  • End-user documentation PR

Future steps:

  • Frontend
    • Entity row support
    • More info dialog support
    • Show updates in config dashboard
  • Add support to Google Assistant
  • Add support to Alexa
  • Add support to HomeKit
  • Add support to MQTT
  • Device trigger/condition/action support

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.
  • 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.

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:

Copy link
Contributor

@gwww gwww left a comment

Choose a reason for hiding this comment

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

Cool new feature!

homeassistant/components/update/__init__.py Show resolved Hide resolved
homeassistant/components/update/__init__.py Outdated Show resolved Hide resolved
Copy link
Contributor

@gwww gwww left a comment

Choose a reason for hiding this comment

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

Can the UpdateEntity be used to downgrade versions?

@frenck
Copy link
Member Author

frenck commented Mar 16, 2022

Can the UpdateEntity be used to downgrade versions?

That is up to the implementer of the platform.

Copy link
Member

@ludeeus ludeeus left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

Comment on lines +294 to +290
return STATE_ON
return STATE_OFF
Copy link
Member

Choose a reason for hiding this comment

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

Should update in progress also be a state? I guess it depends on what the update entity describes. If it describes the availability of an update, on/off seems fine. If it describes an update, maybe ready/applying/on_latest would fit better? After all, that is also what the entity row would show

Copy link
Member Author

@frenck frenck Mar 19, 2022

Choose a reason for hiding this comment

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

Good question, and initially I wrote it as such as well. I kept it binary and simple. The progress moved to an attribute.

My train of though here was three fold:

  • it still isn't updated while updating.
  • the current form allows for translations in the frontend.
  • the main use case of the entity state would be dermining if there is an update pending (and automate notification on that). Less possible states makes that easier I guess.

Copy link
Member

Choose a reason for hiding this comment

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

Ok 👍 It means we think of it as representing version.

@frenck
Copy link
Member Author

frenck commented Mar 21, 2022

Rebased onto the latest dev, now #68394 is merged.

@frenck frenck marked this pull request as ready for review March 21, 2022 06:38
homeassistant/components/demo/update.py Outdated Show resolved Hide resolved
homeassistant/components/demo/update.py Outdated Show resolved Hide resolved
homeassistant/components/update/__init__.py Outdated Show resolved Hide resolved
tests/components/demo/test_update.py Outdated Show resolved Hide resolved
tests/components/demo/test_update.py Outdated Show resolved Hide resolved
tests/components/demo/test_update.py Outdated Show resolved Hide resolved
tests/components/demo/test_update.py Outdated Show resolved Hide resolved
tests/components/update/test_init.py Outdated Show resolved Hide resolved
tests/components/update/test_init.py Outdated Show resolved Hide resolved
@frenck frenck merged commit 073fb40 into dev Mar 21, 2022
@frenck frenck deleted the frenck-2022-0651 branch March 21, 2022 10:02
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2022
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.

6 participants