custom-components / pyscript

Pyscript adds rich Python scripting to HASS
Apache License 2.0
859 stars 46 forks source link

calendar no attribute 'get_events' #618

Open phsdv opened 2 months ago

phsdv commented 2 months ago

As of HA core-2024.7 i get the following errors:

Exception in <file.verwarming.verwarming_woonkamer_calendar_based> line 39: events = calendar.woonkamer_thermostaat.get_events(return_response=True, blocking=True, duration='00:01') ^ AttributeError: 'StateVal' object has no attribute 'get_events'

code used on line 39:

events = calendar.woonkamer_thermostaat.get_events(return_response=True, blocking=True, duration='00:01')

There is a breaking change in 2024.7 however that is to replace list_events with get_events. The coding was working before 2024.7

Running the get_events in the developer tools does work and can return data and does not give an error.

service: calendar.get_events
entity_id: calendar.woonkamer_thermostaat
data: {duration: '00:01'}

as I cannot reproduce this in the developer tool, I suspect that it must be in pyscript.

phsdv commented 1 month ago

update to core-2024.7.3 and now get_events works again. Apperently some change between 2024.7.0 and 2024.7.3 did fix this.

phsdv commented 1 month ago

Update to 2024.8.1 and have this issue again:

Logger: custom_components.pyscript.file.verwarming.verwarming_woonkamer_calendar_based
Source: custom_components/pyscript/trigger.py:1382
integration: Pyscript Python scripting ([documentation](https://github.com/custom-components/pyscript), [issues](https://github.com/custom-components/pyscript/issues))
First occurred: August 13, 2024 at 14:23:13 (2754 occurrences)
Last logged: 12:16:13
Exception in <file.verwarming.verwarming_woonkamer_calendar_based> line 39: events = calendar.woonkamer_thermostaat.get_events(return_response=True, blocking=True, duration='00:01') ^ AttributeError: 'StateVal' object has no attribute 'get_events'
phsdv commented 4 weeks ago

Narrowed it down a bit. It appears that calendar..get_events() is not working anymore:

events = calendar.woonkamer_thermostaat.get_events(duration='00:01')

While calendar.get_events(entity_id='', duration='00:01') is working

events = calendar.get_events(entity_id='calendar.woonkamer_thermostaat', duration='00:01')