1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-20 08:46:01 +00:00

Add domain paramteter to wifi. (#16)

* Add domain paramteter to wifi.

- To be able to do OTA updates on networks that doesn't use .local as
  local domain parameter domain is added to wifi section. It's currently
  only used for OTA.

* Centralised default parameter for domain.

* Added input validation for domainname.
This commit is contained in:
Jimmy Hedman
2018-05-21 15:47:30 +02:00
committed by Otto Winter
parent e8fe653140
commit ebb6d0d464
4 changed files with 21 additions and 7 deletions

View File

@@ -347,6 +347,18 @@ def hostname(value):
return value
def domainname(value):
value = string(value)
if not value.startswith('.'):
raise vol.Invalid("Domainname must start with .")
if value.startswith('..'):
raise vol.Invalid("Domainname must start with single .")
for c in value:
if not (c.isalnum() or c in '._-'):
raise vol.Invalid("Domainname can only have alphanumeric characters and _ or -")
return value
def ssid(value):
if value is None:
raise vol.Invalid("SSID can not be None")