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

[Bug] PlugIn should wrap error to native HomeAssistant error to support 'continue_on_error' #559

Open
Abba- opened this issue Mar 20, 2024 · 9 comments
Labels
enhancement An improvement to the software

Comments

@Abba-
Copy link

Abba- commented Mar 20, 2024

Describe the bug

Without being able to dive into the code, I'm making a bit of an assumption here.
I'm assuming that this plugin throws a generic error (vs a HomeAssistant specific error) when something isnt as expected.

HomeAssistant continue_on_error only handles HomeAsssistant specific errors. Sample discussion and 2.

So if any error happens (which can be a separate report, I seem to sometime get an error even though an action was successful), currently the whole script stops instead of being able to be 'caught' by HomeAssistant and continuing.

Sample error:

2024-03-20 14:38:41.564 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140589164157248] {'code': '3005', 'ts': 1710959921516, 'msg': 'property only set by main user', 'data': {}, 'traceId': 'aae52bcd55cf61a9a334226aa00c2c6d'}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/wyzeapi/switch.py", line 334, in async_turn_on
    await self._service.turn_on_notifications(self._device)
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/camera_service.py", line 123, in turn_on_notifications
    await self._set_property(camera, PropertyIDs.NOTIFICATION.value, "1")
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/base_service.py", line 359, in _set_property
    check_for_errors_standard(response_json)
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/utils.py", line 84, in check_for_errors_standard
    raise UnknownApiError(response_json)

### (There is currently workaround by calling things script.turn_on)

@Abba- Abba- added the bug Something isn't working label Mar 20, 2024
@brg468 brg468 added enhancement An improvement to the software and removed bug Something isn't working labels Mar 20, 2024
@neilbrookins
Copy link

I’ve run into this too. It causes problems when the failure is minor and non fatal, and the automation then fails to run the next step in a sequence that may be a very critical important step. So, I’m agreeing this is an important improvement.

Copy link

github-actions bot commented May 1, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label May 1, 2024
@Abba-
Copy link
Author

Abba- commented May 1, 2024

Voting for this to be kept open...

@github-actions github-actions bot removed the Stale label May 2, 2024
Copy link

github-actions bot commented Jun 1, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jun 1, 2024
Copy link

github-actions bot commented Jun 7, 2024

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2024
@Abba-
Copy link
Author

Abba- commented Jun 11, 2024

Can we unstale ?

@brg468
Copy link
Collaborator

brg468 commented Jun 11, 2024

I’ll reopen, it would be a nice improvement. Can’t say anyone will get to it anytime soon but it’s worth keeping as a a feature request/enhancement IMHO.

@brg468 brg468 reopened this Jun 11, 2024
@brg468 brg468 removed the Stale label Jun 11, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jul 12, 2024
@kaovilai
Copy link

unstale

@github-actions github-actions bot removed the Stale label Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement to the software
Projects
None yet
Development

No branches or pull requests

4 participants