1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-29 16:42:19 +01:00

[nextion] New trigger on_buffer_overflow (#7772)

This commit is contained in:
Edward Firmo
2024-11-20 19:28:21 +01:00
committed by GitHub
parent 372d68a177
commit 846b091aac
11 changed files with 55 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ from esphome.const import (
from esphome.core import CORE
from . import Nextion, nextion_ns, nextion_ref
from .base_component import (
CONF_ON_BUFFER_OVERFLOW,
CONF_ON_SLEEP,
CONF_ON_WAKE,
CONF_ON_SETUP,
@@ -36,6 +37,9 @@ SleepTrigger = nextion_ns.class_("SleepTrigger", automation.Trigger.template())
WakeTrigger = nextion_ns.class_("WakeTrigger", automation.Trigger.template())
PageTrigger = nextion_ns.class_("PageTrigger", automation.Trigger.template())
TouchTrigger = nextion_ns.class_("TouchTrigger", automation.Trigger.template())
BufferOverflowTrigger = nextion_ns.class_(
"BufferOverflowTrigger", automation.Trigger.template()
)
CONFIG_SCHEMA = (
display.BASIC_DISPLAY_SCHEMA.extend(
@@ -68,6 +72,13 @@ CONFIG_SCHEMA = (
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(TouchTrigger),
}
),
cv.Optional(CONF_ON_BUFFER_OVERFLOW): automation.validate_automation(
{
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(
BufferOverflowTrigger
),
}
),
cv.Optional(CONF_TOUCH_SLEEP_TIMEOUT): cv.int_range(min=3, max=65535),
cv.Optional(CONF_WAKE_UP_PAGE): cv.uint8_t,
cv.Optional(CONF_START_UP_PAGE): cv.uint8_t,
@@ -151,3 +162,7 @@ async def to_code(config):
],
conf,
)
for conf in config.get(CONF_ON_BUFFER_OVERFLOW, []):
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
await automation.build_automation(trigger, [], conf)