Merge branch 'dev' of https://github.com/esphome/esphome into custom_ble_server_111

This commit is contained in:
clydebarrow 2024-11-05 09:58:05 +11:00
commit 116d1e68a7
8 changed files with 37 additions and 18 deletions

View file

@ -70,8 +70,6 @@ def _validate_time_present(config):
_DATETIME_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(
web_server.WEBSERVER_SORTING_SCHEMA,
cv.MQTT_COMMAND_COMPONENT_SCHEMA,
cv.Schema(
{
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),
}
),
)
.extend(web_server.WEBSERVER_SORTING_SCHEMA)
.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA)
).add_extra(_validate_time_present)

View file

@ -67,8 +67,10 @@ def _translate_pin(value):
"This variable only supports pin numbers, not full pin schemas "
"(with inverted and mode)."
)
if isinstance(value, int):
if isinstance(value, int) and not isinstance(value, bool):
return value
if not isinstance(value, str):
raise cv.Invalid(f"Invalid pin number: {value}")
try:
return int(value)
except ValueError:

View file

@ -1,6 +1,9 @@
import logging
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 (
CONF_ANALOG,
CONF_ID,
@ -14,10 +17,7 @@ from esphome.const import (
CONF_PULLUP,
PLATFORM_ESP8266,
)
from esphome import pins
from esphome.core import CORE, coroutine_with_priority
import esphome.config_validation as cv
import esphome.codegen as cg
from . import boards
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 "
"(with inverted and mode)."
)
if isinstance(value, int):
if isinstance(value, int) and not isinstance(value, bool):
return value
if not isinstance(value, str):
raise cv.Invalid(f"Invalid pin number: {value}")
try:
return int(value)
except ValueError:

View file

@ -1,5 +1,8 @@
import logging
from esphome import pins
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.const import (
CONF_ID,
CONF_INPUT,
@ -11,9 +14,6 @@ from esphome.const import (
CONF_PULLDOWN,
CONF_PULLUP,
)
from esphome import pins
import esphome.config_validation as cv
import esphome.codegen as cg
from .const import host_ns
@ -28,8 +28,10 @@ def _translate_pin(value):
"This variable only supports pin numbers, not full pin schemas "
"(with inverted and mode)."
)
if isinstance(value, int):
if isinstance(value, int) and not isinstance(value, bool):
return value
if not isinstance(value, str):
raise cv.Invalid(f"Invalid pin number: {value}")
try:
return int(value)
except ValueError:

View file

@ -1,8 +1,8 @@
import logging
from esphome import pins
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.const import (
CONF_ANALOG,
CONF_ID,
@ -103,8 +103,10 @@ def _translate_pin(value):
"This variable only supports pin numbers, not full pin schemas "
"(with inverted and mode)."
)
if isinstance(value, int):
if isinstance(value, int) and not isinstance(value, bool):
return value
if not isinstance(value, str):
raise cv.Invalid(f"Invalid pin number: {value}")
try:
return int(value)
except ValueError:

View file

@ -1,6 +1,8 @@
from esphome import pins
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.const import (
CONF_ANALOG,
CONF_ID,
CONF_INPUT,
CONF_INVERTED,
@ -10,10 +12,8 @@ from esphome.const import (
CONF_OUTPUT,
CONF_PULLDOWN,
CONF_PULLUP,
CONF_ANALOG,
)
from esphome.core import CORE
from esphome import pins
from . import boards
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 "
"(with inverted and mode)."
)
if isinstance(value, int):
if isinstance(value, int) and not isinstance(value, bool):
return value
if not isinstance(value, str):
raise cv.Invalid(f"Invalid pin number: {value}")
try:
return int(value)
except ValueError:

View file

@ -230,6 +230,7 @@ datetime:
id: test_date
type: date
state_topic: some/topic/date
command_topic: test_date/custom_command_topic
qos: 2
subscribe_qos: 2
set_action:

View file

@ -35,3 +35,11 @@ switch:
web_server:
sorting_group_id: sorting_group_2
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