8static const char *
const TAG =
"template.valve";
18 if (restore.has_value())
24 if (restore.has_value()) {
25 restore->to_call(
this).perform();
39 auto pos = clamp(*s, 0.0f, 1.0f);
58 LOG_VALVE(
"",
"Template Valve",
this);
66 if (
call.get_stop()) {
78 auto pos_val =
call.get_position();
79 if (pos_val.has_value()) {
104 traits.set_supports_stop(this->
has_stop_);
void disable_loop()
Disable this component's loop.
bool has_value() const
Check if a lambda is set.
void stop_action()
Stop any action connected to this trigger.
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
Trigger * get_stop_trigger()
Trigger * get_open_trigger()
Trigger * get_toggle_trigger()
float get_setup_priority() const override
Trigger< float > position_trigger_
void stop_prev_trigger_()
TemplateLambda< float > state_f_
Trigger * get_close_trigger()
valve::ValveTraits get_traits() override
void control(const valve::ValveCall &call) override
TemplateValveRestoreMode restore_mode_
void dump_config() override
Trigger * prev_command_trigger_
Trigger< float > * get_position_trigger()
const optional< bool > & get_toggle() const
optional< ValveRestoreState > restore_state_()
void publish_state(bool save=true)
Publish the current state of the valve.
float position
The position of the valve from 0.0 (fully closed) to 1.0 (fully open).
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.