Skip to content

Show persistent notification on Doorbird schedule failure#20033

Merged
fabaff merged 6 commits into
home-assistant:devfrom
oblogic7:doorbird_updates
Jan 13, 2019
Merged

Show persistent notification on Doorbird schedule failure#20033
fabaff merged 6 commits into
home-assistant:devfrom
oblogic7:doorbird_updates

Conversation

@oblogic7
Copy link
Copy Markdown
Contributor

@oblogic7 oblogic7 commented Jan 12, 2019

Description:

Cleanup unnecessary return inside of loop. Adds persistent notification for failed schedule setup.

Related issue (if applicable): fixes #19661

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.

Add persistent notification on failure to configure doorbird schedule.
@ghost ghost added the in progress label Jan 12, 2019
Comment thread homeassistant/components/doorbird.py Outdated
@oblogic7
Copy link
Copy Markdown
Contributor Author

@MartinHjelmare Here are the changes promised on #18730

try:
doorstation.update_schedule(hass)
except HTTPError:
hass.components.persistent_notification.create(
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.

Shouldn't we just log an error and return False as the other setup errors do?

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.

But should we not return False? We say they need to fix and restart. Why should we set up the component after this error? And components that fail set up already get a persistent notification.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Returning false will result in multiple notifications like below. The notification triggered by the false return implies that the issue is with the HA configuration. This is not accurate since it is truly an issue with the permissions on the user. The user is valid and has authenticated successfully, but does not have permission to set the schedule on the device. I believe the custom notification communicates this better and not having a return means unnecessary duplication doesn't happen on the notifications.

image

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.

We shouldn't set up the component if its not working properly. Please return False. It's ok to have two persistent notifications if you really want to have a custom one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Technically, the component isn't affected by this failure since it is simply a failure to confiure the remote device, but I have made the change as requested.

@oblogic7
Copy link
Copy Markdown
Contributor Author

oblogic7 commented Jan 13, 2019 via email

@fabaff fabaff merged commit db87842 into home-assistant:dev Jan 13, 2019
@ghost ghost removed the in progress label Jan 13, 2019
@balloob balloob mentioned this pull request Jan 23, 2019
alandtse pushed a commit to alandtse/home-assistant that referenced this pull request Feb 12, 2019
…tant#20033)

* Remove unnecessary return.
Add persistent notification on failure to configure doorbird schedule.

* Update doorbirdpy to 2.0.5

* Fix bare except

* Bump version again

* Lint

* Return false
DanielWeeber added a commit to DanielWeeber/core that referenced this pull request Mar 24, 2026
Ported to current upstream dev format (unified GridSourceType).
Adds `name: NotRequired[str]` to GridSourceType, SolarSourceType,
BatterySourceType, GasSourceType, WaterSourceType and corresponding
voluptuous schemas.

This mirrors the same pattern already established for
DeviceConsumption in PR home-assistant#20033.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error during setup of component doorbird

5 participants