mirror of
https://github.com/esphome/esphome.git
synced 2025-09-22 13:12:22 +01:00
Clean up time API (#221)
This commit is contained in:
@@ -3,7 +3,7 @@ import voluptuous as vol
|
||||
import esphomeyaml.config_validation as cv
|
||||
from esphomeyaml.components import time as time_
|
||||
from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_SERVERS
|
||||
from esphomeyaml.helpers import App, Pvariable
|
||||
from esphomeyaml.helpers import App, Pvariable, add
|
||||
|
||||
SNTPComponent = time_.time_ns.SNTPComponent
|
||||
|
||||
@@ -15,8 +15,10 @@ PLATFORM_SCHEMA = time_.TIME_PLATFORM_SCHEMA.extend({
|
||||
|
||||
|
||||
def to_code(config):
|
||||
rhs = App.make_sntp_component(*config.get(CONF_SERVERS, []))
|
||||
rhs = App.make_sntp_component()
|
||||
sntp = Pvariable(config[CONF_ID], rhs)
|
||||
if CONF_SERVERS in config:
|
||||
add(sntp.set_servers(*config[CONF_SERVERS]))
|
||||
|
||||
time_.setup_time(sntp, config)
|
||||
|
||||
|
Reference in New Issue
Block a user