mirror of
https://github.com/esphome/esphome.git
synced 2024-12-02 11:44:13 +01:00
32 lines
905 B
Python
32 lines
905 B
Python
import esphome.codegen as cg
|
|
import esphome.config_validation as cv
|
|
from esphome.const import CONF_ID
|
|
from esphome.components import uart
|
|
|
|
DEPENDENCIES = ["uart"]
|
|
CODEOWNERS = ["@andreashergert1984"]
|
|
AUTO_LOAD = ["binary_sensor", "text_sensor", "sensor", "switch", "output"]
|
|
MULTI_CONF = True
|
|
|
|
CONF_PIPSOLAR_ID = "pipsolar_id"
|
|
|
|
pipsolar_ns = cg.esphome_ns.namespace("pipsolar")
|
|
PipsolarComponent = pipsolar_ns.class_("Pipsolar", cg.Component)
|
|
|
|
PIPSOLAR_COMPONENT_SCHEMA = cv.Schema(
|
|
{
|
|
cv.Required(CONF_PIPSOLAR_ID): cv.use_id(PipsolarComponent),
|
|
}
|
|
)
|
|
|
|
CONFIG_SCHEMA = cv.All(
|
|
cv.Schema({cv.GenerateID(): cv.declare_id(PipsolarComponent)})
|
|
.extend(cv.polling_component_schema("1s"))
|
|
.extend(uart.UART_DEVICE_SCHEMA)
|
|
)
|
|
|
|
|
|
def to_code(config):
|
|
var = cg.new_Pvariable(config[CONF_ID])
|
|
yield cg.register_component(var, config)
|
|
yield uart.register_uart_device(var, config)
|