mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Allow IPv4 addresses for SNTP servers (#340)
Fixes https://github.com/OttoWinter/esphomelib/issues/395
This commit is contained in:
parent
a683108b5d
commit
5ac9b8d545
2 changed files with 6 additions and 3 deletions
|
@ -458,9 +458,12 @@ def hostname(value):
|
||||||
|
|
||||||
def domain(value):
|
def domain(value):
|
||||||
value = string(value)
|
value = string(value)
|
||||||
if re.match(vol.DOMAIN_REGEX, value) is None:
|
if re.match(vol.DOMAIN_REGEX, value) is not None:
|
||||||
raise vol.Invalid("Invalid domain: {}".format(value))
|
|
||||||
return value
|
return value
|
||||||
|
try:
|
||||||
|
return str(ipv4(value))
|
||||||
|
except vol.Invalid:
|
||||||
|
raise vol.Invalid("Invalid domain: {}".format(value))
|
||||||
|
|
||||||
|
|
||||||
def domain_name(value):
|
def domain_name(value):
|
||||||
|
|
|
@ -1022,7 +1022,7 @@ time:
|
||||||
servers:
|
servers:
|
||||||
- 0.pool.ntp.org
|
- 0.pool.ntp.org
|
||||||
- 1.pool.ntp.org
|
- 1.pool.ntp.org
|
||||||
- 2.pool.ntp.org
|
- 192.168.178.1
|
||||||
on_time:
|
on_time:
|
||||||
cron: '/30 0-30,30/5 * ? JAN-DEC MON,SAT-SUN,TUE-FRI'
|
cron: '/30 0-30,30/5 * ? JAN-DEC MON,SAT-SUN,TUE-FRI'
|
||||||
then:
|
then:
|
||||||
|
|
Loading…
Reference in a new issue