mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Added option to use self-signed certificates (#23139)
* Added option to use self-signed certificates I defined a new option for configuration.yaml, 'verify_ssl', which is set to 'True' by default for obvious security reasons. However, in order to work with self-signed certificates, it is now possible to disable the certificate validation.(eg, I use a nextcloud instance with self-signed certificates) Credit for code in line 57 goes to user 'gen2' on the homeassistant community, who suggested this solution. https://community.home-assistant.io/t/caldav-configuration/38198/25 I only took it a step further and made it a config option. * Update calendar.py * Added the import of CONF_VERIFY_SSL I hope this passes the test now... * Update homeassistant/components/caldav/calendar.py Cool! Didn't know about that possibility, my coding experience is literally two weeks. Thanks for sharing! Co-Authored-By: anrudolph <49680492+anrudolph@users.noreply.github.com> * Removed some lines of code I think, in order for the last commit to work, these lines have to be removed. Correct? * Trying to get this passing the checks Trying around to get the simplified code to work
This commit is contained in:
parent
1dbfa8f3be
commit
6be798bffc
@ -8,7 +8,7 @@ import voluptuous as vol
|
|||||||
from homeassistant.components.calendar import (
|
from homeassistant.components.calendar import (
|
||||||
PLATFORM_SCHEMA, CalendarEventDevice, get_date)
|
PLATFORM_SCHEMA, CalendarEventDevice, get_date)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME, CONF_PASSWORD, CONF_URL, CONF_USERNAME)
|
CONF_NAME, CONF_PASSWORD, CONF_URL, CONF_USERNAME, CONF_VERIFY_SSL)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.util import Throttle, dt
|
from homeassistant.util import Throttle, dt
|
||||||
|
|
||||||
@ -36,7 +36,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
vol.Required(CONF_NAME): cv.string,
|
vol.Required(CONF_NAME): cv.string,
|
||||||
vol.Required(CONF_SEARCH): cv.string,
|
vol.Required(CONF_SEARCH): cv.string,
|
||||||
})
|
})
|
||||||
]))
|
])),
|
||||||
|
vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean
|
||||||
})
|
})
|
||||||
|
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=15)
|
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=15)
|
||||||
@ -50,7 +51,8 @@ def setup_platform(hass, config, add_entities, disc_info=None):
|
|||||||
username = config.get(CONF_USERNAME)
|
username = config.get(CONF_USERNAME)
|
||||||
password = config.get(CONF_PASSWORD)
|
password = config.get(CONF_PASSWORD)
|
||||||
|
|
||||||
client = caldav.DAVClient(url, None, username, password)
|
client = caldav.DAVClient(url, None, username, password,
|
||||||
|
ssl_verify_cert=config.get(CONF_VERIFY_SSL))
|
||||||
|
|
||||||
calendars = client.principal().calendars()
|
calendars = client.principal().calendars()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user