py-smart-gardena / hass-gardena-smart-system

Home Assistant custom component integration for Gardena Smart System
Apache License 2.0
191 stars 45 forks source link

ReadTimeout Error while running automation #214

Open dennisduysak opened 2 weeks ago

dennisduysak commented 2 weeks ago

I am experiencing a ReadTimeout error with my Gardena integration in Home Assistant. This issue occurs while executing my automation, which is designed to start a new valve every 20 minutes. The error consistently occurs when starting the first valve, causing the entire automation to fail despite continue_on_error: true being set.

Effected device:

Environment:

Additional Information:

Logger: homeassistant.components.automation.bewasserung_neu
Quelle: components/automation/__init__.py:723
Integration: Automatisierung (Dokumentation, Probleme)
Erstmals aufgetreten: 16. Juni 2024 um 06:00:06 (2 Vorkommnisse)
Zuletzt protokolliert: 07:00:05

While executing automation automation.bewasserung_neu
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 373, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request
    raise exc from None
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request
    response = await connection.handle_async_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request
    return await self._connection.handle_async_request(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py", line 143, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py", line 113, in handle_async_request
    ) = await self._receive_response_headers(**kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py", line 186, in _receive_response_headers
    event = await self._receive_event(timeout=timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py", line 224, in _receive_event
    data = await self._network_stream.read(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 32, in read
    with map_exceptions(exc_map):
  File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/usr/local/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ReadTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 723, in async_trigger
    return await self.action_script.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 556, 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 753, in _async_device_step
    await device_action.async_call_action_from_config(
  File "/usr/src/homeassistant/homeassistant/components/device_automation/action.py", line 72, in async_call_action_from_config
    await platform.async_call_action_from_config(hass, config, variables, context)
  File "/usr/src/homeassistant/homeassistant/components/switch/device_action.py", line 36, in async_call_action_from_config
    await toggle_entity.async_call_action_from_config(
  File "/usr/src/homeassistant/homeassistant/components/device_automation/toggle_entity.py", line 124, in async_call_action_from_config
    await hass.services.async_call(
  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 "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1680, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/gardena_smart_system/switch.py", line 363, in turn_on
    ).result()
      ^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.12/site-packages/gardena/devices/smart_irrigation_control.py", line 58, in start_seconds_to_override
    await self.location.smart_system.call_smart_system_service(valve_id, data)
  File "/usr/local/lib/python3.12/site-packages/gardena/smart_system.py", line 100, in call_smart_system_service
    r = await self.client.put(
        ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1929, in put
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/authlib/integrations/httpx_client/oauth2_client.py", line 90, in request
    return await super().request(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1574, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1661, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1689, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1763, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 372, in handle_async_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ReadTimeout

Automation looks like:

alias: Bewässerung - Neu
description: ""
trigger:
  - platform: time
    at: "07:00:00"
condition:
  - condition: time
    weekday:
      - mon
      - wed
      - fri
      - sun
action:
  - type: turn_on
    continue_on_error: true
    device_id: 70ffb5e17a28fbd22e4f85b62678bab8
    entity_id: 49cb9b01357762d087cbc5364c2ffd91
    domain: switch
    enabled: true
  - delay:
      hours: 0
      minutes: 19
      seconds: 45
      milliseconds: 0
    enabled: true
  - type: turn_on
    continue_on_error: true
    device_id: 70ffb5e17a28fbd22e4f85b62678bab8
    entity_id: 80e998bb8f7328e5628638bb0242b23b
    domain: switch
  - delay:
      hours: 0
      minutes: 19
      seconds: 45
      milliseconds: 0
  - type: turn_on
    continue_on_error: true
    device_id: 70ffb5e17a28fbd22e4f85b62678bab8
    entity_id: aae5e10b34590f21e9f99b7b3595a424
    domain: switch
  - delay:
      hours: 0
      minutes: 19
      seconds: 45
      milliseconds: 0
  - type: turn_on
    continue_on_error: true
    device_id: 70ffb5e17a28fbd22e4f85b62678bab8
    entity_id: b4ae42a68ae7382a3683deb8f6ab2a44
    domain: switch
mode: single
oliskippy commented 2 weeks ago

I faced the same 2 days ago in a script opening the watering valves of the gardena smart irrigation control: Error: ReadTimeout → script ends. Any solution would be very appreciated.

domain: switch service: turn_off service_data: {} target: entity_id:

Stoffl17 commented 1 week ago

Same for me! Would be nice to get it solved as summer is coming soon :-) If I can support with log-files just let me know! THANKS!

steyrblade commented 1 week ago

Same issue. Any news?

nopbop commented 1 week ago

Same issue for me in version 2024.6.4

Executed: June 27, 2024 at 10:23:30 PM Error: ReadTimeout Result: params: domain: switch service: turn_off service_data: {} target: entity_id:

  • switch.irrigation_control_1_plates_bandes_piscine running_script: false
Uwe1960 commented 6 days ago

Same issue.

Effected device:

Gardena smart Water Control

Environment:

Home Assistant version: 2024.6.4 Gardena integration version: 1.1.1-rc3 Operating system: Running in Docker container

mike4001 commented 2 days ago

Same here

It´s a bit hit and miss.

Sometimes the integration works without any problems and sometimes it does not ...