added config option for internal pull-up to python code

This commit is contained in:
minomy13 2024-11-13 16:06:57 +01:00
parent d213ec8549
commit a223034e57
No known key found for this signature in database
2 changed files with 5 additions and 0 deletions

View file

@ -5,6 +5,7 @@ from esphome.components import sensor
from esphome.const import (
CONF_HUMIDITY,
CONF_ID,
CONF_INTERNAL_PULLUP,
CONF_MODEL,
CONF_PIN,
CONF_TEMPERATURE,
@ -50,6 +51,7 @@ CONFIG_SCHEMA = cv.Schema(
cv.Optional(CONF_MODEL, default="auto detect"): cv.enum(
DHT_MODELS, upper=True, space="_"
),
cv.Optional(CONF_INTERNAL_PULLUP, default=True): cv.boolean,
}
).extend(cv.polling_component_schema("60s"))
@ -68,4 +70,6 @@ async def to_code(config):
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
cg.add(var.set_humidity_sensor(sens))
cg.add(var.set_internal_pullup(config[CONF_INTERNAL_PULLUP]))
cg.add(var.set_dht_model(config[CONF_MODEL]))

View file

@ -411,6 +411,7 @@ CONF_INTERLOCK = "interlock"
CONF_INTERNAL = "internal"
CONF_INTERNAL_FILTER = "internal_filter"
CONF_INTERNAL_FILTER_MODE = "internal_filter_mode"
CONF_INTERNAL_PULLUP = "use_internal_pullup"
CONF_INTERNAL_TEMPERATURE = "internal_temperature"
CONF_INTERRUPT = "interrupt"
CONF_INTERRUPT_PIN = "interrupt_pin"