sriramsv / custom_component_splitwise

Custom component for HomeAssistant for Splitwise API
MIT License
11 stars 4 forks source link

No attribute 'base_url' error when first setting up sensor #6

Closed TomCasavant closed 8 months ago

TomCasavant commented 2 years ago

This is the output right after setting up the sensor in the config file, it prevents the sensor from starting up so I don't get the notification to authorize with splitwise


2022-04-27 14:56:03 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up splitwise platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/splitwise/sensor.py", line 76, in setup_platform
    add_entities([SplitwiseSensor(hass, client_id, client_secret)])
  File "/config/custom_components/splitwise/sensor.py", line 147, in __init__
    self.hass_url = get_url(hass)
  File "/config/custom_components/splitwise/sensor.py", line 57, in get_url
    base_url = hass.config.api.base_url
AttributeError: 'ApiConfig' object has no attribute 'base_url'```
sriramsv commented 2 years ago

I believe you need to set the external_url in homeassistant for the Oauth stuff to work: https://www.home-assistant.io/docs/configuration/basic/#external_url