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

Service call to navigation_request endpoint gives various errors #84

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

Service call to navigation_request endpoint gives various errors #84

fhteagle opened this issue May 18, 2024 · 3 comments

Comments

@fhteagle
Copy link

fhteagle 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

Attempting to use the teslemetry.navigation_request service call in HA results in various errors depending on what values are filled or not

Reproduction steps

  1. Use curl to verify working command syntax for /command/navigation_request endpoint
  2. Use HA developer call service screen using the same data
  3. Note error

Examples of service call YAML variations that I tried:

service: teslemetry.navigation_request
data:
  device_id: MYDEIVICESTRING
  type: "share_ext_content_raw"
  value: "Telluride, CO, USA"
  locale: "en-US"
service: teslemetry.navigation_request
data:
  device_id: MYDEIVICESTRING
  type: "share_ext_content_raw"
  value: "Telluride, CO, USA"
  locale: "en-US"
  timestamp_ms: 1716060381572
service: teslemetry.navigation_request
data:
  device_id: MYDEIVICESTRING
  type: "share_ext_content_raw"
  value: "{
    \"android.intent.extra.TEXT\": \"Telluride, CO, USA\"
  },"
  locale: "en-US"
  timestamp_ms: 1716060381572

Debug logs

With timestamp_ms set:

Error message in UI is "Failed to call service teslemetry.navigation_request. extra keys not allowed @ data['timestamp_ms']. Got None"

2024-05-18 13:16:50.056 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['timestamp_ms']
2024-05-18 13:16:50.056 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [124545501773248] Error handling message: extra keys not allowed @ data['timestamp_ms']. Got None (invalid_format) MYUSER from MYIP (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36)





With timestamp_ms not set:

Error message in UI is: "Failed to call service teslemetry.navigation_request. Unknown error"


2024-05-18 13:19:40.473 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: VehicleSpecific.navigation_request() got an unexpected keyword argument 'value'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  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 "/config/custom_components/teslemetry/services.py", line 153, in navigate_request
    vehicle.api.navigation_request(
TypeError: VehicleSpecific.navigation_request() got an unexpected keyword argument 'value'
2024-05-18 13:19:40.475 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [124545501773248] Error handling message: Unknown error (unknown_error) MYUSER from MYIP (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 793, in handle_execute_script
    script_result = await script_obj.async_run(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1731, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 503, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 533, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  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 "/config/custom_components/teslemetry/services.py", line 153, in navigate_request
    vehicle.api.navigation_request(
TypeError: VehicleSpecific.navigation_request() got an unexpected keyword argument 'value'
@fhteagle fhteagle changed the title Service all for navigation_request endpoint gives various errors Service call to navigation_request endpoint gives various errors May 18, 2024
@Nessy1970
Copy link

timestamp_ms: >-
{{ as_timestamp(now()) | int }}

@Nessy1970
Copy link

I'm also trying to set up sending addresses to the car.
But in my case, it seems that Teslemetry services do not exist in HA!

envoie_la_position_de_fernanda_dans_la_voiture:
alias: Envoie la position de fernanda dans la voiture
sequence:
- service: teslemetry.navigation_request
data:
device_id: XXXXXXXXXXXXXX
type: "share_ext_content_raw"
locale: "fr-fr"
value:
android.intent.extra.TEXT: "{{ states('sensor.gsm_fernanda_ha_app_lieu_geocode') }}" # Address goes here
timestamp_ms: >-
{{ as_timestamp(now()) | int }}

Service

@Bre77
Copy link
Contributor

Bre77 commented Jun 19, 2024

I'm also trying to set up sending addresses to the car.
But in my case, it seems that Teslemetry services do not exist in HA!

envoie_la_position_de_fernanda_dans_la_voiture:
alias: Envoie la position de fernanda dans la voiture
sequence:
- service: teslemetry.navigation_request
data:
device_id: XXXXXXXXXXXXXX
type: "share_ext_content_raw"
locale: "fr-fr"
value:
android.intent.extra.TEXT: "{{ states('sensor.gsm_fernanda_ha_app_lieu_geocode') }}" # Address goes here
timestamp_ms: >-
{{ as_timestamp(now()) | int }}

Service

Ok that's definitely a bug, I'll take a look and get that fixed in the next version.

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

3 participants