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

Vent Windows cover isn't working #86

Open
3 tasks done
Snuffy2 opened this issue May 18, 2024 · 5 comments
Open
3 tasks done

Vent Windows cover isn't working #86

Snuffy2 opened this issue May 18, 2024 · 5 comments

Comments

@Snuffy2
Copy link

Snuffy2 commented May 18, 2024

Checklist

  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of any previous issues..

Describe the issue

The Vent Windows cover is always showing as unavailable. When I click the open/close button I get the error below.

Reproduction steps

  1. Vent Windows cover is unavailable
  2. Open/Close gives error below
    ...

Debug logs

2024-05-18 16:39:15.957 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546328350144] Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/teslemetry/helpers.py", line 36, in handle_command
    result = await command
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tesla_fleet_api/vehiclespecific.py", line 344, in window_control
    return await self._parent.window_control(self.vin, command, lat, lon)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tesla_fleet_api/vehicle.py", line 604, in window_control
    return await self._request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tesla_fleet_api/teslemetry.py", line 69, in _request
    return await super()._request(method, path, params, json)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tesla_fleet_api/teslafleetapi.py", line 117, in _request
    await raise_for_status(resp)
  File "/usr/local/lib/python3.12/site-packages/tesla_fleet_api/exceptions.py", line 282, in raise_for_status
    raise Forbidden(data)
tesla_fleet_api.exceptions.Forbidden: Access to this resource is not authorized, developers should check required Scope.

The above exception was the direct cause of the following exception:

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 2738, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/teslemetry/cover.py", line 74, in async_open_cover
    await self.handle_command(self.api.window_control(command=WindowCommand.VENT))
  File "/config/custom_components/teslemetry/entity.py", line 212, in handle_command
    return await handle_vehicle_command(command)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/teslemetry/helpers.py", line 45, in handle_vehicle_command
    result = await handle_command(command)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/teslemetry/helpers.py", line 38, in handle_command
    raise HomeAssistantError(f"Teslemetry command failed, {e.message}") from e
homeassistant.exceptions.HomeAssistantError: Teslemetry command failed, Access to this resource is not authorized, developers should check required Scope.
@Bre77
Copy link
Contributor

Bre77 commented May 18, 2024

Hey, can I confirm you have provided the vehicle command scope and installed the virtual key?

https://teslemetry.com/docs/topics/commandsigning

https://teslemetry.com/docs/getting-started/initial-setup#scopes

@Snuffy2
Copy link
Author

Snuffy2 commented May 18, 2024

2024-05-18_19-42-26 221 2024-05-18_19-43-32 251

@Bre77
Copy link
Contributor

Bre77 commented May 19, 2024

Thanks, this also shows your vehicle requires command signing, but that is not happening on window_control commands because according to the Tesla documentation is not required. You have proven it is.

I am pushing out a server side fix for this now, please try again shortly and let me know if its working for you.

@Snuffy2
Copy link
Author

Snuffy2 commented May 19, 2024

We're getting closer. The HA vent windows cover controls now work to open and close the windows. When the windows are vented, the HA vent windows cover status remains as open. However, when the windows are closed, the status shows closed for ~20 seconds but then goes to Unknown.
2024-05-19_09-17-47 438

2024-05-19_09-16-54 707

@Bre77
Copy link
Contributor

Bre77 commented Aug 1, 2024

Found the bug, will be fixed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants