PiotrMachowski / Home-Assistant-custom-components-Tauron-AMIplus

This sensor uses unofficial API to get energy usage and generation data from https://elicznik.tauron-dystrybucja.pl.
MIT License
128 stars 34 forks source link

Problem z pobieraniem danych historycznych #180

Open mickeyreg opened 5 months ago

mickeyreg commented 5 months ago

Wchodzę w HA do Narzędzi developerskich i wybieram Usługi a potem wpisuję tauron_amiplus.download_statistics, wybieram mój licznik oraz datę z historii (dowolną, testowałem dzień, miesiąc i 4 lata wstecz) i kończy się komunikatem:

_Nie udało się wywołać usługi tauron_amiplus.downloadstatistics. Unknown error

W logu w tym momencie pojawia się:

2024-03-15 14:35:00.491 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: too many values to unpack (expected 1)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tauron_amiplus/services.py", line 42, in async_handle_service
    [config_entry_id] = device.config_entries
    ^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 1)
2024-03-15 14:35:00.496 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140123817873856] Error handling message: Unknown error (unknown_error) Misio Bury from 172.16.32.2 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 795, in handle_execute_script
    script_result = await script_obj.async_run(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tauron_amiplus/services.py", line 42, in async_handle_service
    [config_entry_id] = device.config_entries
    ^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 1)
mickeyreg commented 5 months ago

Tak sobie pomyślałem, że powinienem napisać powyżej: HA 2024.3.1 na HA OS 12.1