Nextcloud unavailable

Hello

I have nextcloud sucessfully integrated. But suddenly I get no data from nextcloud. The sensor values are all unavailable.

In the errorlog after a restart I see the following message.


Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 187, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 330, in _async_add_entity
    if entity.unique_id is not None:
  File "/usr/src/homeassistant/homeassistant/components/nextcloud/sensor.py", line 48, in unique_id
    return f"{self.hass.data[DOMAIN]['instance']}#{self._name}"
KeyError: 'instance'

Nextcloud is running. I can log into nextcloud with the user below. The syncronisation is working. I have checked the user and password. Everything is working and nobody changed something.

The integration in the configuration.yml file is as simple as the documentation:

nextcloud:
  url: https://xxx.duckdns.org
  username: user
  password: pass

Has somebody an idea?

Had the same problem.
To solve the problem I simply create a new app password.
your nextcloud url/index.php/settings/user/security

Thanks for the answer.

  1. I tried to change the password - did not work.
  2. I tried to delete the account and created new accounts. Then I dont know why but suddenly with one account it worked. Then I changed as test the password in nextcloud and in HA - and never get it worked again.
  3. I checked the blocked user list in nextcloud and deleted it.

It is very strange. I see nothing in the logfiles. If I change the password to a wrong one, I see in the nextcloud log an error.

I have given up for now.

I think something with the nextcloud integration is bad.

I have same issues. Tried with APP Password, didn’t work. Tried it with my own normal password (user is in ADMIN group) didn’t work.

Tried many things. http://, https:, http://:80, https://:4443 didn’t work also.

https:///ocs/v2.php/apps/serverinfo/api/v1/info?format=json

is working on my iMac when I do a wget on HA:

wget https:///ocs/v2.php/apps/serverinfo/api/v1/info?format=json

I get this error:

--2020-11-15 10:25:44--  https://<IP>/ocs/v2.php/apps/serverinfo/api/v1/info?format=json
Connecting to <IP>:443... connected.
ERROR: The certificate of â<IP>â is not trusted.
ERROR: The certificate of â<IP>â doesn't have a known issuer.
The certificate's owner does not match hostname â<IP>â

I use a self signed cert. Because port 80/443 is going to my HA for Letscrypt Cert.
Nextcloud is running on different RPi… So can’t use lets crypt on that one…

An update: Suddenly everthing is working perfect. I have not changed a password. I did nothing on nextcloud. I think some updates in the last HA releases fixed the problem. Thanks to that people!

@poudenes : you ever got it back working? I have a self-signed certificate as well…

I have entered the normal url with https. The same Url like you reach it in the browser. In my case without port.
I have created a new homeassistant_admin-user. The user must first created in nextcloud, otherwise it gets banned. In that case create a new user… After 5 new users it worked for me.