mirror of
https://github.com/esphome/esphome.git
synced 2024-11-07 09:31:10 +01:00
commit
9922c1503a
@ -11,6 +11,7 @@ from esphome.const import (
|
||||
CONF_VOLTAGE_ATTENUATION,
|
||||
)
|
||||
from esphome.core import TimePeriod
|
||||
from esphome.components import esp32
|
||||
|
||||
AUTO_LOAD = ["binary_sensor"]
|
||||
DEPENDENCIES = ["esp32"]
|
||||
@ -50,30 +51,37 @@ VOLTAGE_ATTENUATION = {
|
||||
"0V": cg.global_ns.TOUCH_HVOLT_ATTEN_0V,
|
||||
}
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(ESP32TouchComponent),
|
||||
cv.Optional(CONF_SETUP_MODE, default=False): cv.boolean,
|
||||
cv.Optional(
|
||||
CONF_IIR_FILTER, default="0ms"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.Optional(CONF_SLEEP_DURATION, default="27306us"): cv.All(
|
||||
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=436906))
|
||||
),
|
||||
cv.Optional(CONF_MEASUREMENT_DURATION, default="8192us"): cv.All(
|
||||
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=8192))
|
||||
),
|
||||
cv.Optional(CONF_LOW_VOLTAGE_REFERENCE, default="0.5V"): validate_voltage(
|
||||
LOW_VOLTAGE_REFERENCE
|
||||
),
|
||||
cv.Optional(CONF_HIGH_VOLTAGE_REFERENCE, default="2.7V"): validate_voltage(
|
||||
HIGH_VOLTAGE_REFERENCE
|
||||
),
|
||||
cv.Optional(CONF_VOLTAGE_ATTENUATION, default="0V"): validate_voltage(
|
||||
VOLTAGE_ATTENUATION
|
||||
),
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(ESP32TouchComponent),
|
||||
cv.Optional(CONF_SETUP_MODE, default=False): cv.boolean,
|
||||
cv.Optional(
|
||||
CONF_IIR_FILTER, default="0ms"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.Optional(CONF_SLEEP_DURATION, default="27306us"): cv.All(
|
||||
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=436906))
|
||||
),
|
||||
cv.Optional(CONF_MEASUREMENT_DURATION, default="8192us"): cv.All(
|
||||
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=8192))
|
||||
),
|
||||
cv.Optional(CONF_LOW_VOLTAGE_REFERENCE, default="0.5V"): validate_voltage(
|
||||
LOW_VOLTAGE_REFERENCE
|
||||
),
|
||||
cv.Optional(CONF_HIGH_VOLTAGE_REFERENCE, default="2.7V"): validate_voltage(
|
||||
HIGH_VOLTAGE_REFERENCE
|
||||
),
|
||||
cv.Optional(CONF_VOLTAGE_ATTENUATION, default="0V"): validate_voltage(
|
||||
VOLTAGE_ATTENUATION
|
||||
),
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA),
|
||||
esp32.only_on_variant(
|
||||
supported=[
|
||||
esp32.const.VARIANT_ESP32,
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
|
@ -477,7 +477,6 @@ void Sprinkler::configure_valve_switch(size_t valve_number, switch_::Switch *val
|
||||
if (this->is_a_valid_valve(valve_number)) {
|
||||
this->valve_[valve_number].valve_switch.set_on_switch(valve_switch);
|
||||
this->valve_[valve_number].run_duration = run_duration;
|
||||
valve_switch->turn_off();
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,8 +488,6 @@ void Sprinkler::configure_valve_switch_pulsed(size_t valve_number, switch_::Swit
|
||||
this->valve_[valve_number].valve_switch.set_on_switch(valve_switch_on);
|
||||
this->valve_[valve_number].valve_switch.set_pulse_duration(pulse_duration);
|
||||
this->valve_[valve_number].run_duration = run_duration;
|
||||
valve_switch_off->turn_off();
|
||||
valve_switch_on->turn_off();
|
||||
}
|
||||
}
|
||||
|
||||
@ -505,7 +502,6 @@ void Sprinkler::configure_valve_pump_switch(size_t valve_number, switch_::Switch
|
||||
this->pump_.resize(this->pump_.size() + 1);
|
||||
this->pump_.back().set_on_switch(pump_switch);
|
||||
this->valve_[valve_number].pump_switch_index = this->pump_.size() - 1; // save the index to the new pump
|
||||
pump_switch->turn_off();
|
||||
}
|
||||
}
|
||||
|
||||
@ -524,8 +520,6 @@ void Sprinkler::configure_valve_pump_switch_pulsed(size_t valve_number, switch_:
|
||||
this->pump_.back().set_on_switch(pump_switch_on);
|
||||
this->pump_.back().set_pulse_duration(pulse_duration);
|
||||
this->valve_[valve_number].pump_switch_index = this->pump_.size() - 1; // save the index to the new pump
|
||||
pump_switch_off->turn_off();
|
||||
pump_switch_on->turn_off();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ class SprinklerControllerNumber : public number::Number, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
float get_setup_priority() const override { return setup_priority::HARDWARE; }
|
||||
float get_setup_priority() const override { return setup_priority::PROCESSOR; }
|
||||
|
||||
Trigger<float> *get_set_trigger() const { return set_trigger_; }
|
||||
void set_initial_value(float initial_value) { initial_value_ = initial_value; }
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "2023.3.0b4"
|
||||
__version__ = "2023.3.0b5"
|
||||
|
||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user