1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-15 07:10:33 +01:00

Merge branch 'deep_sleep' into nrf52

This commit is contained in:
Tomasz Duda 2024-05-19 10:57:22 +02:00
commit c4f0510605
3 changed files with 16 additions and 6 deletions

View File

@ -24,7 +24,7 @@ void DeepSleepComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up Deep Sleep...");
global_has_deep_sleep = true;
setup_deep_sleep_();
this->setup_deep_sleep_();
}
void DeepSleepComponent::dump_config() {
@ -36,7 +36,7 @@ void DeepSleepComponent::dump_config() {
if (this->run_duration_.has_value()) {
ESP_LOGCONFIG(TAG, " Run Duration: %" PRIu32 " ms", *this->run_duration_);
}
dump_config_platform_();
this->dump_config_platform_();
}
void DeepSleepComponent::loop() {
@ -58,7 +58,7 @@ void DeepSleepComponent::begin_sleep(bool manual) {
return;
}
if (!prepare_to_sleep_()) {
if (!this->prepare_to_sleep_()) {
return;
}
@ -68,8 +68,8 @@ void DeepSleepComponent::begin_sleep(bool manual) {
}
App.run_safe_shutdown_hooks();
deep_sleep_();
setup_deep_sleep_();
this->deep_sleep_();
this->setup_deep_sleep_();
}
float DeepSleepComponent::get_setup_priority() const { return setup_priority::LATE; }

View File

@ -14,6 +14,9 @@ from esphome.const import (
CONF_STATE,
CONF_STOP,
CONF_TRIGGER_ID,
DEVICE_CLASS_EMPTY,
DEVICE_CLASS_GAS,
DEVICE_CLASS_WATER,
)
from esphome.core import CORE, coroutine_with_priority
from esphome.cpp_helpers import setup_entity
@ -22,6 +25,12 @@ IS_PLATFORM_COMPONENT = True
CODEOWNERS = ["@esphome/core"]
DEVICE_CLASSES = [
DEVICE_CLASS_EMPTY,
DEVICE_CLASS_GAS,
DEVICE_CLASS_WATER,
]
valve_ns = cg.esphome_ns.namespace("valve")
Valve = valve_ns.class_("Valve", cg.EntityBase)
@ -65,6 +74,7 @@ VALVE_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(cv.MQTT_COMMAND_COMPONENT_SCHEMA).ex
{
cv.GenerateID(): cv.declare_id(Valve),
cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(mqtt.MQTTValveComponent),
cv.Optional(CONF_DEVICE_CLASS): cv.one_of(*DEVICE_CLASSES, lower=True),
cv.Optional(CONF_POSITION_COMMAND_TOPIC): cv.All(
cv.requires_component("mqtt"), cv.subscribe_topic
),

View File

@ -20,7 +20,7 @@ fi
pip3 install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt -r requirements_dev.txt
pip3 install setuptools wheel
pip3 install -e --config-settings editable_mode=compat ".[dev,test,displays]"
pip3 install -e ".[dev,test,displays]" --config-settings editable_mode=compat
pre-commit install