mirror of
https://github.com/esphome/esphome.git
synced 2026-10-14 10:12:52 +00:00
[tuya] Add forced minute boundary time sync (#18603)
Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: J. Nick Koston <nick@home-assistant.io>
This commit is contained in:
co-authored by
J. Nick Koston
pre-commit-ci-lite[bot]
J. Nick Koston
parent
2681126986
commit
1402cb7b64
@@ -0,0 +1,23 @@
|
||||
"""Tests for Tuya time synchronization configuration validation."""
|
||||
|
||||
import pytest
|
||||
|
||||
from esphome import config_validation as cv
|
||||
from esphome.components.tuya import CONF_FORCE_TIME_SYNC, CONFIG_SCHEMA
|
||||
from esphome.const import CONF_TIME_ID
|
||||
|
||||
|
||||
def test_force_time_sync_accepts_time_id() -> None:
|
||||
config = CONFIG_SCHEMA(
|
||||
{
|
||||
CONF_FORCE_TIME_SYNC: True,
|
||||
CONF_TIME_ID: "tuya_time",
|
||||
}
|
||||
)
|
||||
|
||||
assert config[CONF_FORCE_TIME_SYNC] is True
|
||||
|
||||
|
||||
def test_force_time_sync_requires_time_id() -> None:
|
||||
with pytest.raises(cv.Invalid, match="force_time_sync requires time_id"):
|
||||
CONFIG_SCHEMA({CONF_FORCE_TIME_SYNC: True})
|
||||
@@ -0,0 +1,16 @@
|
||||
substitutions:
|
||||
tx_pin: GPIO4
|
||||
rx_pin: GPIO5
|
||||
status_pin: GPIO12
|
||||
|
||||
packages:
|
||||
uart: !include ../../test_build_components/common/uart/esp32-idf.yaml
|
||||
common: !include common.yaml
|
||||
|
||||
time:
|
||||
- platform: sntp
|
||||
id: tuya_time
|
||||
|
||||
tuya:
|
||||
time_id: tuya_time
|
||||
force_time_sync: true
|
||||
Reference in New Issue
Block a user