myTselection / MijnTuin

MijnTuin.org will STOP all activities in May 2024 and this integration will stop to function. MijnTuin.org Home Assistant custom component HACS to manage garden plants and see activities for your garden
MIT License
10 stars 1 forks source link

mijntuin AttributeError #10

Closed GitHubxtsnl closed 1 year ago

GitHubxtsnl commented 1 year ago

Any ideas why this is happening to my MijnTuin Integrations?

Home Assistant 2023.10.1 Supervisor 2023.10.0 Operating System 10.5 Frontend 20231005.0 - latest MijnTuin 1.6.1

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:359
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 14:33:19 (1 occurrences)
Last logged: 14:33:19

Error while setting up mijntuin platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/mijntuin/sensor.py", line 79, in async_setup_entry
    await dry_setup(hass, config, async_add_devices)
  File "/config/custom_components/mijntuin/sensor.py", line 43, in dry_setup
    await componentData._force_update()
  File "/config/custom_components/mijntuin/sensor.py", line 113, in _force_update
    gardenLink = await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mijntuin/sensor.py", line 113, in <lambda>
    gardenLink = await self._hass.async_add_executor_job(lambda: self._session.login(self._username, self._password))
                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mijntuin/utils.py", line 76, in login
    self.gardenlink = self.gardenlink.replace('/calendar','')
                      ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'
myTselection commented 1 year ago

Hi, this must be related to a login failure. Please check your username & password. No calendar could be found within your account. I've added an extra check in R1.6.2 to throw an exeption if the credentials would be incorrect.