Skip to content

Add button to trigger ota firmware update for Shelly devices#58757

Merged
frenck merged 29 commits intohome-assistant:devfrom
mib1185:shelly/add-ota-update-service
Nov 26, 2021
Merged

Add button to trigger ota firmware update for Shelly devices#58757
frenck merged 29 commits intohome-assistant:devfrom
mib1185:shelly/add-ota-update-service

Conversation

@mib1185
Copy link
Copy Markdown
Member

@mib1185 mib1185 commented Oct 30, 2021

Proposed change

This will add a new service to the Shelly integration which allows the user to trigger an ota firmware update for their Shelly devices (follow-up of #57005 (comment))
This add two new button entities to trigger a so called OTA firmware update of Shelly devices, each one for stable and beta (disabled by default) channel.
This is limited to only update to latest stable or beta release (uploading an image or triggered update from specified url is out of scope and will not be integrated).

image

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:

@probot-home-assistant
Copy link
Copy Markdown

Hey there @balloob, @bieniu, @thecode, @chemelli74, mind taking a look at this pull request as it has been labeled with an integration (shelly) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@mib1185 mib1185 force-pushed the shelly/add-ota-update-service branch from fa25b11 to bbc56c9 Compare November 4, 2021 22:24
@mib1185 mib1185 marked this pull request as ready for review November 5, 2021 00:08
@mib1185 mib1185 marked this pull request as draft November 5, 2021 21:01
@mib1185
Copy link
Copy Markdown
Member Author

mib1185 commented Nov 5, 2021

as discussed on Discord, split this PR into 3 parts

  1. Use constant CONF_SLEEP_PERIOD instead of string "sleep_period" in Shelly integration #59195
  2. Bump aioshelly to 1.0.4 #59209
  3. the OTA update service itself

Those this PR goes back into draft, until 1) and 2) are done

@mib1185 mib1185 force-pushed the shelly/add-ota-update-service branch from bb51f4b to b603e16 Compare November 5, 2021 21:04
@mib1185 mib1185 force-pushed the shelly/add-ota-update-service branch from daf6c43 to d684a74 Compare November 6, 2021 17:17
@mib1185 mib1185 marked this pull request as ready for review November 6, 2021 17:18
@chemelli74 chemelli74 removed the dependency Pull requests marked as a dependency upgrade label Nov 10, 2021
@mib1185 mib1185 changed the title Add ota firmware update service for Shelly devices Add button to trigger ota firmware update for Shelly devices Nov 11, 2021
@mib1185 mib1185 force-pushed the shelly/add-ota-update-service branch from d419458 to df702e8 Compare November 11, 2021 19:33
@mib1185
Copy link
Copy Markdown
Member Author

mib1185 commented Nov 11, 2021

support for battery powered devices has been removed, since there are to many challenges with them, which solution would overwhelm this PR.

@mib1185
Copy link
Copy Markdown
Member Author

mib1185 commented Nov 16, 2021

recent changes

  • remove "beta channel" switch
  • add second button for update to beta version
  • "beta update" button disabled by default, since most users will run on stable builds

@mib1185 mib1185 force-pushed the shelly/add-ota-update-service branch from a637f98 to 8a49e60 Compare November 16, 2021 21:09
@mib1185 mib1185 requested a review from frenck November 16, 2021 22:59
state = hass.states.get("button.test_name_ota_update_beta")

assert entry
assert state is None
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After pressing the button, the state should be the time the button was pressed, not None. There seems to be something wrong?

Copy link
Copy Markdown
Member Author

@mib1185 mib1185 Nov 26, 2021

Choose a reason for hiding this comment

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

it is not the state.state ... it is just the check that the beta button is not enabled by default, so not present in the state machine

Copy link
Copy Markdown
Member

@frenck frenck Nov 26, 2021

Choose a reason for hiding this comment

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

is not enabled by default, so not present in the state machine

In that case, I'm confused, why can it be called by the above service call in that case? If the button entity isn't enabled, that shouldn't be working...

Copy link
Copy Markdown
Member Author

@mib1185 mib1185 Nov 26, 2021

Choose a reason for hiding this comment

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

the service call is for button.test_name_ota_update (without beta suffix) ;)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it's ok ... the weekend is near ... take a beer and relax 🍻

@frenck frenck requested review from frenck and removed request for frenck November 26, 2021 11:56
Copy link
Copy Markdown
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @mib1185 👍

@frenck frenck merged commit 296b738 into home-assistant:dev Nov 26, 2021
@mib1185 mib1185 deleted the shelly/add-ota-update-service branch November 26, 2021 13:37
jbouwh pushed a commit to jbouwh/core that referenced this pull request Nov 27, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2021
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.

8 participants