Skip to content

Allow mobile app to disable entities by default#71562

Merged
bdraco merged 1 commit intodevfrom
mobile-app-disable-default
May 9, 2022
Merged

Allow mobile app to disable entities by default#71562
bdraco merged 1 commit intodevfrom
mobile-app-disable-default

Conversation

@balloob
Copy link
Member

@balloob balloob commented May 9, 2022

Breaking change

Proposed change

Add a new optional default_disabled keyword to the register_sensor mobile app webhook. This allows the mobile app to indicate which sensors need to be disabled by default.

This is a step closer to keeping disabled entities in sync between mobile app / HA.

Also noticed some duplicate logic that I cleaned up.

CC @home-assistant/android @home-assistant/ios-developers

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

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

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (mobile_app) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label May 9, 2022
@bdraco
Copy link
Member

bdraco commented May 9, 2022

Not sure if its expected, but when testing this I removed my phone from the integrations page and reloaded the page on my phone

2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_activity
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_pedometer_distance
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_pedometer_floors_ascended
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_pedometer_floors_descended
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_pedometer_steps
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_pedometer_avg_active_pace
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_battery_level
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_battery_state
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_storage
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_connectivity_ssid
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_connectivity_bssid
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_connectivity_connection_type
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_connectivity_sim_1
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_connectivity_sim_2
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_focus
2022-05-09 12:59:33 ERROR (MainThread) [homeassistant.components.mobile_app.webhook] Refusing to update Splint Mail non-registered sensor: c740497e1a049cab11e3fa4820d6e1db6b4d347d95f1fdb037d8c55fd89055c4_last_update_trigger

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.

Tested and didn't find any regressions. Verified device registry and entity registry populated as expected.

@bdraco bdraco merged commit 539ce7f into dev May 9, 2022
@bdraco bdraco deleted the mobile-app-disable-default branch May 9, 2022 13:05
@TomBrien
Copy link
Member

TomBrien commented May 9, 2022

Not sure if its expected, but when testing this I removed my phone from the integrations page and reloaded the page on my phone

This is the expected behaviour when sensors haven't been registered (i.e. when config entry has been deleted or when app is first connected). It will trigger this log entry then register the sensor. TBH ERROR is probably overly aggressive and this should be a warning

@balloob
Copy link
Member Author

balloob commented May 9, 2022

I think that it doesn't need to be a warning/error at all as we're returning an error to the mobile app, which can deal with it.

@balloob balloob mentioned this pull request May 9, 2022
22 tasks
@balloob
Copy link
Member Author

balloob commented May 9, 2022

#71601

@github-actions github-actions bot locked and limited conversation to collaborators May 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed core has-tests integration: mobile_app new-feature 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.

6 participants