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);
60 LOG_VALVE(
"",
"Template Valve",
this);
68 if (
call.get_stop()) {
81 auto pos = *
call.get_position();
105 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 trigger(const Ts &...x)
Inform the parent automation that the event has triggered.
void stop_action()
Stop any action connected to this trigger.
void set_optimistic(bool optimistic)
Trigger * get_stop_trigger()
Trigger * get_open_trigger()
Trigger * get_toggle_trigger()
float get_setup_priority() const override
void set_has_stop(bool has_stop)
void set_has_position(bool has_position)
Trigger< float > position_trigger_
void set_assumed_state(bool assumed_state)
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
void set_has_toggle(bool has_toggle)
Trigger * prev_command_trigger_
Trigger< float > * get_position_trigger()
const optional< bool > & get_toggle() const
const optional< float > & get_position() 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).
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.