mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-26 15:48:28 +02:00
Add support for SDMXXX energy meters (#1260)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.cpp_helpers import gpio_pin_expression
|
||||
from esphome.components import uart
|
||||
from esphome.const import CONF_ID, CONF_ADDRESS
|
||||
from esphome.const import CONF_FLOW_CONTROL_PIN, CONF_ID, CONF_ADDRESS
|
||||
from esphome import pins
|
||||
|
||||
DEPENDENCIES = ["uart"]
|
||||
|
||||
@@ -15,6 +17,7 @@ CONFIG_SCHEMA = (
|
||||
cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(Modbus),
|
||||
cv.Optional(CONF_FLOW_CONTROL_PIN): pins.gpio_output_pin_schema,
|
||||
}
|
||||
)
|
||||
.extend(cv.COMPONENT_SCHEMA)
|
||||
@@ -29,6 +32,10 @@ async def to_code(config):
|
||||
|
||||
await uart.register_uart_device(var, config)
|
||||
|
||||
if CONF_FLOW_CONTROL_PIN in config:
|
||||
pin = await gpio_pin_expression(config[CONF_FLOW_CONTROL_PIN])
|
||||
cg.add(var.set_flow_control_pin(pin))
|
||||
|
||||
|
||||
def modbus_device_schema(default_address):
|
||||
schema = {
|
||||
|
||||
Reference in New Issue
Block a user