Merge remote-tracking branch 'origin/dev' into nrf52_core

This commit is contained in:
Tomasz Duda 2024-08-07 17:19:41 +02:00
commit 53d1538bfd
50 changed files with 272 additions and 309 deletions

View file

@ -1,10 +1,8 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.cpp_generator import MockObjClass
from esphome.cpp_helpers import setup_entity
from esphome import automation, core
from esphome.automation import Condition, maybe_simple_id
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_DELAY,
CONF_DEVICE_CLASS,
@ -16,6 +14,7 @@ from esphome.const import (
CONF_INVERTED,
CONF_MAX_LENGTH,
CONF_MIN_LENGTH,
CONF_MQTT_ID,
CONF_ON_CLICK,
CONF_ON_DOUBLE_CLICK,
CONF_ON_MULTI_CLICK,
@ -26,7 +25,6 @@ from esphome.const import (
CONF_STATE,
CONF_TIMING,
CONF_TRIGGER_ID,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_BATTERY_CHARGING,
@ -59,6 +57,8 @@ from esphome.const import (
DEVICE_CLASS_WINDOW,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_generator import MockObjClass
from esphome.cpp_helpers import setup_entity
from esphome.util import Registry
CODEOWNERS = ["@esphome/core"]

View file

@ -1,16 +1,16 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.automation import maybe_simple_id
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_DEVICE_CLASS,
CONF_ENTITY_CATEGORY,
CONF_ICON,
CONF_ID,
CONF_MQTT_ID,
CONF_ON_PRESS,
CONF_TRIGGER_ID,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
DEVICE_CLASS_EMPTY,
DEVICE_CLASS_IDENTIFY,
@ -18,8 +18,8 @@ from esphome.const import (
DEVICE_CLASS_UPDATE,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_helpers import setup_entity
from esphome.cpp_generator import MockObjClass
from esphome.cpp_helpers import setup_entity
CODEOWNERS = ["@esphome/core"]
IS_PLATFORM_COMPONENT = True

View file

@ -1,8 +1,7 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.cpp_helpers import setup_entity
from esphome import automation
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_ACTION_STATE_TOPIC,
CONF_AWAY,
@ -21,6 +20,7 @@ from esphome.const import (
CONF_MODE,
CONF_MODE_COMMAND_TOPIC,
CONF_MODE_STATE_TOPIC,
CONF_MQTT_ID,
CONF_ON_CONTROL,
CONF_ON_STATE,
CONF_PRESET,
@ -33,20 +33,20 @@ from esphome.const import (
CONF_TARGET_HUMIDITY_STATE_TOPIC,
CONF_TARGET_TEMPERATURE,
CONF_TARGET_TEMPERATURE_COMMAND_TOPIC,
CONF_TARGET_TEMPERATURE_STATE_TOPIC,
CONF_TARGET_TEMPERATURE_HIGH,
CONF_TARGET_TEMPERATURE_HIGH_COMMAND_TOPIC,
CONF_TARGET_TEMPERATURE_HIGH_STATE_TOPIC,
CONF_TARGET_TEMPERATURE_LOW,
CONF_TARGET_TEMPERATURE_LOW_COMMAND_TOPIC,
CONF_TARGET_TEMPERATURE_LOW_STATE_TOPIC,
CONF_TARGET_TEMPERATURE_STATE_TOPIC,
CONF_TEMPERATURE_STEP,
CONF_TRIGGER_ID,
CONF_VISUAL,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_helpers import setup_entity
IS_PLATFORM_COMPONENT = True

View file

@ -1,23 +1,23 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.automation import maybe_simple_id, Condition
from esphome.automation import Condition, maybe_simple_id
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_ID,
CONF_DEVICE_CLASS,
CONF_STATE,
CONF_ID,
CONF_MQTT_ID,
CONF_ON_OPEN,
CONF_POSITION,
CONF_POSITION_COMMAND_TOPIC,
CONF_POSITION_STATE_TOPIC,
CONF_STATE,
CONF_STOP,
CONF_TILT,
CONF_TILT_COMMAND_TOPIC,
CONF_TILT_STATE_TOPIC,
CONF_STOP,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
CONF_TRIGGER_ID,
CONF_WEB_SERVER_ID,
DEVICE_CLASS_AWNING,
DEVICE_CLASS_BLIND,
DEVICE_CLASS_CURTAIN,

View file

@ -5,13 +5,17 @@ namespace cst226 {
void CST226Touchscreen::setup() {
esph_log_config(TAG, "Setting up CST226 Touchscreen...");
this->reset_pin_->setup();
this->reset_pin_->digital_write(true);
delay(5);
this->reset_pin_->digital_write(false);
delay(5);
this->reset_pin_->digital_write(true);
this->set_timeout(30, [this] { this->continue_setup_(); });
if (this->reset_pin_ != nullptr) {
this->reset_pin_->setup();
this->reset_pin_->digital_write(true);
delay(5);
this->reset_pin_->digital_write(false);
delay(5);
this->reset_pin_->digital_write(true);
this->set_timeout(30, [this] { this->continue_setup_(); });
} else {
this->continue_setup_();
}
}
void CST226Touchscreen::update_touches() {

View file

@ -35,7 +35,7 @@ class CST226Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice
void continue_setup_();
InternalGPIOPin *interrupt_pin_{};
GPIOPin *reset_pin_{NULL_PIN};
GPIOPin *reset_pin_{};
uint8_t chip_id_{};
bool setup_complete_{};
};

View file

@ -1,32 +1,30 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.components import mqtt, web_server, time
import esphome.codegen as cg
from esphome.components import mqtt, time, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_DATE,
CONF_DATETIME,
CONF_DAY,
CONF_HOUR,
CONF_ID,
CONF_MINUTE,
CONF_MONTH,
CONF_MQTT_ID,
CONF_ON_TIME,
CONF_ON_VALUE,
CONF_SECOND,
CONF_TIME,
CONF_TIME_ID,
CONF_TRIGGER_ID,
CONF_TYPE,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
CONF_DATE,
CONF_DATETIME,
CONF_TIME,
CONF_YEAR,
CONF_MONTH,
CONF_DAY,
CONF_SECOND,
CONF_HOUR,
CONF_MINUTE,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_generator import MockObjClass
from esphome.cpp_helpers import setup_entity
CODEOWNERS = ["@rfdarter", "@jesserockz"]
DEPENDENCIES = ["time"]

View file

@ -1,23 +1,26 @@
import re
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation, core
from esphome.automation import maybe_simple_id
import esphome.codegen as cg
from esphome.components.number import Number
from esphome.components.select import Select
from esphome.components.switch import Switch
import esphome.config_validation as cv
from esphome.const import (
CONF_ID,
CONF_TYPE,
CONF_TRIGGER_ID,
CONF_ON_VALUE,
CONF_ACTIVE,
CONF_COMMAND,
CONF_CUSTOM,
CONF_NUMBER,
CONF_FORMAT,
CONF_ID,
CONF_ITEMS,
CONF_MODE,
CONF_ACTIVE,
CONF_NUMBER,
CONF_ON_VALUE,
CONF_TEXT,
CONF_TRIGGER_ID,
CONF_TYPE,
)
from esphome.automation import maybe_simple_id
from esphome.components.select import Select
from esphome.components.number import Number
from esphome.components.switch import Switch
CODEOWNERS = ["@numo68"]
@ -29,10 +32,8 @@ CONF_JOYSTICK = "joystick"
CONF_LABEL = "label"
CONF_MENU = "menu"
CONF_BACK = "back"
CONF_TEXT = "text"
CONF_SELECT = "select"
CONF_SWITCH = "switch"
CONF_ITEMS = "items"
CONF_ON_TEXT = "on_text"
CONF_OFF_TEXT = "off_text"
CONF_VALUE_LAMBDA = "value_lambda"

View file

@ -1,24 +1,24 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
import esphome.codegen as cg
from esphome.components import mqtt
import esphome.config_validation as cv
from esphome.const import (
CONF_DEVICE_CLASS,
CONF_ENTITY_CATEGORY,
CONF_EVENT_TYPE,
CONF_ICON,
CONF_ID,
CONF_MQTT_ID,
CONF_ON_EVENT,
CONF_TRIGGER_ID,
CONF_MQTT_ID,
CONF_EVENT_TYPE,
DEVICE_CLASS_BUTTON,
DEVICE_CLASS_DOORBELL,
DEVICE_CLASS_EMPTY,
DEVICE_CLASS_MOTION,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_helpers import setup_entity
from esphome.cpp_generator import MockObjClass
from esphome.cpp_helpers import setup_entity
CODEOWNERS = ["@nohat"]
IS_PLATFORM_COMPONENT = True

View file

@ -1,31 +1,31 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.automation import maybe_simple_id
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_DIRECTION,
CONF_ID,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
CONF_OSCILLATING,
CONF_OSCILLATION_COMMAND_TOPIC,
CONF_OSCILLATION_STATE_TOPIC,
CONF_SPEED,
CONF_SPEED_LEVEL_COMMAND_TOPIC,
CONF_SPEED_LEVEL_STATE_TOPIC,
CONF_SPEED_COMMAND_TOPIC,
CONF_SPEED_STATE_TOPIC,
CONF_OFF_SPEED_CYCLE,
CONF_ON_DIRECTION_SET,
CONF_ON_OSCILLATING_SET,
CONF_ON_PRESET_SET,
CONF_ON_SPEED_SET,
CONF_ON_STATE,
CONF_ON_TURN_OFF,
CONF_ON_TURN_ON,
CONF_ON_PRESET_SET,
CONF_TRIGGER_ID,
CONF_DIRECTION,
CONF_OSCILLATING,
CONF_OSCILLATION_COMMAND_TOPIC,
CONF_OSCILLATION_STATE_TOPIC,
CONF_RESTORE_MODE,
CONF_SPEED,
CONF_SPEED_COMMAND_TOPIC,
CONF_SPEED_LEVEL_COMMAND_TOPIC,
CONF_SPEED_LEVEL_STATE_TOPIC,
CONF_SPEED_STATE_TOPIC,
CONF_TRIGGER_ID,
CONF_WEB_SERVER_ID,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_helpers import setup_entity

View file

@ -10,12 +10,12 @@ import esphome.config_validation as cv
from esphome.const import (
CONF_BACKGROUND_COLOR,
CONF_DISPLAY,
CONF_FONT,
CONF_FOREGROUND_COLOR,
CONF_ID,
CONF_TRIGGER_ID,
)
CONF_FONT = "font"
CONF_MENU_ITEM_VALUE = "menu_item_value"
CONF_ON_REDRAW = "on_redraw"

View file

@ -1,8 +1,9 @@
import esphome.codegen as cg
import esphome.config_validation as cv
import esphome.automation as auto
import esphome.codegen as cg
from esphome.components import mqtt, power_supply, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_COLD_WHITE_COLOR_TEMPERATURE,
CONF_COLOR_CORRECT,
CONF_DEFAULT_TRANSITION_LENGTH,
CONF_EFFECTS,
@ -10,36 +11,36 @@ from esphome.const import (
CONF_GAMMA_CORRECT,
CONF_ID,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
CONF_POWER_SUPPLY,
CONF_RESTORE_MODE,
CONF_ON_STATE,
CONF_ON_TURN_OFF,
CONF_ON_TURN_ON,
CONF_ON_STATE,
CONF_POWER_SUPPLY,
CONF_RESTORE_MODE,
CONF_TRIGGER_ID,
CONF_COLD_WHITE_COLOR_TEMPERATURE,
CONF_WARM_WHITE_COLOR_TEMPERATURE,
CONF_WEB_SERVER_ID,
)
from esphome.core import coroutine_with_priority
from esphome.cpp_helpers import setup_entity
from .automation import light_control_to_code # noqa
from .effects import (
validate_effects,
ADDRESSABLE_EFFECTS,
BINARY_EFFECTS,
EFFECTS_REGISTRY,
MONOCHROMATIC_EFFECTS,
RGB_EFFECTS,
ADDRESSABLE_EFFECTS,
EFFECTS_REGISTRY,
validate_effects,
)
from .types import ( # noqa
LightState,
AddressableLightState,
light_ns,
LightOutput,
AddressableLight,
LightTurnOnTrigger,
LightTurnOffTrigger,
AddressableLightState,
LightOutput,
LightState,
LightStateTrigger,
LightTurnOffTrigger,
LightTurnOnTrigger,
light_ns,
)
CODEOWNERS = ["@esphome/core"]

View file

@ -1,14 +1,14 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.automation import Condition, maybe_simple_id
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_ID,
CONF_MQTT_ID,
CONF_ON_LOCK,
CONF_ON_UNLOCK,
CONF_TRIGGER_ID,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
)
from esphome.core import CORE, coroutine_with_priority

View file

@ -23,9 +23,9 @@ from esphome.helpers import write_file_if_changed
from . import defines as df, helpers, lv_validation as lvalid
from .automation import disp_update, update_to_code
from .defines import CONF_SKIP
from .encoders import ENCODERS_CONFIG, encoders_to_code
from .lv_validation import lv_bool, lv_images_used
from .lvcode import LvContext, LvglComponent
from .rotary_encoders import ROTARY_ENCODER_CONFIG, rotary_encoders_to_code
from .schemas import (
DISP_BG_SCHEMA,
FLEX_OBJ_SCHEMA,
@ -256,7 +256,7 @@ async def to_code(config):
async with LvContext(lv_component):
await touchscreens_to_code(lv_component, config)
await rotary_encoders_to_code(lv_component, config)
await encoders_to_code(lv_component, config)
await theme_to_code(config)
await styles_to_code(config)
await set_obj_properties(lv_scr_act, config)
@ -336,7 +336,7 @@ CONFIG_SCHEMA = (
{cv.Optional(name): obj_schema(w) for name, w in WIDGET_TYPES.items()}
),
cv.GenerateID(df.CONF_TOUCHSCREENS): touchscreen_schema,
cv.GenerateID(df.CONF_ROTARY_ENCODERS): ROTARY_ENCODER_CONFIG,
cv.GenerateID(df.CONF_ENCODERS): ENCODERS_CONFIG,
}
)
.extend(DISP_BG_SCHEMA)

View file

@ -5,6 +5,7 @@ Constants already defined in esphome.const are not duplicated here and must be i
"""
from esphome import codegen as cg, config_validation as cv
from esphome.const import CONF_ITEMS
from esphome.core import ID, Lambda
from esphome.cpp_generator import MockObj
from esphome.cpp_types import uint32
@ -115,7 +116,6 @@ CONF_SCROLLBAR = "scrollbar"
CONF_INDICATOR = "indicator"
CONF_KNOB = "knob"
CONF_SELECTED = "selected"
CONF_ITEMS = "items"
CONF_TICKS = "ticks"
CONF_CURSOR = "cursor"
CONF_TEXTAREA_PLACEHOLDER = "textarea_placeholder"
@ -388,6 +388,7 @@ CONF_DEFAULT = "default"
CONF_DEFAULT_FONT = "default_font"
CONF_DIR = "dir"
CONF_DISPLAYS = "displays"
CONF_ENCODERS = "encoders"
CONF_END_ANGLE = "end_angle"
CONF_END_VALUE = "end_value"
CONF_ENTER_BUTTON = "enter_button"
@ -441,7 +442,6 @@ CONF_RECOLOR = "recolor"
CONF_RIGHT_BUTTON = "right_button"
CONF_ROLLOVER = "rollover"
CONF_ROOT_BACK_BTN = "root_back_btn"
CONF_ROTARY_ENCODERS = "rotary_encoders"
CONF_ROWS = "rows"
CONF_SCALE_LINES = "scale_lines"
CONF_SCROLLBAR_MODE = "scrollbar_mode"
@ -460,7 +460,6 @@ CONF_SKIP = "skip"
CONF_SYMBOL = "symbol"
CONF_TAB_ID = "tab_id"
CONF_TABS = "tabs"
CONF_TEXT = "text"
CONF_TILE = "tile"
CONF_TILE_ID = "tile_id"
CONF_TILES = "tiles"

View file

@ -5,25 +5,26 @@ import esphome.config_validation as cv
from esphome.const import CONF_GROUP, CONF_ID, CONF_SENSOR
from .defines import (
CONF_ENCODERS,
CONF_ENTER_BUTTON,
CONF_LEFT_BUTTON,
CONF_LONG_PRESS_REPEAT_TIME,
CONF_LONG_PRESS_TIME,
CONF_RIGHT_BUTTON,
CONF_ROTARY_ENCODERS,
)
from .helpers import lvgl_components_required
from .lvcode import lv, lv_add, lv_expr
from .helpers import lvgl_components_required, requires_component
from .lvcode import lv, lv_add, lv_assign, lv_expr, lv_Pvariable
from .schemas import ENCODER_SCHEMA
from .types import lv_indev_type_t
from .widgets import add_group
from .types import lv_group_t, lv_indev_type_t
ROTARY_ENCODER_CONFIG = cv.ensure_list(
ENCODERS_CONFIG = cv.ensure_list(
ENCODER_SCHEMA.extend(
{
cv.Required(CONF_ENTER_BUTTON): cv.use_id(BinarySensor),
cv.Required(CONF_SENSOR): cv.Any(
cv.use_id(RotaryEncoderSensor),
cv.All(
cv.use_id(RotaryEncoderSensor), requires_component("rotary_encoder")
),
cv.Schema(
{
cv.Required(CONF_LEFT_BUTTON): cv.use_id(BinarySensor),
@ -36,10 +37,9 @@ ROTARY_ENCODER_CONFIG = cv.ensure_list(
)
async def rotary_encoders_to_code(var, config):
for enc_conf in config.get(CONF_ROTARY_ENCODERS, ()):
async def encoders_to_code(var, config):
for enc_conf in config.get(CONF_ENCODERS, ()):
lvgl_components_required.add("KEY_LISTENER")
lvgl_components_required.add("ROTARY_ENCODER")
lpt = enc_conf[CONF_LONG_PRESS_TIME].total_milliseconds
lprt = enc_conf[CONF_LONG_PRESS_REPEAT_TIME].total_milliseconds
listener = cg.new_Pvariable(
@ -57,7 +57,9 @@ async def rotary_encoders_to_code(var, config):
lv_add(listener.set_sensor(sensor_config))
b_sensor = await cg.get_variable(enc_conf[CONF_ENTER_BUTTON])
cg.add(listener.set_enter_button(b_sensor))
if group := add_group(enc_conf.get(CONF_GROUP)):
if group := enc_conf.get(CONF_GROUP):
group = lv_Pvariable(lv_group_t, group)
lv_assign(group, lv_expr.group_create())
lv.indev_set_group(lv_expr.indev_drv_register(listener.get_drv()), group)
else:
lv.indev_drv_register(listener.get_drv())

View file

@ -127,7 +127,7 @@ void LVTouchListener::update(const touchscreen::TouchPoints_t &tpoints) {
}
#endif // USE_LVGL_TOUCHSCREEN
#ifdef USE_LVGL_ROTARY_ENCODER
#ifdef USE_LVGL_KEY_LISTENER
LVEncoderListener::LVEncoderListener(lv_indev_type_t type, uint16_t lpt, uint16_t lprt) {
lv_indev_drv_init(&this->drv_);
this->drv_.type = type;
@ -143,7 +143,7 @@ LVEncoderListener::LVEncoderListener(lv_indev_type_t type, uint16_t lpt, uint16_
data->continue_reading = false;
};
}
#endif // USE_LVGL_ROTARY_ENCODER
#endif // USE_LVGL_KEY_LISTENER
#ifdef USE_LVGL_BUTTONMATRIX
void LvButtonMatrixType::set_obj(lv_obj_t *lv_obj) {

View file

@ -1,6 +1,13 @@
#pragma once
#include "esphome/core/defines.h"
#ifdef USE_LVGL_BINARY_SENSOR
#include "esphome/components/binary_sensor/binary_sensor.h"
#endif // USE_LVGL_BINARY_SENSOR
#ifdef USE_LVGL_ROTARY_ENCODER
#include "esphome/components/rotary_encoder/rotary_encoder.h"
#endif // USE_LVGL_ROTARY_ENCODER
// required for clang-tidy
#ifndef LV_CONF_H
#define LV_CONF_SKIP 1 // NOLINT
@ -12,12 +19,7 @@
#include "esphome/core/log.h"
#include <lvgl.h>
#include <vector>
#ifdef USE_LVGL_ROTARY_ENCODER
#include "esphome/components/binary_sensor/binary_sensor.h"
#include "esphome/components/rotary_encoder/rotary_encoder.h"
#endif // USE_LVGL_ROTARY_ENCODER
#include <map>
#ifdef USE_LVGL_IMAGE
#include "esphome/components/image/image.h"
#endif // USE_LVGL_IMAGE
@ -202,7 +204,7 @@ class LVTouchListener : public touchscreen::TouchListener, public Parented<LvglC
};
#endif // USE_LVGL_TOUCHSCREEN
#ifdef USE_LVGL_ROTARY_ENCODER
#ifdef USE_LVGL_KEY_LISTENER
class LVEncoderListener : public Parented<LvglComponent> {
public:
LVEncoderListener(lv_indev_type_t type, uint16_t lpt, uint16_t lprt);
@ -218,9 +220,11 @@ class LVEncoderListener : public Parented<LvglComponent> {
enter_button->add_on_state_callback([this](bool state) { this->event(LV_KEY_ENTER, state); });
}
#ifdef USE_LVGL_ROTARY_ENCODER
void set_sensor(rotary_encoder::RotaryEncoderSensor *sensor) {
sensor->register_listener([this](int32_t count) { this->set_count(count); });
}
#endif // USE_LVGL_ROTARY_ENCODER
void event(int key, bool pressed) {
if (!this->parent_->is_paused()) {
@ -243,7 +247,8 @@ class LVEncoderListener : public Parented<LvglComponent> {
int32_t last_count_{};
int key_{};
};
#endif // USE_LVGL_ROTARY_ENCODER
#endif // USE_LVGL_KEY_LISTENER
#ifdef USE_LVGL_BUTTONMATRIX
class LvButtonMatrixType : public key_provider::KeyProvider, public LvCompound {
public:

View file

@ -7,6 +7,7 @@ from esphome.const import (
CONF_ID,
CONF_ON_VALUE,
CONF_STATE,
CONF_TEXT,
CONF_TRIGGER_ID,
CONF_TYPE,
)
@ -15,9 +16,9 @@ from esphome.schema_extractors import SCHEMA_EXTRACT
from . import defines as df, lv_validation as lvalid, types as ty
from .helpers import add_lv_use, requires_component, validate_printf
from .lv_validation import id_name, lv_color, lv_font, lv_image
from .lv_validation import lv_color, lv_font, lv_image
from .lvcode import LvglComponent
from .types import WidgetType
from .types import WidgetType, lv_group_t
# this will be populated later, in __init__.py to avoid circular imports.
WIDGET_TYPES: dict = {}
@ -25,7 +26,7 @@ WIDGET_TYPES: dict = {}
# A schema for text properties
TEXT_SCHEMA = cv.Schema(
{
cv.Optional(df.CONF_TEXT): cv.Any(
cv.Optional(CONF_TEXT): cv.Any(
cv.All(
cv.Schema(
{
@ -60,7 +61,7 @@ ENCODER_SCHEMA = cv.Schema(
cv.GenerateID(): cv.All(
cv.declare_id(ty.LVEncoderListener), requires_component("binary_sensor")
),
cv.Optional(CONF_GROUP): lvalid.id_name,
cv.Optional(CONF_GROUP): cv.declare_id(lv_group_t),
cv.Optional(df.CONF_LONG_PRESS_TIME, default="400ms"): PRESS_TIME,
cv.Optional(df.CONF_LONG_PRESS_REPEAT_TIME, default="100ms"): PRESS_TIME,
}
@ -248,7 +249,7 @@ def obj_schema(widget_type: WidgetType):
cv.Schema(
{
cv.Optional(CONF_STATE): SET_STATE_SCHEMA,
cv.Optional(CONF_GROUP): id_name,
cv.Optional(CONF_GROUP): cv.use_id(lv_group_t),
}
)
)
@ -330,7 +331,7 @@ DISP_BG_SCHEMA = cv.Schema(
# A style schema that can include text
STYLED_TEXT_SCHEMA = cv.maybe_simple_value(
STYLE_SCHEMA.extend(TEXT_SCHEMA), key=df.CONF_TEXT
STYLE_SCHEMA.extend(TEXT_SCHEMA), key=CONF_TEXT
)
# For use by platform components

View file

@ -1,10 +1,10 @@
import sys
from esphome import automation, codegen as cg
from esphome.const import CONF_MAX_VALUE, CONF_MIN_VALUE, CONF_VALUE
from esphome.const import CONF_MAX_VALUE, CONF_MIN_VALUE, CONF_TEXT, CONF_VALUE
from esphome.cpp_generator import MockObj, MockObjClass
from .defines import CONF_TEXT, lvgl_ns
from .defines import lvgl_ns
from .lvcode import lv_expr

View file

@ -6,7 +6,7 @@ from esphome.config_validation import Invalid
from esphome.const import CONF_GROUP, CONF_ID, CONF_STATE, CONF_TYPE
from esphome.core import ID, TimePeriod
from esphome.coroutine import FakeAwaitable
from esphome.cpp_generator import AssignmentExpression, CallExpression, MockObj
from esphome.cpp_generator import CallExpression, MockObj
from ..defines import (
CONF_DEFAULT,
@ -44,15 +44,7 @@ from ..lvcode import (
lv_Pvariable,
)
from ..schemas import ALL_STYLES, STYLE_REMAP, WIDGET_TYPES
from ..types import (
LV_STATE,
LvType,
WidgetType,
lv_coord_t,
lv_group_t,
lv_obj_t,
lv_obj_t_ptr,
)
from ..types import LV_STATE, LvType, WidgetType, lv_coord_t, lv_obj_t, lv_obj_t_ptr
EVENT_LAMB = "event_lamb__"
@ -317,7 +309,8 @@ async def set_obj_properties(w: Widget, config):
value = await ALL_STYLES[prop].process(value)
prop_r = STYLE_REMAP.get(prop, prop)
w.set_style(prop_r, value, lv_state)
if group := add_group(config.get(CONF_GROUP)):
if group := config.get(CONF_GROUP):
group = await cg.get_variable(group)
lv.group_add_obj(group, w.obj)
flag_clr = set()
flag_set = set()
@ -404,20 +397,3 @@ async def widget_to_code(w_cnfig, w_type: WidgetType, parent):
lv_scr_act_spec = LvScrActType()
lv_scr_act = Widget.create(None, literal("lv_scr_act()"), lv_scr_act_spec, {})
lv_groups = {} # Widget group names
def add_group(name):
if name is None:
return None
fullname = f"lv_esp_group_{name}"
if name not in lv_groups:
gid = ID(fullname, True, type=lv_group_t.operator("ptr"))
lv_add(
AssignmentExpression(
type_=gid.type, modifier="", name=fullname, rhs=lv_expr.group_create()
)
)
lv_groups[name] = literal(fullname)
return lv_groups[name]

View file

@ -2,7 +2,7 @@ from esphome import automation
import esphome.codegen as cg
from esphome.components.key_provider import KeyProvider
import esphome.config_validation as cv
from esphome.const import CONF_ID, CONF_WIDTH
from esphome.const import CONF_ID, CONF_ITEMS, CONF_TEXT, CONF_WIDTH
from esphome.cpp_generator import MockObj
from ..automation import action_to_code
@ -10,13 +10,11 @@ from ..defines import (
BUTTONMATRIX_CTRLS,
CONF_BUTTONS,
CONF_CONTROL,
CONF_ITEMS,
CONF_KEY_CODE,
CONF_MAIN,
CONF_ONE_CHECKED,
CONF_ROWS,
CONF_SELECTED,
CONF_TEXT,
)
from ..helpers import lvgl_components_required
from ..lv_validation import key_code, lv_bool

View file

@ -1,4 +1,6 @@
from ..defines import CONF_INDICATOR, CONF_MAIN, CONF_TEXT
from esphome.const import CONF_TEXT
from ..defines import CONF_INDICATOR, CONF_MAIN
from ..lv_validation import lv_text
from ..lvcode import lv
from ..schemas import TEXT_SCHEMA

View file

@ -1,9 +1,9 @@
from esphome.components.key_provider import KeyProvider
import esphome.config_validation as cv
from esphome.const import CONF_MODE
from esphome.const import CONF_ITEMS, CONF_MODE
from esphome.cpp_types import std_string
from ..defines import CONF_ITEMS, CONF_MAIN, KEYBOARD_MODES, literal
from ..defines import CONF_MAIN, KEYBOARD_MODES, literal
from ..helpers import add_lv_use, lvgl_components_required
from ..types import LvCompound, LvType
from . import Widget, WidgetType, get_widgets

View file

@ -1,4 +1,5 @@
import esphome.config_validation as cv
from esphome.const import CONF_TEXT
from ..defines import (
CONF_LONG_MODE,
@ -6,7 +7,6 @@ from ..defines import (
CONF_RECOLOR,
CONF_SCROLLBAR,
CONF_SELECTED,
CONF_TEXT,
LV_LONG_MODES,
)
from ..lv_validation import lv_bool, lv_text

View file

@ -1,5 +1,5 @@
from esphome import config_validation as cv
from esphome.const import CONF_BUTTON, CONF_ID
from esphome.const import CONF_BUTTON, CONF_ID, CONF_TEXT
from esphome.core import ID
from esphome.cpp_generator import new_Pvariable, static_const_array
from esphome.cpp_types import nullptr
@ -9,7 +9,6 @@ from ..defines import (
CONF_BUTTONS,
CONF_CLOSE_BUTTON,
CONF_MSGBOXES,
CONF_TEXT,
CONF_TITLE,
TYPE_FLEX,
literal,

View file

@ -1,5 +1,5 @@
import esphome.config_validation as cv
from esphome.const import CONF_MAX_LENGTH
from esphome.const import CONF_MAX_LENGTH, CONF_TEXT
from ..defines import (
CONF_ACCEPTED_CHARS,
@ -10,7 +10,6 @@ from ..defines import (
CONF_PLACEHOLDER_TEXT,
CONF_SCROLLBAR,
CONF_SELECTED,
CONF_TEXT,
CONF_TEXTAREA_PLACEHOLDER,
)
from ..lv_validation import lv_bool, lv_int, lv_text

View file

@ -1,6 +1,6 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import sensor, spi
import esphome.config_validation as cv
from esphome.const import (
CONF_MAINS_FILTER,
DEVICE_CLASS_TEMPERATURE,
@ -15,8 +15,8 @@ MAX31856Sensor = max31856_ns.class_(
MAX31865ConfigFilter = max31856_ns.enum("MAX31856ConfigFilter")
FILTER = {
"50HZ": MAX31865ConfigFilter.FILTER_50HZ,
"60HZ": MAX31865ConfigFilter.FILTER_60HZ,
50: MAX31865ConfigFilter.FILTER_50HZ,
60: MAX31865ConfigFilter.FILTER_60HZ,
}
CONFIG_SCHEMA = (
@ -29,8 +29,8 @@ CONFIG_SCHEMA = (
)
.extend(
{
cv.Optional(CONF_MAINS_FILTER, default="60HZ"): cv.enum(
FILTER, upper=True, space=""
cv.Optional(CONF_MAINS_FILTER, default="60Hz"): cv.All(
cv.frequency, cv.enum(FILTER, int=True)
),
}
)

View file

@ -1,20 +1,18 @@
from esphome import automation
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.automation import maybe_simple_id
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.const import (
CONF_ID,
CONF_ON_IDLE,
CONF_ON_STATE,
CONF_TRIGGER_ID,
CONF_VOLUME,
CONF_ON_IDLE,
)
from esphome.core import CORE
from esphome.coroutine import coroutine_with_priority
from esphome.cpp_helpers import setup_entity
CODEOWNERS = ["@jesserockz"]
IS_PLATFORM_COMPONENT = True

View file

@ -1,24 +1,23 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.components import mqtt
from esphome.components import web_server
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_ABOVE,
CONF_BELOW,
CONF_CYCLE,
CONF_DEVICE_CLASS,
CONF_ENTITY_CATEGORY,
CONF_ID,
CONF_ICON,
CONF_ID,
CONF_MODE,
CONF_MQTT_ID,
CONF_ON_VALUE,
CONF_ON_VALUE_RANGE,
CONF_OPERATION,
CONF_TRIGGER_ID,
CONF_UNIT_OF_MEASUREMENT,
CONF_MQTT_ID,
CONF_VALUE,
CONF_OPERATION,
CONF_CYCLE,
CONF_WEB_SERVER_ID,
DEVICE_CLASS_APPARENT_POWER,
DEVICE_CLASS_AQI,
@ -72,8 +71,8 @@ from esphome.const import (
DEVICE_CLASS_WIND_SPEED,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_helpers import setup_entity
from esphome.cpp_generator import MockObjClass
from esphome.cpp_helpers import setup_entity
CODEOWNERS = ["@esphome/core"]
DEVICE_CLASSES = [

View file

@ -49,7 +49,7 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase,
#ifdef USE_ESP32
void configure_rmt_();
uint32_t current_carrier_frequency_{UINT32_MAX};
uint32_t current_carrier_frequency_{38000};
bool initialized_{false};
std::vector<rmt_item32_t> rmt_temp_;
esp_err_t error_code_{ESP_OK};

View file

@ -1,20 +1,20 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_CYCLE,
CONF_ENTITY_CATEGORY,
CONF_ICON,
CONF_ID,
CONF_INDEX,
CONF_MODE,
CONF_MQTT_ID,
CONF_ON_VALUE,
CONF_OPERATION,
CONF_OPTION,
CONF_TRIGGER_ID,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
CONF_CYCLE,
CONF_MODE,
CONF_OPERATION,
CONF_INDEX,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_generator import MockObjClass

View file

@ -1,22 +1,27 @@
import math
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_DEVICE_CLASS,
CONF_ABOVE,
CONF_ACCURACY_DECIMALS,
CONF_ALPHA,
CONF_BELOW,
CONF_DEVICE_CLASS,
CONF_ENTITY_CATEGORY,
CONF_EXPIRE_AFTER,
CONF_FILTERS,
CONF_FORCE_UPDATE,
CONF_FROM,
CONF_ICON,
CONF_ID,
CONF_IGNORE_OUT_OF_RANGE,
CONF_MAX_VALUE,
CONF_METHOD,
CONF_MIN_VALUE,
CONF_MQTT_ID,
CONF_MULTIPLE,
CONF_ON_RAW_VALUE,
CONF_ON_VALUE,
@ -30,14 +35,9 @@ from esphome.const import (
CONF_TRIGGER_ID,
CONF_TYPE,
CONF_UNIT_OF_MEASUREMENT,
CONF_WINDOW_SIZE,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
CONF_FORCE_UPDATE,
CONF_VALUE,
CONF_MIN_VALUE,
CONF_MAX_VALUE,
CONF_METHOD,
CONF_WEB_SERVER_ID,
CONF_WINDOW_SIZE,
DEVICE_CLASS_APPARENT_POWER,
DEVICE_CLASS_AQI,
DEVICE_CLASS_ATMOSPHERIC_PRESSURE,

View file

@ -7,10 +7,6 @@ namespace spi {
const char *const TAG = "spi";
SPIDelegate *const SPIDelegate::NULL_DELEGATE = // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
new SPIDelegateDummy();
// https://bugs.llvm.org/show_bug.cgi?id=48040
bool SPIDelegate::is_ready() { return true; }
GPIOPin *const NullPin::NULL_PIN = new NullPin(); // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
@ -79,8 +75,6 @@ void SPIComponent::dump_config() {
}
}
void SPIDelegateDummy::begin_transaction() { ESP_LOGE(TAG, "SPIDevice not initialised - did you call spi_setup()?"); }
uint8_t SPIDelegateBitBash::transfer(uint8_t data) { return this->transfer_(data, 8); }
void SPIDelegateBitBash::write(uint16_t data, size_t num_bits) { this->transfer_(data, num_bits); }

View file

@ -163,8 +163,6 @@ class Utility {
}
};
class SPIDelegateDummy;
// represents a device attached to an SPI bus, with a defined clock rate, mode and bit order. On Arduino this is
// a thin wrapper over SPIClass.
class SPIDelegate {
@ -250,21 +248,6 @@ class SPIDelegate {
uint32_t data_rate_{1000000};
SPIMode mode_{MODE0};
GPIOPin *cs_pin_{NullPin::NULL_PIN};
static SPIDelegate *const NULL_DELEGATE; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
};
/**
* A dummy SPIDelegate that complains if it's used.
*/
class SPIDelegateDummy : public SPIDelegate {
public:
SPIDelegateDummy() = default;
uint8_t transfer(uint8_t data) override { return 0; }
void end_transaction() override{};
void begin_transaction() override;
};
/**
@ -382,7 +365,7 @@ class SPIClient {
virtual void spi_teardown() {
this->parent_->unregister_device(this);
this->delegate_ = SPIDelegate::NULL_DELEGATE;
this->delegate_ = nullptr;
}
bool spi_is_ready() { return this->delegate_->is_ready(); }
@ -393,7 +376,7 @@ class SPIClient {
uint32_t data_rate_{1000000};
SPIComponent *parent_{nullptr};
GPIOPin *cs_{nullptr};
SPIDelegate *delegate_{SPIDelegate::NULL_DELEGATE};
SPIDelegate *delegate_{nullptr};
};
/**

View file

@ -1,8 +1,8 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.automation import Condition, maybe_simple_id
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_DEVICE_CLASS,
CONF_ENTITY_CATEGORY,
@ -10,11 +10,11 @@ from esphome.const import (
CONF_ID,
CONF_INVERTED,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
CONF_ON_TURN_OFF,
CONF_ON_TURN_ON,
CONF_RESTORE_MODE,
CONF_TRIGGER_ID,
CONF_WEB_SERVER_ID,
DEVICE_CLASS_EMPTY,
DEVICE_CLASS_OUTLET,
DEVICE_CLASS_SWITCH,

View file

@ -1,18 +1,18 @@
from typing import Optional
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_ID,
CONF_MODE,
CONF_MQTT_ID,
CONF_ON_VALUE,
CONF_TRIGGER_ID,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
CONF_VALUE,
CONF_WEB_SERVER_ID,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_helpers import setup_entity

View file

@ -1,21 +1,21 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_DEVICE_CLASS,
CONF_ENTITY_CATEGORY,
CONF_FILTERS,
CONF_FROM,
CONF_ICON,
CONF_ID,
CONF_ON_VALUE,
CONF_ON_RAW_VALUE,
CONF_TRIGGER_ID,
CONF_MQTT_ID,
CONF_WEB_SERVER_ID,
CONF_ON_RAW_VALUE,
CONF_ON_VALUE,
CONF_STATE,
CONF_FROM,
CONF_TO,
CONF_TRIGGER_ID,
CONF_WEB_SERVER_ID,
DEVICE_CLASS_DATE,
DEVICE_CLASS_EMPTY,
DEVICE_CLASS_TIMESTAMP,

View file

@ -1,8 +1,8 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.automation import maybe_simple_id, Condition
from esphome.automation import Condition, maybe_simple_id
import esphome.codegen as cg
from esphome.components import mqtt, web_server
import esphome.config_validation as cv
from esphome.const import (
CONF_DEVICE_CLASS,
CONF_ID,

View file

@ -310,6 +310,7 @@ CONF_FLASH_LENGTH = "flash_length"
CONF_FLASH_TRANSITION_LENGTH = "flash_transition_length"
CONF_FLOW = "flow"
CONF_FLOW_CONTROL_PIN = "flow_control_pin"
CONF_FONT = "font"
CONF_FOR = "for"
CONF_FORCE_UPDATE = "force_update"
CONF_FOREGROUND_COLOR = "foreground_color"
@ -409,6 +410,7 @@ CONF_INVERTED = "inverted"
CONF_IP_ADDRESS = "ip_address"
CONF_IRQ_PIN = "irq_pin"
CONF_IS_RGBW = "is_rgbw"
CONF_ITEMS = "items"
CONF_JS_INCLUDE = "js_include"
CONF_JS_URL = "js_url"
CONF_JVC = "jvc"
@ -843,6 +845,7 @@ CONF_TEMPERATURE = "temperature"
CONF_TEMPERATURE_OFFSET = "temperature_offset"
CONF_TEMPERATURE_SOURCE = "temperature_source"
CONF_TEMPERATURE_STEP = "temperature_step"
CONF_TEXT = "text"
CONF_TEXT_SENSORS = "text_sensors"
CONF_THEN = "then"
CONF_THRESHOLD = "threshold"

View file

@ -62,24 +62,6 @@ class GPIOPin {
virtual bool is_internal() { return false; }
};
/**
* A pin to replace those that don't exist.
*/
class NullPin : public GPIOPin {
public:
void setup() override {}
void pin_mode(gpio::Flags _) override {}
bool digital_read() override { return false; }
void digital_write(bool _) override {}
std::string dump_summary() const override { return {"Not used"}; }
};
static GPIOPin *const NULL_PIN = new NullPin(); // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
/// Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
class ISRInternalGPIOPin {
public:

View file

@ -3,7 +3,6 @@ import hashlib
import json
import logging
import ssl
import sys
import time
import paho.mqtt.client as mqtt
@ -103,10 +102,7 @@ def prepare(
if config[CONF_MQTT].get(CONF_SSL_FINGERPRINTS) or config[CONF_MQTT].get(
CONF_CERTIFICATE_AUTHORITY
):
if sys.version_info >= (2, 7, 13):
tls_version = ssl.PROTOCOL_TLS # pylint: disable=no-member
else:
tls_version = ssl.PROTOCOL_SSLv23
tls_version = ssl.PROTOCOL_TLS # pylint: disable=no-member
client.tls_set(
ca_certs=None,
certfile=None,

View file

@ -1,13 +1,13 @@
#!/usr/bin/env python3
from pathlib import Path
import sys
import argparse
from collections import defaultdict
from pathlib import Path
import sys
from esphome.helpers import write_file_if_changed
from esphome.config import get_component, get_platform
from esphome.core import CORE
from esphome.const import KEY_CORE, KEY_TARGET_FRAMEWORK
from esphome.core import CORE
from esphome.helpers import write_file_if_changed
parser = argparse.ArgumentParser()
parser.add_argument(

View file

@ -1,9 +1,10 @@
import argparse
import glob
import inspect
import json
import argparse
import os
import glob
import re
import voluptuous as vol
# NOTE: Cannot import other esphome components globally as a modification in vol_schema
@ -94,13 +95,12 @@ load_components()
# Import esphome after loading components (so schema is tracked)
# pylint: disable=wrong-import-position
import esphome.core as esphome_core
import esphome.config_validation as cv
from esphome import automation
from esphome import pins
from esphome import automation, pins
from esphome.components import remote_base
from esphome.loader import get_platform, CORE_COMPONENTS_PATH
import esphome.config_validation as cv
import esphome.core as esphome_core
from esphome.helpers import write_file_if_changed
from esphome.loader import CORE_COMPONENTS_PATH, get_platform
from esphome.util import Registry
# pylint: enable=wrong-import-position

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python3
import argparse
import re
from dataclasses import dataclass
import re
import sys

View file

@ -1,15 +1,6 @@
#!/usr/bin/env python3
from helpers import (
print_error_for_file,
get_output,
git_ls_files,
filter_changed,
get_binary,
)
import argparse
import click
import colorama
import multiprocessing
import os
import queue
@ -18,6 +9,9 @@ import subprocess
import sys
import threading
import click
import colorama
from helpers import filter_changed, get_binary, git_ls_files, print_error_for_file
def run_format(executable, args, queue, lock, failed_files):

View file

@ -1,19 +1,20 @@
#!/usr/bin/env python3
from helpers import (
styled,
print_error_for_file,
get_output,
get_err,
git_ls_files,
filter_changed,
)
import argparse
import colorama
import os
import re
import sys
import colorama
from helpers import (
filter_changed,
get_err,
get_output,
git_ls_files,
print_error_for_file,
styled,
)
curfile = None

View file

@ -1,11 +1,10 @@
#!/usr/bin/env python3
import argparse
from pathlib import Path
import sys
import argparse
from helpers import git_ls_files, changed_files
from esphome.loader import get_component, get_platform
from esphome.core import CORE
from helpers import changed_files, git_ls_files
from esphome.const import (
KEY_CORE,
KEY_TARGET_FRAMEWORK,
@ -13,6 +12,8 @@ from esphome.const import (
PLATFORM_ESP32,
PLATFORM_ESP8266,
)
from esphome.core import CORE
from esphome.loader import get_component, get_platform
def filter_component_files(str):

View file

@ -24,6 +24,33 @@ display:
invert_colors: false
update_interval: never
binary_sensor:
- platform: gpio
internal: true
id: up_button
pin:
number: GPIO38
inverted: true
- platform: gpio
internal: true
id: down_button
pin:
number: GPIO37
inverted: true
- platform: gpio
internal: true
id: select_button
pin:
number: GPIO39
inverted: true
lvgl:
encoders:
group: switches
enter_button: select_button
sensor:
left_button: up_button
right_button: down_button
packages:
lvgl: !include lvgl-package.yaml

View file

@ -67,7 +67,7 @@ lvgl:
displays:
- tft_display
- second_display
rotary_encoders:
encoders:
sensor: encoder
enter_button: pushbutton
group: general