mirror of
https://github.com/esphome/esphome.git
synced 2024-11-16 10:45:48 +01:00
Merge branch 'dev' into nrf52
This commit is contained in:
commit
8234c45194
2
.github/workflows/ci-api-proto.yml
vendored
2
.github/workflows/ci-api-proto.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.0
|
||||
with:
|
||||
|
2
.github/workflows/ci-docker.yml
vendored
2
.github/workflows/ci-docker.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
||||
arch: [amd64, armv7, aarch64]
|
||||
build_type: ["ha-addon", "docker", "lint"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.0
|
||||
with:
|
||||
|
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
@ -34,7 +34,7 @@ jobs:
|
||||
cache-key: ${{ steps.cache-key.outputs.key }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Generate cache-key
|
||||
id: cache-key
|
||||
run: echo key="${{ hashFiles('requirements.txt', 'requirements_optional.txt', 'requirements_test.txt') }}" >> $GITHUB_OUTPUT
|
||||
@ -66,7 +66,7 @@ jobs:
|
||||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -87,7 +87,7 @@ jobs:
|
||||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -108,7 +108,7 @@ jobs:
|
||||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -129,7 +129,7 @@ jobs:
|
||||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -150,7 +150,7 @@ jobs:
|
||||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -199,7 +199,7 @@ jobs:
|
||||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -229,7 +229,7 @@ jobs:
|
||||
- common
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -254,7 +254,7 @@ jobs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Find all YAML test files
|
||||
id: set-matrix
|
||||
run: echo "matrix=$(ls tests/test*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
|
||||
@ -271,7 +271,7 @@ jobs:
|
||||
file: ${{ fromJson(needs.compile-tests-list.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -303,7 +303,7 @@ jobs:
|
||||
file: ${{ fromJson(needs.compile-tests-list.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -358,7 +358,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -402,7 +402,7 @@ jobs:
|
||||
count: ${{ steps.list-components.outputs.count }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
with:
|
||||
# Fetch enough history so `git merge-base refs/remotes/origin/dev HEAD` works.
|
||||
fetch-depth: 500
|
||||
@ -450,7 +450,7 @@ jobs:
|
||||
run: sudo apt-get install libsodium-dev
|
||||
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
@ -476,7 +476,7 @@ jobs:
|
||||
matrix: ${{ steps.split.outputs.components }}
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Split components into 20 groups
|
||||
id: split
|
||||
run: |
|
||||
@ -504,7 +504,7 @@ jobs:
|
||||
run: sudo apt-get install libsodium-dev
|
||||
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Restore Python
|
||||
uses: ./.github/actions/restore-python
|
||||
with:
|
||||
|
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
||||
tag: ${{ steps.tag.outputs.tag }}
|
||||
branch_build: ${{ steps.tag.outputs.branch_build }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Get tag
|
||||
id: tag
|
||||
# yamllint disable rule:line-length
|
||||
@ -51,7 +51,7 @@ jobs:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.0
|
||||
with:
|
||||
@ -81,7 +81,7 @@ jobs:
|
||||
- linux/arm/v7
|
||||
- linux/arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.0
|
||||
with:
|
||||
@ -159,7 +159,7 @@ jobs:
|
||||
- ghcr
|
||||
- dockerhub
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.1
|
||||
- uses: actions/checkout@v4.1.5
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@v3.0.2
|
||||
with:
|
||||
|
4
.github/workflows/sync-device-classes.yml
vendored
4
.github/workflows/sync-device-classes.yml
vendored
@ -13,10 +13,10 @@ jobs:
|
||||
if: github.repository == 'esphome/esphome'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
|
||||
- name: Checkout Home Assistant
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
with:
|
||||
repository: home-assistant/core
|
||||
path: lib/home-assistant
|
||||
|
2
.github/workflows/yaml-lint.yml
vendored
2
.github/workflows/yaml-lint.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@v4.1.5
|
||||
- name: Run yamllint
|
||||
uses: frenck/action-yamllint@v1.5.0
|
||||
with:
|
||||
|
@ -169,7 +169,7 @@ async def to_code(config):
|
||||
{
|
||||
cv.Required(CONF_ID): cv.use_id(DateEntity),
|
||||
cv.Required(CONF_DATE): cv.Any(
|
||||
cv.returning_lambda, cv.date_time(allowed_time=False)
|
||||
cv.returning_lambda, cv.date_time(date=True, time=False)
|
||||
),
|
||||
}
|
||||
),
|
||||
@ -200,7 +200,7 @@ async def datetime_date_set_to_code(config, action_id, template_arg, args):
|
||||
{
|
||||
cv.Required(CONF_ID): cv.use_id(TimeEntity),
|
||||
cv.Required(CONF_TIME): cv.Any(
|
||||
cv.returning_lambda, cv.date_time(allowed_date=False)
|
||||
cv.returning_lambda, cv.date_time(date=False, time=True)
|
||||
),
|
||||
}
|
||||
),
|
||||
@ -230,7 +230,9 @@ async def datetime_time_set_to_code(config, action_id, template_arg, args):
|
||||
cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_ID): cv.use_id(DateTimeEntity),
|
||||
cv.Required(CONF_DATETIME): cv.Any(cv.returning_lambda, cv.date_time()),
|
||||
cv.Required(CONF_DATETIME): cv.Any(
|
||||
cv.returning_lambda, cv.date_time(date=True, time=True)
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
@ -72,21 +72,25 @@ CONFIG_SCHEMA = cv.All(
|
||||
.extend(_BASE_SCHEMA)
|
||||
.extend(
|
||||
{
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(allowed_time=False),
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(
|
||||
date=True, time=False
|
||||
),
|
||||
}
|
||||
),
|
||||
"TIME": datetime.time_schema(TemplateTime)
|
||||
.extend(_BASE_SCHEMA)
|
||||
.extend(
|
||||
{
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(allowed_date=False),
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(
|
||||
date=False, time=True
|
||||
),
|
||||
}
|
||||
),
|
||||
"DATETIME": datetime.datetime_schema(TemplateDateTime)
|
||||
.extend(_BASE_SCHEMA)
|
||||
.extend(
|
||||
{
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(),
|
||||
cv.Optional(CONF_INITIAL_VALUE): cv.date_time(date=True, time=True),
|
||||
}
|
||||
),
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_DATETIME_TIME
|
||||
#ifdef USE_DATETIME_DATETIME
|
||||
|
||||
#include "esphome/components/datetime/datetime_entity.h"
|
||||
#include "esphome/core/automation.h"
|
||||
@ -43,4 +43,4 @@ class TemplateDateTime : public datetime::DateTimeEntity, public PollingComponen
|
||||
} // namespace template_
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_DATETIME_TIME
|
||||
#endif // USE_DATETIME_DATETIME
|
||||
|
@ -37,4 +37,4 @@ async def to_code(config):
|
||||
cg.add_library("FS", None)
|
||||
cg.add_library("Update", None)
|
||||
# https://github.com/esphome/ESPAsyncWebServer/blob/master/library.json
|
||||
cg.add_library("esphome/ESPAsyncWebServer-esphome", "3.1.0")
|
||||
cg.add_library("esphome/ESPAsyncWebServer-esphome", "3.2.0")
|
||||
|
@ -694,7 +694,7 @@ void WiFiComponent::retry_connect() {
|
||||
}
|
||||
|
||||
bool WiFiComponent::can_proceed() {
|
||||
if (!this->has_sta() || this->state_ == WIFI_COMPONENT_STATE_DISABLED) {
|
||||
if (!this->has_sta() || this->state_ == WIFI_COMPONENT_STATE_DISABLED || this->ap_setup_) {
|
||||
return true;
|
||||
}
|
||||
return this->is_connected();
|
||||
|
@ -824,57 +824,50 @@ positive_not_null_time_period = All(
|
||||
|
||||
|
||||
def time_of_day(value):
|
||||
return date_time(allowed_date=False, allowed_time=True)(value)
|
||||
return date_time(date=False, time=True)(value)
|
||||
|
||||
|
||||
def date_time(allowed_date: bool = True, allowed_time: bool = True):
|
||||
def date_time(date: bool, time: bool):
|
||||
|
||||
pattern_str = r"^" # Start of string
|
||||
if allowed_date:
|
||||
if date:
|
||||
pattern_str += r"\d{4}-\d{1,2}-\d{1,2}"
|
||||
if time:
|
||||
pattern_str += r" "
|
||||
if time:
|
||||
pattern_str += (
|
||||
r"(" # 1. Optional Date group
|
||||
r"\d{4}-\d{1,2}-\d{1,2}" # Date
|
||||
r"(?:\s(?=.+))?" # Space after date only if time is following
|
||||
r")?" # End optional Date group
|
||||
)
|
||||
if allowed_time:
|
||||
pattern_str += (
|
||||
r"(" # 2. Optional Time group
|
||||
r"(\d{1,2}:\d{2})" # 3. Hour/Minute
|
||||
r"(:\d{2})?" # 4. Seconds
|
||||
r"(" # 5. Optional AM/PM group
|
||||
r"(\s)?" # 6. Optional Space
|
||||
r"\d{1,2}:\d{2}" # Hour/Minute
|
||||
r"(:\d{2})?" # 1. Seconds
|
||||
r"(" # 2. Optional AM/PM group
|
||||
r"(\s)?" # 3. Optional Space
|
||||
r"(?:AM|PM|am|pm)" # AM/PM string matching
|
||||
r")?" # End optional AM/PM group
|
||||
r")?" # End optional Time group
|
||||
)
|
||||
pattern_str += r"$" # End of string
|
||||
|
||||
pattern = re.compile(pattern_str)
|
||||
|
||||
exc_message = ""
|
||||
if allowed_date:
|
||||
if date:
|
||||
exc_message += "date"
|
||||
if allowed_time:
|
||||
exc_message += "/"
|
||||
if allowed_time:
|
||||
if time:
|
||||
exc_message += "time"
|
||||
|
||||
schema = Schema({})
|
||||
if allowed_date:
|
||||
if date:
|
||||
schema = schema.extend(
|
||||
{
|
||||
Optional(CONF_YEAR): int_range(min=1970, max=3000),
|
||||
Optional(CONF_MONTH): int_range(min=1, max=12),
|
||||
Optional(CONF_DAY): int_range(min=1, max=31),
|
||||
Required(CONF_YEAR): int_range(min=1970, max=3000),
|
||||
Required(CONF_MONTH): int_range(min=1, max=12),
|
||||
Required(CONF_DAY): int_range(min=1, max=31),
|
||||
}
|
||||
)
|
||||
if allowed_time:
|
||||
if time:
|
||||
schema = schema.extend(
|
||||
{
|
||||
Optional(CONF_HOUR): int_range(min=0, max=23),
|
||||
Optional(CONF_MINUTE): int_range(min=0, max=59),
|
||||
Optional(CONF_SECOND): int_range(min=0, max=59),
|
||||
Required(CONF_HOUR): int_range(min=0, max=23),
|
||||
Required(CONF_MINUTE): int_range(min=0, max=59),
|
||||
Required(CONF_SECOND): int_range(min=0, max=59),
|
||||
}
|
||||
)
|
||||
|
||||
@ -888,21 +881,21 @@ def date_time(allowed_date: bool = True, allowed_time: bool = True):
|
||||
# pylint: disable=raise-missing-from
|
||||
raise Invalid(f"Invalid {exc_message}: {value}")
|
||||
|
||||
if allowed_date:
|
||||
has_date = match[1] is not None
|
||||
if allowed_time:
|
||||
has_time = match[2] is not None
|
||||
has_seconds = match[3] is not None
|
||||
has_ampm = match[4] is not None
|
||||
has_ampm_space = match[5] is not None
|
||||
if time:
|
||||
has_seconds = match[1] is not None
|
||||
has_ampm = match[2] is not None
|
||||
has_ampm_space = match[3] is not None
|
||||
|
||||
format = ""
|
||||
if allowed_date and has_date:
|
||||
if date:
|
||||
format += "%Y-%m-%d"
|
||||
if allowed_time and has_time:
|
||||
if time:
|
||||
format += " "
|
||||
if allowed_time and has_time:
|
||||
format += "%H:%M"
|
||||
if time:
|
||||
if has_ampm:
|
||||
format += "%I:%M"
|
||||
else:
|
||||
format += "%H:%M"
|
||||
if has_seconds:
|
||||
format += ":%S"
|
||||
if has_ampm_space:
|
||||
@ -917,12 +910,12 @@ def date_time(allowed_date: bool = True, allowed_time: bool = True):
|
||||
raise Invalid(f"Invalid {exc_message}: {err}")
|
||||
|
||||
return_value = {}
|
||||
if allowed_date and has_date:
|
||||
if date:
|
||||
return_value[CONF_YEAR] = date_obj.year
|
||||
return_value[CONF_MONTH] = date_obj.month
|
||||
return_value[CONF_DAY] = date_obj.day
|
||||
|
||||
if allowed_time and has_time:
|
||||
if time:
|
||||
return_value[CONF_HOUR] = date_obj.hour
|
||||
return_value[CONF_MINUTE] = date_obj.minute
|
||||
return_value[CONF_SECOND] = date_obj.second if has_seconds else 0
|
||||
|
@ -58,7 +58,7 @@ lib_deps =
|
||||
SPI ; spi (Arduino built-in)
|
||||
Wire ; i2c (Arduino built-int)
|
||||
heman/AsyncMqttClient-esphome@1.0.0 ; mqtt
|
||||
esphome/ESPAsyncWebServer-esphome@2.1.0 ; web_server_base
|
||||
esphome/ESPAsyncWebServer-esphome@3.2.0 ; web_server_base
|
||||
fastled/FastLED@3.3.2 ; fastled_base
|
||||
mikalhart/TinyGPSPlus@1.0.2 ; gps
|
||||
freekode/TM1651@1.0.1 ; tm1651
|
||||
|
@ -172,6 +172,7 @@ datetime:
|
||||
name: Date
|
||||
id: test_date
|
||||
type: date
|
||||
initial_value: "2000-1-2"
|
||||
set_action:
|
||||
- logger.log: "set_value"
|
||||
on_value:
|
||||
@ -185,6 +186,7 @@ datetime:
|
||||
name: Time
|
||||
id: test_time
|
||||
type: time
|
||||
initial_value: "12:34:56am"
|
||||
set_action:
|
||||
- logger.log: "set_value"
|
||||
on_value:
|
||||
@ -198,6 +200,7 @@ datetime:
|
||||
name: DateTime
|
||||
id: test_datetime
|
||||
type: datetime
|
||||
initial_value: "2000-1-2 12:34:56"
|
||||
set_action:
|
||||
- logger.log: "set_value"
|
||||
on_value:
|
||||
|
Loading…
Reference in New Issue
Block a user