mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-20 13:03:28 +02:00
8e75980ebd
* Cleanup dashboard JS * Add vscode * Save start_mark/end_mark * Updates * Updates * Remove need for cv.nameable It's a bit hacky but removes so much bloat from integrations * Add enum helper * Document APIs, and Improvements * Fixes * Fixes * Update PULL_REQUEST_TEMPLATE.md * Updates * Updates * Updates
21 lines
619 B
Python
21 lines
619 B
Python
from esphome.components import time as time_
|
|
import esphome.config_validation as cv
|
|
import esphome.codegen as cg
|
|
from esphome.const import CONF_ID
|
|
from .. import homeassistant_ns
|
|
|
|
DEPENDENCIES = ['api']
|
|
|
|
HomeassistantTime = homeassistant_ns.class_('HomeassistantTime', time_.RealTimeClock)
|
|
|
|
CONFIG_SCHEMA = time_.TIME_SCHEMA.extend({
|
|
cv.GenerateID(): cv.declare_id(HomeassistantTime),
|
|
}).extend(cv.COMPONENT_SCHEMA)
|
|
|
|
|
|
def to_code(config):
|
|
var = cg.new_Pvariable(config[CONF_ID])
|
|
yield time_.register_time(var, config)
|
|
yield cg.register_component(var, config)
|
|
cg.add_define('USE_HOMEASSISTANT_TIME')
|