Caldav configuration

The 500 error makes me think the URL isn’t right, but that you can connect to the server (IP and PORT are ok)
I don’t know the specifics for the server you’re using, but with the Davical server, the full URL is http://myserver:port/caldav.php/user/calendar_name
And the url in the configuration is just the server’s : http://myserver:port/caldav.php/

So if I can guess with your server, url could be http://ip:port/cal.php/calendars or just http://ip:port/cal.php/ (I think the former makes sense).
Then your username in the configuration should be “brad”
And then “personal” is the calendar name that’s you’ll use either in the “calendars” list, or as the source calendar (field “calendar:” not “name:” that is the friendly name) of a custom_calendar with a search string.

Baikal runs on port 80 so shouldn’t need a port, it is connecting to the server correctly so that’s not it.

I think you may be right though, looks like the URL is https://server.com/cal.php/ or at least it’s attempting my calendars if I use that.

If I try it with a calendars list (like so)

calendar:
  - platform: caldav
    url: !secret caldav_url
    username: !secret caldav_user
    password: !secret caldav_pass
    calendars:
      - Personal
      - Work

I’m getting the same error. If I take the calendar list off, same thing.

Here is what my logs look like on the server side, first is my calendar app BusyCal doing a successful update, and then Home Assistant (Mozilla):

MYIP - brad [25/Feb/2018:10:43:33 -0800] "PROPFIND /cal.php/calendars/brad/ HTTP/1.1" 207 26624 "-" "BusyCal-3.2.8"
MYIP - brad [25/Feb/2018:10:43:53 -0800] "REPORT /cal.php/principals/brad/ HTTP/1.1" 207 1087 "-" "BusyCal-3.2.8"
MYIP - brad [25/Feb/2018:10:44:14 -0800] "PROPFIND /cal.php/calendars/brad/inbox/ HTTP/1.1" 207 1219 "-" "BusyCal-3.2.8"
MYIP - - [25/Feb/2018:10:53:58 -0800] "PROPFIND /cal.php/ HTTP/1.1" 401 4326 "-" "Mozilla/5.0"
MYIP - brad [25/Feb/2018:10:53:58 -0800] "PROPFIND /cal.php/ HTTP/1.1" 207 4646 "-" "Mozilla/5.0"
MYIP - brad [25/Feb/2018:10:53:59 -0800] "PROPFIND /cal.php/principals/brad/ HTTP/1.1" 207 4655 "-" "Mozilla/5.0"
MYIP - brad [25/Feb/2018:10:54:00 -0800] "PROPFIND /cal.php/calendars/brad/ HTTP/1.1" 207 7660 "-" "Mozilla/5.0"
MYIP - brad [25/Feb/2018:10:54:00 -0800] "REPORT /cal.php/calendars/brad/personal/ HTTP/1.1" 500 4199 "-" "Mozilla/5.0"

If I type that full URL in my browser https://myserver.com/cal.php/calendars/brad/personal/ I get prompted for my user/pass, and then it loads as expected.

It is failing to load that URL for my ‘personal’ calendar whether I list it or not (and it never tries ‘work’ if I list that).

I have had a hard time figuring out the parameters for my server. I hope because there still were some bugs in it, but as of 0.64 (or with latest caldav.py as a custom component), it should be ok.

You say https ?

A “calendars” list should be optional, it should get the full list of collection from the “well known path”.

You can try the python code, I’ve made an example session when I logged the DTEND bug, you’ll see the connection options and how it translates on your server : https://github.com/home-assistant/home-assistant/issues/12080
What happens when you open the DAV client with the root path, like here :
cal = caldav.DAVClient('http://server:port/cal.php/', None, 'Me','mypass') cals = cal.principal().calendars()

cals should contain a list of the calendars it has found ?

Hey guys, might anyone know how to add an option to the config block to disable ssl verify?
I’ve tried multiple combinations but none of them work.

I have locally configured nextcloud that i want to reach at https://192.168.x.x but it uses a real lets encrypt cert for my real domain.

Logs output that the cert domain name doesnt match my local url.

Thanks

That option does not exist for the caldav calendar.
The underlying caldav library does support a flag to not verify the certificate, but this is not exposed in HA.

Darn, any other workaround known by anyone?
Thanks for your reply!

I have the same setup, I guess.
Maybe this is useful for you.

I use a self-signed certificate for my nextcloud instance and was not able to login due to a failing ssl verification.
So, I just changed the following line in caldav.py from

client = caldav.DAVClient(url, None, username, password)

to

client = caldav.DAVClient(url, None, username, password, None, False)

With that change I get a warning for not using ssl verification in the logs.
If I don’t declare any calendars in my configuration (just url, username and password), I have all calendars visible in the UI and I can use the attributes for any kind of automations.

I don’t know why and if this is related to my change, but if I declare calendars or custom_calendars, I don’t see any calendars anymore. This is not great, because this way I only see calendar events which are not created as a full day event.

Unfortunately, I don’t have an error in the logs. I only see that there might be only one request for each declared calendars at the beginning and then no further requests anymore.
When no calendars are declared, I see the warning for unverified HTTPS requests in the configured interval and the entries are updated accordingly.

Does anybody have an idea how to solve the issue with the declared calendars in the configuration?

Seems to be fixed!

Can i use public shared calendars from nextcloud, somehow the configuration doesn’t load at all.

thats my configuration:

- platform: caldav
  url: https://cloud.xxx.xx/remote.php/dav/public-calendars/xxxxxx?export                                                                                                                                         
  custom_calendars:
    - name: 'Trash'
      calendar: 'paper-trash'
      search: 'Papierabfuhr'

Try to protect the URL string :
url: 'https://cloud.xxx.xx/remote.php/dav/public-calendars/xxxxxx?export'

The https might be a problem depending on the certificate.

And be careful that the “search” field is a regexp, so the way you enter it, it has to match exactly (not even a space before or after). Any string with “Papierabfuhr” inside is : '.*Papierabfuhr.*'

1 Like

What do you mean with seems to be fixed? I still cannot get my let’s encrypt certificate validated.

Come to think of it, inthink insolved it by setting a domain override in my router.

You can set your public hostname tonredirect to your local ip in /etc/hosts, then it will work, i guess

Hi *,

I try to connect my Nextcloud server to my Hass.io, i.e. I want to use the Caldav integration. But I cannot get it to work.
Here is my config:

calendar:
  - platform: caldav
    username: christoph
    password: xxxxxxxxxxx
    url: https://10.5.0.43/remote.php/dav/calendars/christoph/
    calendars:
       - 'HomeAutomation'

I see the following errors/warnings in the HA log:

Protokolldetails ( WARNING )
Logger: homeassistant.components.calendar
Integration: Kalender (documentation, issues)
First occured: 6:25:14 (1 occurences)
Last logged: 6:25:14

Setup of calendar platform caldav is taking over 10 seconds.

and

Protokolldetails ( ERROR )
Logger: homeassistant.components.calendar
Integration: Kalender (documentation, issues)
First occured: 15:24:01 (1 occurences)
Last logged: 15:24:01

Error while setting up caldav platform for calendar
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 300, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x71d6d2f0>: Failed to establish a new connection: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='10.5.0.43', port=443): Max retries exceeded with url: /remote.php/dav/calendars/christoph/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x71d6d2f0>: Failed to establish a new connection: [Errno 110] Operation timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  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/caldav/calendar.py", line 74, in setup_platform
    calendars = client.principal().calendars()
  File "/usr/local/lib/python3.7/site-packages/caldav/davclient.py", line 118, in principal
    return Principal(self)
  File "/usr/local/lib/python3.7/site-packages/caldav/objects.py", line 370, in __init__
    cup = self.get_properties([dav.CurrentUserPrincipal()])
  File "/usr/local/lib/python3.7/site-packages/caldav/objects.py", line 219, in get_properties
    response = self._query_properties(props, depth)
  File "/usr/local/lib/python3.7/site-packages/caldav/objects.py", line 129, in _query_properties
    return self._query(root, depth)
  File "/usr/local/lib/python3.7/site-packages/caldav/objects.py", line 161, in _query
    url, body, depth)
  File "/usr/local/lib/python3.7/site-packages/caldav/davclient.py", line 133, in propfind
    {'Depth': str(depth)})
  File "/usr/local/lib/python3.7/site-packages/caldav/davclient.py", line 237, in request
    auth=auth, verify=self.ssl_verify_cert)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='10.5.0.43', port=443): Max retries exceeded with url: /remote.php/dav/calendars/christoph/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x71d6d2f0>: Failed to establish a new connection: [Errno 110] Operation timed out'))

I tried to use a custom caldav component, which has SSL deactivated in the constructor. Without any luck. I cannot use letsencrypt, because I have no domain and do not want it to be accessible on the internet.

Is there any solution to this problem?

Best,
Ck

1 Like

calendar app on Nextcloud give link to put on config as :

url: https://xxx.xxx.xxx/remote.php/dav

https://10.5.0.43/remote.php/dav/calendars/christoph/

is the iOs version

hi
mine is set up like this:

- platform: caldav
  url: https://ip_server/nextcloud/remote.php/caldav/calendars/jerome/defaultcalendar
  username: !secret caldav_user
  password: !secret caldav_pass
  custom_calendars:
      - name: 'hass_cal'
        calendar: 'hass'
        search: ''
      - name : 'jerome'
        calendar: 'jblb_cal'
        search: ''

1 Like

hi,

I tried both variants, neither does work for me. Same error.
I can reach the calender in a browser via
https://10.5.0.43/remote.php/dav/calendars/christoph/.

Any other suggestions?

i think thah if reach webpage, is not the WebDAV url

on my nextcloud if i try
https://xxxxxxxxxx/remote.php/dav
i have
This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.

hi,

that’s exactly what I get when I use the address I posted above.
I use the same address in Davx5 to sync my calenders with my phone (android).

You can set:

verify_ssl boolean(optional, default: true)
Verify the SSL certificate or not. If using self-signed certificates, this usually needs to be set to “False”.

Sorry, I realize this is an old thread

Hi,

Old thread, but I’m not seeing many on the Caldav subject.
I’ve been stuck in 0.103 for a while (because of the python support on my LTS ubuntu), the I upgraded up-to-date and I’ve seen several troubles, latest appeared with 117.2 :

  • the recurring all-day events, that do not have a timezone, are not seen on the correct day. I’ve seen the bug was declared before, and I documented here : https://github.com/home-assistant/core/issues/25814
    Are you seeing this too ?
  • the exceptions in recurring events are not handled. For instance, if I remove one occurrence, it’s still detected.
  • I get errors with 117.2 when the time zone is “Romance Standard Time”. Doesn’t seem to impact the event display though. I’ve seen that a long while ago, it’s been resolved since but I don’t remember how.