mirror of
https://github.com/esphome/esphome.git
synced 2024-12-12 08:24:55 +01:00
69879920eb
* Add black Update pre commit Update pre commit add empty line * Format with black
26 lines
723 B
Python
26 lines
723 B
Python
import esphome.config_validation as cv
|
|
import esphome.codegen as cg
|
|
from esphome.components import output, i2c
|
|
from esphome.const import CONF_ID
|
|
|
|
DEPENDENCIES = ["i2c"]
|
|
|
|
mcp4725 = cg.esphome_ns.namespace("mcp4725")
|
|
MCP4725 = mcp4725.class_("MCP4725", output.FloatOutput, cg.Component, i2c.I2CDevice)
|
|
|
|
CONFIG_SCHEMA = (
|
|
output.FLOAT_OUTPUT_SCHEMA.extend(
|
|
{
|
|
cv.Required(CONF_ID): cv.declare_id(MCP4725),
|
|
}
|
|
)
|
|
.extend(cv.COMPONENT_SCHEMA)
|
|
.extend(i2c.i2c_device_schema(0x60))
|
|
)
|
|
|
|
|
|
def to_code(config):
|
|
var = cg.new_Pvariable(config[CONF_ID])
|
|
yield cg.register_component(var, config)
|
|
yield i2c.register_i2c_device(var, config)
|
|
yield output.register_output(var, config)
|