mirror of
https://github.com/esphome/esphome.git
synced 2025-10-04 19:03:47 +01:00
add-black (#1593)
* Add black Update pre commit Update pre commit add empty line * Format with black
This commit is contained in:
committed by
GitHub
parent
2b60b0f1fa
commit
69879920eb
@@ -5,31 +5,45 @@ from esphome.components import i2c, time
|
||||
from esphome.const import CONF_ID
|
||||
|
||||
|
||||
CODEOWNERS = ['@badbadc0ffee']
|
||||
DEPENDENCIES = ['i2c']
|
||||
ds1307_ns = cg.esphome_ns.namespace('ds1307')
|
||||
DS1307Component = ds1307_ns.class_('DS1307Component', time.RealTimeClock, i2c.I2CDevice)
|
||||
WriteAction = ds1307_ns.class_('WriteAction', automation.Action)
|
||||
ReadAction = ds1307_ns.class_('ReadAction', automation.Action)
|
||||
CODEOWNERS = ["@badbadc0ffee"]
|
||||
DEPENDENCIES = ["i2c"]
|
||||
ds1307_ns = cg.esphome_ns.namespace("ds1307")
|
||||
DS1307Component = ds1307_ns.class_("DS1307Component", time.RealTimeClock, i2c.I2CDevice)
|
||||
WriteAction = ds1307_ns.class_("WriteAction", automation.Action)
|
||||
ReadAction = ds1307_ns.class_("ReadAction", automation.Action)
|
||||
|
||||
|
||||
CONFIG_SCHEMA = time.TIME_SCHEMA.extend({
|
||||
cv.GenerateID(): cv.declare_id(DS1307Component),
|
||||
}).extend(i2c.i2c_device_schema(0x68))
|
||||
CONFIG_SCHEMA = time.TIME_SCHEMA.extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(DS1307Component),
|
||||
}
|
||||
).extend(i2c.i2c_device_schema(0x68))
|
||||
|
||||
|
||||
@automation.register_action('ds1307.write_time', WriteAction, cv.Schema({
|
||||
cv.GenerateID(): cv.use_id(DS1307Component),
|
||||
}))
|
||||
@automation.register_action(
|
||||
"ds1307.write_time",
|
||||
WriteAction,
|
||||
cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.use_id(DS1307Component),
|
||||
}
|
||||
),
|
||||
)
|
||||
def ds1307_write_time_to_code(config, action_id, template_arg, args):
|
||||
var = cg.new_Pvariable(action_id, template_arg)
|
||||
yield cg.register_parented(var, config[CONF_ID])
|
||||
yield var
|
||||
|
||||
|
||||
@automation.register_action('ds1307.read_time', ReadAction, automation.maybe_simple_id({
|
||||
cv.GenerateID(): cv.use_id(DS1307Component),
|
||||
}))
|
||||
@automation.register_action(
|
||||
"ds1307.read_time",
|
||||
ReadAction,
|
||||
automation.maybe_simple_id(
|
||||
{
|
||||
cv.GenerateID(): cv.use_id(DS1307Component),
|
||||
}
|
||||
),
|
||||
)
|
||||
def ds1307_read_time_to_code(config, action_id, template_arg, args):
|
||||
var = cg.new_Pvariable(action_id, template_arg)
|
||||
yield cg.register_parented(var, config[CONF_ID])
|
||||
|
Reference in New Issue
Block a user