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

Window controls do not work #32

Closed
3 tasks done
zzarne opened this issue Feb 13, 2024 · 4 comments
Closed
3 tasks done

Window controls do not work #32

zzarne opened this issue Feb 13, 2024 · 4 comments

Comments

@zzarne
Copy link
Contributor

zzarne commented Feb 13, 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

This may be an issue in the fleet api library. When clicking on open or close windows, an exception is reported and no window moves. Variable 'result' is of type text and empty, like in #31.
EU 2023 Model 3.

Reproduction steps

  1. click close windows

Debug logs

2024-02-13 14:01:50.407 DEBUG (MainThread) [tesla_fleet_api] Sending request to api/1/vehicles/VVVVVVVVVVVVVVVVV/command/window_control
2024-02-13 14:01:50.407 DEBUG (MainThread) [tesla_fleet_api] Body: {"command": "close"}
2024-02-13 14:01:50.615 DEBUG (MainThread) [tesla_fleet_api] Response Status: 200
2024-02-13 14:01:50.615 DEBUG (MainThread) [tesla_fleet_api] Response Text: 
2024-02-13 14:01:50.615 DEBUG (MainThread) [custom_components.teslemetry] Command result: 
2024-02-13 14:01:50.616 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [CCCCCCCCCCCCCCC] string indices must be integers, not 'str'
Traceback (most recent call last):
  File "/home/hass/.local/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hass/.local/lib/python3.12/site-packages/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/home/hass/.local/lib/python3.12/site-packages/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hass/.local/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hass/.local/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/home/hass/.homeassistant/custom_components/teslemetry/cover.py", line 83, in async_close_cover
    await self.handle_command(self.api.window_control(command=WindowCommand.CLOSE))
  File "/home/hass/.homeassistant/custom_components/teslemetry/entity.py", line 138, in handle_command
    if not result["response"]["result"]:
           ~~~~~~^^^^^^^^^^^^
TypeError: string indices must be integers, not 'str'
@Bre77
Copy link
Contributor

Bre77 commented Feb 14, 2024

Can you please re-test this on the latest release.

@zzarne
Copy link
Contributor Author

zzarne commented Feb 15, 2024

Sure. On 2edacfa:

File "/home/hass/.homeassistant/custom_components/teslemetry/entity.py", line 138, in handle_command
    if not (message := result.get("response",{}).get("result")):
                       ^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get'

result is still an (empty) string, not a dict.

@Bre77
Copy link
Contributor

Bre77 commented Feb 15, 2024

Thanks, thats useful, I thought that would have been fixed server side, but apparently not.

@zzarne
Copy link
Contributor Author

zzarne commented May 7, 2024

Confirmed to work now, apparently with the same changes that fixed #31 .

@zzarne zzarne closed this as completed May 7, 2024
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