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

Problem with calling weather-forecast-cache. #412

Closed
radim2tej opened this issue Dec 30, 2024 · 1 comment
Closed

Problem with calling weather-forecast-cache. #412

radim2tej opened this issue Dec 30, 2024 · 1 comment

Comments

@radim2tej
Copy link
Contributor

Describe the bug
When calling weather-forecast-cache, the system reports an insufficient number of parameters.

2024-12-30 20:17:33,838 - web_server - INFO - >> Obtaining params:
2024-12-30 20:17:33,840 - web_server - INFO - Passed runtime parameters: {}
2024-12-30 20:17:33,840 - web_server - INFO - >> Performing weather forecast, try to caching result
2024-12-30 20:17:33,841 - web_server - ERROR - Exception on /action/weather-forecast-cache [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/web_server.py", line 380, in action_call
weather_forecast_cache(emhass_conf, params, runtimeparams, app.logger)
File "/usr/local/lib/python3.11/dist-packages/emhass/command_line.py", line 440, in weather_forecast_cache
params, retrieve_hass_conf, optim_conf, plant_conf = utils.treat_runtimeparams(
^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: treat_runtimeparams() takes 8 positional arguments but 9 were given

In old sourcecode 0.11.4 was:

def weather_forecast_cache(
    emhass_conf: dict, params: str, runtimeparams: str, logger: logging.Logger
) -> bool:
    # Parsing yaml
    retrieve_hass_conf, optim_conf, plant_conf = utils.get_yaml_parse(params, logger)
    # Treat runtimeparams
    params, retrieve_hass_conf, optim_conf, plant_conf = utils.treat_runtimeparams(
        runtimeparams,
        params,
        retrieve_hass_conf,
        optim_conf,
        plant_conf,
        "forecast",
        logger,
        emhass_conf,
    )

In 0.12.1:

def weather_forecast_cache(
    emhass_conf: dict, params: str, runtimeparams: str, logger: logging.Logger
) -> bool:
    # Parsing yaml
    retrieve_hass_conf, optim_conf, plant_conf = utils.get_yaml_parse(params, logger)
    # Treat runtimeparams
    params, retrieve_hass_conf, optim_conf, plant_conf = utils.treat_runtimeparams(
        runtimeparams,
        params,
        retrieve_hass_conf,
        optim_conf,
        plant_conf,
        "forecast",
        logger,
        emhass_conf,
        {},
    )

To Reproduce
weather forecast is called from automation, where a shell script is called (in configuration.yaml):

shell_command:
  weather_cache: "curl -i -H \"Content-Type:application/json\" -X POST -d '{}' http://localhost:5000/action/weather-forecast-cache"

Expected behavior
No errors.

Screenshots
If applicable, add screenshots to help explain your problem.

Home Assistant installation type

  • Home Assistant OS 13.2
  • Home Assistant Supervised 2024.12.0
  • Home Assistant Core 2024.12.4

Your hardware

  • OS: HA OS
  • Architecture: amd64

EMHASS installation type

  • Add-on
@davidusb-geek
Copy link
Owner

Thanks for reporting this.
Solved in #415

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