core: Nextcloud error: "local variable 'ncm' referenced before assignment"

The problem

After adding nextcloud integration to my configuration.yaml file, I keep on getting a “Please check your config.” error notification.

Environment

  • Home Assistant Core release with the issue: HA 0.108.5. Same behaviour on previous versions (0.108.1 to 0.108.5)
  • Operating environment (Home Assistant/Supervised/Docker/venv): Hassio installed on a Raspberry. Nextcloud is hosted on another Raspberry on the same network, running LibreElec with Docker, Nextcloud being a Docker container.
  • Integration causing this issue: Nextcloud
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/nextcloud

Problem-relevant configuration.yaml

nextcloud: url: https://192.168.1.250 username: !secret nextcloud_username password: !secret nextcloud_password

Nextcloud is running well on the above IP. I have generated the paswword in Nextcloud Web UI as instructed.

Traceback/Error logs

HA log:

2020-04-16 10:07:43 ERROR (SyncWorker_7) [homeassistant.components.nextcloud] Nextcloud setup failed - Check configuration
2020-04-16 10:07:43 ERROR (MainThread) [homeassistant.setup] Error during setup of component nextcloud
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 175, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/nextcloud/__init__.py", line 102, in setup
    hass.data[DOMAIN] = get_data_points(ncm.data)
UnboundLocalError: local variable 'ncm' referenced before assignment

Additional information

I tried to get help on HA forum, with no luck: https://community.home-assistant.io/t/nextcloud-integration/185516/5

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Hi, After a few days trying to understand how to use Letsencrypt on my server, I did it and I have now access to Nextcloud from Home Assistant! Thank you

@Alomon31 Yes, LetsEncrypt would be the best solution. As the developer mentioned, using a reverse proxy is the best idea. If you have access to the home-assistant addons, you could use the NginxProxyManager to handle all the Let’s Encrypt certificates.

scan_interval didn’t help. The error message shows up as soon as HA server starts up. I close the issue as requested.