Teslemetry / hass-teslemetry

Teslemetry integration from Home Assistant through HACS
https://teslemetry.com
MIT License
13 stars 7 forks source link

1.7.4: homeassistant.exceptions.HomeAssistantError: Could not wake up vehicle #45

Closed purcell-lab closed 7 months ago

purcell-lab commented 8 months ago

Checklist

Describe the issue

Inability to wake up the vehicle could be handled as a Warning, as it is generally a transient condition.

It is currently handled as a HomeAssistantError. image

Reproduction steps

No response

Debug logs

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:239
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 5:22:17 PM (1 occurrences)
Last logged: 5:22:17 PM

[281471908809152] Could not wake up vehicle
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 "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 111, in async_set_value
    await entity.async_set_native_value(native_value)
  File "/config/custom_components/teslemetry/number.py", line 190, in async_set_native_value
    await self.wake_up_if_asleep()
  File "/config/custom_components/teslemetry/entity.py", line 218, in wake_up_if_asleep
    raise HomeAssistantError("Could not wake up vehicle")
homeassistant.exceptions.HomeAssistantError: Could not wake up vehicle
Bre77 commented 8 months ago

I dont believe Home Assistant has a way to raise warnings, only logging them. However this is a service failure since the service call did not run, so I think error is appropriate.

Essentially if I raised a warning, Home Assistant would believe the service call was successful even when it isnt.