ITSpecialist111 / ai_automation_suggester

This custom Home Assistant integration periodically scans entities, detects new devices, and uses AI (via OpenAI's API) to suggest automations. It provides a user-friendly interface for accepting or rejecting automations, with placeholder entity mapping for privacy. This aims to enhance smart home automation via AI to identify new automations.
MIT License
4 stars 0 forks source link

TypeError: '<' not supported between instances of 'datetime.timedelta' and 'NoneType' #6

Closed tjorim closed 2 hours ago

tjorim commented 4 hours ago

Removed integration and custom repo folder, restarted, re-installed, re-configured V1.05; still getting this error:

This error originated from a custom integration.

Logger: custom_components.ai_automation_suggester.coordinator
Source: helpers/update_coordinator.py:354
integration: AI Automation Suggester (documentation, issues)
First occurred: 12:35:13 (1 occurrences)
Last logged: 12:35:13

Unexpected error fetching ai_automation_suggester data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ai_automation_suggester/coordinator.py", line 40, in _async_update_data
    if self.last_update and current_time - self.last_update < self.update_interval:
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'datetime.timedelta' and 'NoneType'
ITSpecialist111 commented 2 hours ago

Thanks for the update. I didn't see that issue in my environment. I've adjusted the code to see if we can elevate this issue. Updated V1.06 to potentially fix this for you. Thank you for your feedback