nielsfaber / scheduler-card

HA Lovelace card for control of scheduler entities
GNU General Public License v3.0
926 stars 117 forks source link

After upgrade to HA 2024.03 - crashes when adding a schedule from service-call #809

Closed shlomki closed 6 months ago

shlomki commented 8 months ago

Checklist

Card Version

v3.5.1 (latest)

Component Version

3.3.2

Bug description

After upgrading HA to 2024.03, scheduler-card integration started crashing when using the service call (scheduler.add) and then navigating to the card.

Screenshot from browser console: image

The following errors appear in the system log right after calling the service:

Logger: homeassistant Source: util/timeout.py:469 First occurred: 10:48:52 PM (1 occurrences) Last logged: 10:48:52 PM

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 625, in async_add_entities await add_func(coros, entities, timeout) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 573, in _async_add_entities async with self.hass.timeout.async_timeout(timeout, self.domain): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/util/timeout.py", line 469, in async_timeout current_task: asyncio.Task[Any] | None = asyncio.current_task() ^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: no running event loop

Logger: py.warnings Source: helpers/entity_platform.py:350 First occurred: 10:48:52 PM (1 occurrences) Last logged: 10:48:52 PM

/usr/local/lib/python3.12/asyncio/tasks.py:865: RuntimeWarning: coroutine 'EntityPlatform._async_add_entity' was never awaited def shield(arg):

Logger: homeassistant.util.logging Source: util/logging.py:102 First occurred: 10:52:21 PM (1 occurrences) Last logged: 10:52:21 PM

Exception in async_timer_updated when dispatching 'scheduler_timer_updated': ('639431',) Traceback (most recent call last): File "/config/custom_components/scheduler/switch.py", line 168, in async_timer_updated self._next_entries = self._timer_handler.slot_queue ^^^^^^^^^^^^^^^^^^^ AttributeError: 'ScheduleEntity' object has no attribute '_timer_handler'

This one starts appearing and bombarding the logs with tens of log messages per second (notice 940 occurrences):

Logger: frontend.js.latest.202403070 Source: components/system_log/init.py:306 First occurred: 10:51:18 PM (940 occurrences) Last logged: 10:52:21 PM

Uncaught error from Chrome 123.0.0.0 on Windows 10 TypeError: Cannot read properties of undefined (reading 'every') _o (/hacsfiles/scheduler-card/scheduler-card.js:1826:597) /hacsfiles/scheduler-card/scheduler-card.js:1826:4066 /hacsfiles/scheduler-card/scheduler-card.js:1826:4056

Steps to reproduce

  1. Have HA 2024.03 installed
  2. Have scheduler card version v.3.5.1 and component 3.3.2 installed
  3. Go to Developer tools > Services
  4. Paste in the following service call (change entity to any random light):
    
    service: scheduler.add
    data:
    weekdays:
    - daily
    timeslots:
    - start: "12:00"
      actions:
        - service: light.turn_on
          entity_id: light.office_bff_light
          service_data:
            brightness: 200
    repeat_type: repeat
    name: My schedule

5. Observe the logs - errors have started appearing
6. Navigate to the scheduler card - notice that it doesn't appear, and logs have started appearing in the browser console

To recover from this you can either:
A. Restart HA 
B. Reload the integration and refresh the browser tab that had the scheduler card open

### Additional info

_No response_
github-actions[bot] commented 7 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days