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

Weather get_forecast service returns 500 on 2023.9.0 #99820

Closed
janwo opened this issue Sep 7, 2023 · 18 comments · May be fixed by home-assistant/developers.home-assistant#2150
Closed

Weather get_forecast service returns 500 on 2023.9.0 #99820

janwo opened this issue Sep 7, 2023 · 18 comments · May be fixed by home-assistant/developers.home-assistant#2150

Comments

@janwo
Copy link

janwo commented Sep 7, 2023

The problem

Using the new weather.get_forecast - service via API returns a 500. When calling the forecast via the UI in the developer settings, it works.

Any idea what went wrong? Calling other services (e.g. input_select) via the API works properly.

Bildschirmfoto 2023-09-07 um 14 38 50

What version of Home Assistant Core has the issue?

core-2023.9.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@joostlek
Copy link
Member

joostlek commented Sep 7, 2023

What's in the logs?

@janwo
Copy link
Author

janwo commented Sep 8, 2023

What's in the logs?

This is the output.

Logger: aiohttp.server
Source: core.py:1926
First occurred: 7. September 2023 um 14:11:59 (21 occurrences)
Last logged: 08:22:41

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/api/__init__.py", line 347, in post
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1926, in async_call
    raise ValueError(
ValueError: Service call requires responses but caller did not ask for responses

@joostlek
Copy link
Member

joostlek commented Sep 8, 2023

cc @allenporter

@allenporter
Copy link
Contributor

What this means is that the websocket service call does not support response values. It wasn't added yet. Developer tools does not use this call, it uses the script API to get response values. Have a look at the websocket messages and you can see how to do this in the meantime until this feature is added.

There is a pending PR #98610 to add support for this.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@allenporter
Copy link
Contributor

I believe #98610 addressed this. feel free to re-open if something is missed here.

@iamjackg
Copy link
Contributor

I think there might have been a misunderstanding here: the issue @janwo reported is with the HTTP API, not the websocket API. It seems like it needs to be handled here:

domain, service, data, blocking=True, context=context

@allenporter allenporter reopened this Dec 15, 2023
@github-actions github-actions bot removed the stale label Dec 15, 2023
@allenporter
Copy link
Contributor

OK sorry -- so what this means is the HTTP service call does not support response values. It wasn't added yet.
This is kinda borderline feature request.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@mcmanigle
Copy link

This is kinda borderline feature request.

Pretty borderline though... For example, I use (used, I guess) an HTTP REST call to Home Assistant from an Arduino-based clock to populate the hourly forecast. Because the hourly forecast attribute has now disappeared, the correct / analogous way to retrieve this information via HTTP REST would be by a call to the get_forecasts service.

So, is it a feature request? Maybe, I guess? To me, it is replacing a feature that was removed at an unfortunate time.

@github-actions github-actions bot removed the stale label Mar 21, 2024
@iamjackg
Copy link
Contributor

iamjackg commented Apr 5, 2024

Yeah, this feels like it was forgotten and left out when service responses were added. Not really a feature request as much as a "hey, you implemented this all over but forgot to expose it via the API that everything else is available through."

I'll take a look and see if I can work on a PR for this.

@Silergo
Copy link

Silergo commented Apr 7, 2024

Support this. Can't get weather forecast for lametric without this feature, because forecast disappeared from attributes.

@Tezzlicious
Copy link

Using a template sensor as a workaround for now to get things working again in AppDaemon.

@sebsebseb1982
Copy link

Using a template sensor as a workaround for now to get things working again in AppDaemon.

How did you do that ?

@Brephlas
Copy link

Brephlas commented Apr 7, 2024

I adapted to this change in Februar, based on the reply of Nick2253 here: https://community.home-assistant.io/t/weather-forecasts-in-appdaemon/634223/5

@sahar-alkolombra
Copy link

Support this. Can't get weather forecast for lametric without this feature, because forecast disappeared from attributes.

yup, same issue here, forecast removed from attributes and when trying to use callService function or use the API services to call weather get_forecasts im getting the same error:
Service call requires responses but caller did not ask for responses

@iamjackg
Copy link
Contributor

Unfortunately, the outcome of the architecture conversation is that the REST API has been superseded by the WebSocket API and is no longer going to be updated, so it looks like this won't happen.

@allenporter
Copy link
Contributor

Thanks. Apologies I didn't know the stance on extending the rest API for new use cases sooner. Appreciate the effort to contribute nonetheless.

The good news is that the original PRS I referenced above have landed so no further work is needed to expose service responses over APIs following the latest best practices.

@allenporter allenporter closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 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
10 participants