Consolidate CONF_RAW_DATA_ID to const.py (#2491)

This commit is contained in:
Dave T 2021-10-11 23:14:04 +01:00 committed by GitHub
parent d7ad155885
commit 04ec1c8b56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 8 deletions

View file

@ -5,7 +5,7 @@ from esphome.components import display, font
import esphome.components.image as espImage import esphome.components.image as espImage
import esphome.config_validation as cv import esphome.config_validation as cv
import esphome.codegen as cg import esphome.codegen as cg
from esphome.const import CONF_FILE, CONF_ID, CONF_TYPE, CONF_RESIZE from esphome.const import CONF_FILE, CONF_ID, CONF_RAW_DATA_ID, CONF_RESIZE, CONF_TYPE
from esphome.core import CORE, HexInt from esphome.core import CORE, HexInt
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -15,8 +15,6 @@ MULTI_CONF = True
Animation_ = display.display_ns.class_("Animation") Animation_ = display.display_ns.class_("Animation")
CONF_RAW_DATA_ID = "raw_data_id"
ANIMATION_SCHEMA = cv.Schema( ANIMATION_SCHEMA = cv.Schema(
{ {
cv.Required(CONF_ID): cv.declare_id(Animation_), cv.Required(CONF_ID): cv.declare_id(Animation_),

View file

@ -4,7 +4,7 @@ from esphome import core
from esphome.components import display from esphome.components import display
import esphome.config_validation as cv import esphome.config_validation as cv
import esphome.codegen as cg import esphome.codegen as cg
from esphome.const import CONF_FILE, CONF_GLYPHS, CONF_ID, CONF_SIZE from esphome.const import CONF_FILE, CONF_GLYPHS, CONF_ID, CONF_RAW_DATA_ID, CONF_SIZE
from esphome.core import CORE, HexInt from esphome.core import CORE, HexInt
DEPENDENCIES = ["display"] DEPENDENCIES = ["display"]
@ -74,7 +74,6 @@ def validate_truetype_file(value):
DEFAULT_GLYPHS = ( DEFAULT_GLYPHS = (
' !"%()+=,-.:/0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz°' ' !"%()+=,-.:/0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz°'
) )
CONF_RAW_DATA_ID = "raw_data_id"
CONF_RAW_GLYPH_ID = "raw_glyph_id" CONF_RAW_GLYPH_ID = "raw_glyph_id"
FONT_SCHEMA = cv.Schema( FONT_SCHEMA = cv.Schema(

View file

@ -4,7 +4,14 @@ from esphome import core
from esphome.components import display, font from esphome.components import display, font
import esphome.config_validation as cv import esphome.config_validation as cv
import esphome.codegen as cg import esphome.codegen as cg
from esphome.const import CONF_FILE, CONF_ID, CONF_TYPE, CONF_RESIZE, CONF_DITHER from esphome.const import (
CONF_DITHER,
CONF_FILE,
CONF_ID,
CONF_RAW_DATA_ID,
CONF_RESIZE,
CONF_TYPE,
)
from esphome.core import CORE, HexInt from esphome.core import CORE, HexInt
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -21,8 +28,6 @@ IMAGE_TYPE = {
Image_ = display.display_ns.class_("Image") Image_ = display.display_ns.class_("Image")
CONF_RAW_DATA_ID = "raw_data_id"
IMAGE_SCHEMA = cv.Schema( IMAGE_SCHEMA = cv.Schema(
{ {
cv.Required(CONF_ID): cv.declare_id(Image_), cv.Required(CONF_ID): cv.declare_id(Image_),

View file

@ -533,6 +533,7 @@ CONF_RANGE_FROM = "range_from"
CONF_RANGE_TO = "range_to" CONF_RANGE_TO = "range_to"
CONF_RATE = "rate" CONF_RATE = "rate"
CONF_RAW = "raw" CONF_RAW = "raw"
CONF_RAW_DATA_ID = "raw_data_id"
CONF_RC_CODE_1 = "rc_code_1" CONF_RC_CODE_1 = "rc_code_1"
CONF_RC_CODE_2 = "rc_code_2" CONF_RC_CODE_2 = "rc_code_2"
CONF_REACTIVE_POWER = "reactive_power" CONF_REACTIVE_POWER = "reactive_power"