mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Merge branch 'dev' into add_gain_setting
This commit is contained in:
commit
acb445f246
10 changed files with 43 additions and 21 deletions
|
@ -70,8 +70,6 @@ def _validate_time_present(config):
|
||||||
|
|
||||||
|
|
||||||
_DATETIME_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(
|
_DATETIME_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(
|
||||||
web_server.WEBSERVER_SORTING_SCHEMA,
|
|
||||||
cv.MQTT_COMMAND_COMPONENT_SCHEMA,
|
|
||||||
cv.Schema(
|
cv.Schema(
|
||||||
{
|
{
|
||||||
cv.Optional(CONF_ON_VALUE): automation.validate_automation(
|
cv.Optional(CONF_ON_VALUE): automation.validate_automation(
|
||||||
|
@ -81,7 +79,9 @@ _DATETIME_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(
|
||||||
),
|
),
|
||||||
cv.Optional(CONF_TIME_ID): cv.use_id(time.RealTimeClock),
|
cv.Optional(CONF_TIME_ID): cv.use_id(time.RealTimeClock),
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
|
.extend(web_server.WEBSERVER_SORTING_SCHEMA)
|
||||||
|
.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA)
|
||||||
).add_extra(_validate_time_present)
|
).add_extra(_validate_time_present)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,10 @@ def _translate_pin(value):
|
||||||
"This variable only supports pin numbers, not full pin schemas "
|
"This variable only supports pin numbers, not full pin schemas "
|
||||||
"(with inverted and mode)."
|
"(with inverted and mode)."
|
||||||
)
|
)
|
||||||
if isinstance(value, int):
|
if isinstance(value, int) and not isinstance(value, bool):
|
||||||
return value
|
return value
|
||||||
|
if not isinstance(value, str):
|
||||||
|
raise cv.Invalid(f"Invalid pin number: {value}")
|
||||||
try:
|
try:
|
||||||
return int(value)
|
return int(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import logging
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from esphome import pins
|
||||||
|
import esphome.codegen as cg
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ANALOG,
|
CONF_ANALOG,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
@ -14,10 +17,7 @@ from esphome.const import (
|
||||||
CONF_PULLUP,
|
CONF_PULLUP,
|
||||||
PLATFORM_ESP8266,
|
PLATFORM_ESP8266,
|
||||||
)
|
)
|
||||||
from esphome import pins
|
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
import esphome.config_validation as cv
|
|
||||||
import esphome.codegen as cg
|
|
||||||
|
|
||||||
from . import boards
|
from . import boards
|
||||||
from .const import KEY_BOARD, KEY_ESP8266, KEY_PIN_INITIAL_STATES, esp8266_ns
|
from .const import KEY_BOARD, KEY_ESP8266, KEY_PIN_INITIAL_STATES, esp8266_ns
|
||||||
|
@ -48,8 +48,10 @@ def _translate_pin(value):
|
||||||
"This variable only supports pin numbers, not full pin schemas "
|
"This variable only supports pin numbers, not full pin schemas "
|
||||||
"(with inverted and mode)."
|
"(with inverted and mode)."
|
||||||
)
|
)
|
||||||
if isinstance(value, int):
|
if isinstance(value, int) and not isinstance(value, bool):
|
||||||
return value
|
return value
|
||||||
|
if not isinstance(value, str):
|
||||||
|
raise cv.Invalid(f"Invalid pin number: {value}")
|
||||||
try:
|
try:
|
||||||
return int(value)
|
return int(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from esphome import pins
|
||||||
|
import esphome.codegen as cg
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_INPUT,
|
CONF_INPUT,
|
||||||
|
@ -11,9 +14,6 @@ from esphome.const import (
|
||||||
CONF_PULLDOWN,
|
CONF_PULLDOWN,
|
||||||
CONF_PULLUP,
|
CONF_PULLUP,
|
||||||
)
|
)
|
||||||
from esphome import pins
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
import esphome.codegen as cg
|
|
||||||
|
|
||||||
from .const import host_ns
|
from .const import host_ns
|
||||||
|
|
||||||
|
@ -28,8 +28,10 @@ def _translate_pin(value):
|
||||||
"This variable only supports pin numbers, not full pin schemas "
|
"This variable only supports pin numbers, not full pin schemas "
|
||||||
"(with inverted and mode)."
|
"(with inverted and mode)."
|
||||||
)
|
)
|
||||||
if isinstance(value, int):
|
if isinstance(value, int) and not isinstance(value, bool):
|
||||||
return value
|
return value
|
||||||
|
if not isinstance(value, str):
|
||||||
|
raise cv.Invalid(f"Invalid pin number: {value}")
|
||||||
try:
|
try:
|
||||||
return int(value)
|
return int(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from esphome import pins
|
||||||
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.const import (
|
from esphome.const import (
|
||||||
CONF_ANALOG,
|
CONF_ANALOG,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
@ -103,8 +103,10 @@ def _translate_pin(value):
|
||||||
"This variable only supports pin numbers, not full pin schemas "
|
"This variable only supports pin numbers, not full pin schemas "
|
||||||
"(with inverted and mode)."
|
"(with inverted and mode)."
|
||||||
)
|
)
|
||||||
if isinstance(value, int):
|
if isinstance(value, int) and not isinstance(value, bool):
|
||||||
return value
|
return value
|
||||||
|
if not isinstance(value, str):
|
||||||
|
raise cv.Invalid(f"Invalid pin number: {value}")
|
||||||
try:
|
try:
|
||||||
return int(value)
|
return int(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -60,9 +60,10 @@ class AnimimgType(WidgetType):
|
||||||
lvgl_components_required.add(CONF_IMAGE)
|
lvgl_components_required.add(CONF_IMAGE)
|
||||||
lvgl_components_required.add(CONF_ANIMIMG)
|
lvgl_components_required.add(CONF_ANIMIMG)
|
||||||
if CONF_SRC in config:
|
if CONF_SRC in config:
|
||||||
for x in config[CONF_SRC]:
|
srcs = [
|
||||||
await cg.get_variable(x)
|
await lv_image.process(await cg.get_variable(x))
|
||||||
srcs = [await lv_image.process(x) for x in config[CONF_SRC]]
|
for x in config[CONF_SRC]
|
||||||
|
]
|
||||||
src_id = cg.static_const_array(config[CONF_SRC_LIST_ID], srcs)
|
src_id = cg.static_const_array(config[CONF_SRC_LIST_ID], srcs)
|
||||||
count = len(config[CONF_SRC])
|
count = len(config[CONF_SRC])
|
||||||
lv.animimg_set_src(w.obj, src_id, count)
|
lv.animimg_set_src(w.obj, src_id, count)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.const import CONF_ANGLE, CONF_MODE
|
from esphome.const import CONF_ANGLE, CONF_MODE
|
||||||
|
|
||||||
|
@ -64,6 +65,7 @@ class ImgType(WidgetType):
|
||||||
|
|
||||||
async def to_code(self, w: Widget, config):
|
async def to_code(self, w: Widget, config):
|
||||||
if src := config.get(CONF_SRC):
|
if src := config.get(CONF_SRC):
|
||||||
|
src = await cg.get_variable(src)
|
||||||
lv.img_set_src(w.obj, await lv_image.process(src))
|
lv.img_set_src(w.obj, await lv_image.process(src))
|
||||||
if (cf_angle := config.get(CONF_ANGLE)) is not None:
|
if (cf_angle := config.get(CONF_ANGLE)) is not None:
|
||||||
pivot_x = config[CONF_PIVOT_X]
|
pivot_x = config[CONF_PIVOT_X]
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
from esphome import pins
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
|
CONF_ANALOG,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_INPUT,
|
CONF_INPUT,
|
||||||
CONF_INVERTED,
|
CONF_INVERTED,
|
||||||
|
@ -10,10 +12,8 @@ from esphome.const import (
|
||||||
CONF_OUTPUT,
|
CONF_OUTPUT,
|
||||||
CONF_PULLDOWN,
|
CONF_PULLDOWN,
|
||||||
CONF_PULLUP,
|
CONF_PULLUP,
|
||||||
CONF_ANALOG,
|
|
||||||
)
|
)
|
||||||
from esphome.core import CORE
|
from esphome.core import CORE
|
||||||
from esphome import pins
|
|
||||||
|
|
||||||
from . import boards
|
from . import boards
|
||||||
from .const import KEY_BOARD, KEY_RP2040, rp2040_ns
|
from .const import KEY_BOARD, KEY_RP2040, rp2040_ns
|
||||||
|
@ -41,8 +41,10 @@ def _translate_pin(value):
|
||||||
"This variable only supports pin numbers, not full pin schemas "
|
"This variable only supports pin numbers, not full pin schemas "
|
||||||
"(with inverted and mode)."
|
"(with inverted and mode)."
|
||||||
)
|
)
|
||||||
if isinstance(value, int):
|
if isinstance(value, int) and not isinstance(value, bool):
|
||||||
return value
|
return value
|
||||||
|
if not isinstance(value, str):
|
||||||
|
raise cv.Invalid(f"Invalid pin number: {value}")
|
||||||
try:
|
try:
|
||||||
return int(value)
|
return int(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -230,6 +230,7 @@ datetime:
|
||||||
id: test_date
|
id: test_date
|
||||||
type: date
|
type: date
|
||||||
state_topic: some/topic/date
|
state_topic: some/topic/date
|
||||||
|
command_topic: test_date/custom_command_topic
|
||||||
qos: 2
|
qos: 2
|
||||||
subscribe_qos: 2
|
subscribe_qos: 2
|
||||||
set_action:
|
set_action:
|
||||||
|
|
|
@ -35,3 +35,11 @@ switch:
|
||||||
web_server:
|
web_server:
|
||||||
sorting_group_id: sorting_group_2
|
sorting_group_id: sorting_group_2
|
||||||
sorting_weight: -10
|
sorting_weight: -10
|
||||||
|
datetime:
|
||||||
|
- platform: template
|
||||||
|
name: Pick a Date
|
||||||
|
type: datetime
|
||||||
|
optimistic: yes
|
||||||
|
web_server:
|
||||||
|
sorting_group_id: sorting_group_3
|
||||||
|
sorting_weight: -5
|
||||||
|
|
Loading…
Reference in a new issue