REvert back to Uart CSV Example

This commit is contained in:
Václav Španinger 2024-12-27 10:55:11 +01:00
parent fafc3d54f6
commit ff29c1ac60

View File

@ -1,21 +1,21 @@
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome import pins from esphome import automation
from esphome.components import uart
from esphome.components import sensor from esphome.components import sensor
from esphome.const import ( from esphome.const import CONF_ID, CONF_INDEX, CONF_SENSORS
CONF_ID,
CONF_MODEL, CODEOWNERS = ["@ssieb"]
CONF_PIN,
CONF_TEMPERATURE, DEPENDENCIES = ['uart']
STATE_CLASS_MEASUREMENT,
UNIT_CELSIUS, serial_ns = cg.esphome_ns.namespace('serial')
UNIT_PERCENT,
DEVICE_CLASS_TEMPERATURE, SerialCSV = serial_ns.class_('SerialCSV', cg.Component, sensor.Sensor, uart.UARTDevice)
)
CONFIG_SCHEMA = cv.Schema( CONFIG_SCHEMA = cv.Schema(
{ {
cv.Optional('bed_current'): sensor.sensor_schema( cv.Optional(CONF_BED_TEMPERATURE): sensor.sensor_schema(
unit_of_measurement=UNIT_CELSIUS, unit_of_measurement=UNIT_CELSIUS,
accuracy_decimals=1, accuracy_decimals=1,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=DEVICE_CLASS_TEMPERATURE,
@ -24,6 +24,7 @@ CONFIG_SCHEMA = cv.Schema(
} }
).extend(cv.polling_component_schema("60s")) ).extend(cv.polling_component_schema("60s"))
async def to_code(config): async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config) await cg.register_component(var, config)