ESPHome  1.15.3
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::output::OutputSwitch Class Reference

#include <output_switch.h>

Inheritance diagram for esphome::output::OutputSwitch:
esphome::switch_::Switch esphome::Component esphome::Nameable

Public Member Functions

void set_output (BinaryOutput *output)
 
void setup () override
 
float get_setup_priority () const override
 
void dump_config () override
 
- Public Member Functions inherited from esphome::switch_::Switch
 Switch ()
 
 Switch (const std::string &name)
 
void publish_state (bool state)
 Publish a state to the front-end from the back-end. More...
 
void turn_on ()
 Turn this switch on. More...
 
void turn_off ()
 Turn this switch off. More...
 
void toggle ()
 Toggle this switch. More...
 
void set_inverted (bool inverted)
 Set whether the state should be treated as inverted. More...
 
void set_icon (const std::string &icon)
 Set the icon for this switch. "" for no icon. More...
 
std::string get_icon ()
 Get the icon for this switch. Using icon() if not manually set. More...
 
void add_on_state_callback (std::function< void(bool)> &&callback)
 Set callback for state changes. More...
 
optional< bool > get_initial_state ()
 
virtual bool assumed_state ()
 Return whether this switch uses an assumed state - i.e. More...
 
bool is_inverted () const
 
- Public Member Functions inherited from esphome::Nameable
 Nameable ()
 
 Nameable (const std::string &name)
 
const std::string & get_name () const
 
void set_name (const std::string &name)
 
const std::string & get_object_id ()
 Get the sanitized name of this nameable as an ID. Caching it internally. More...
 
uint32_t get_object_id_hash ()
 
bool is_internal () const
 
void set_internal (bool internal)
 
- Public Member Functions inherited from esphome::Component
virtual void loop ()
 This method will be called repeatedly. More...
 
float get_actual_setup_priority () const
 
void set_setup_priority (float priority)
 
virtual float get_loop_priority () const
 priority of loop(). More...
 
void call ()
 
virtual void on_shutdown ()
 
virtual void on_safe_shutdown ()
 
uint32_t get_component_state () const
 
virtual void mark_failed ()
 Mark this component as failed. More...
 
bool is_failed ()
 
virtual bool can_proceed ()
 
bool status_has_warning ()
 
bool status_has_error ()
 
void status_set_warning ()
 
void status_set_error ()
 
void status_clear_warning ()
 
void status_clear_error ()
 
void status_momentary_warning (const std::string &name, uint32_t length=5000)
 
void status_momentary_error (const std::string &name, uint32_t length=5000)
 
bool has_overridden_loop () const
 

Protected Member Functions

void write_state (bool state) override
 
- Protected Member Functions inherited from esphome::switch_::Switch
virtual std::string icon ()
 Override this to set the Home Assistant icon for this switch. More...
 
uint32_t hash_base () override
 
- Protected Member Functions inherited from esphome::Nameable
void calc_object_id_ ()
 
- Protected Member Functions inherited from esphome::Component
virtual void call_loop ()
 
virtual void call_setup ()
 
void set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a unique name. More...
 
void set_interval (uint32_t interval, std::function< void()> &&f)
 
bool cancel_interval (const std::string &name)
 Cancel an interval function. More...
 
void set_timeout (uint32_t timeout, std::function< void()> &&f)
 
void set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a unique name. More...
 
bool cancel_timeout (const std::string &name)
 Cancel a timeout function. More...
 
void defer (const std::string &name, std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
void defer (std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
bool cancel_defer (const std::string &name)
 Cancel a defer callback using the specified name, name must not be empty. More...
 

Protected Attributes

output::BinaryOutputoutput_
 
- Protected Attributes inherited from esphome::switch_::Switch
optional< std::string > icon_ {}
 The icon shown here. Not set means use default from switch. Empty means no icon. More...
 
CallbackManager< void(bool)> state_callback_ {}
 
bool inverted_ {false}
 
Deduplicator< bool > publish_dedup_
 
ESPPreferenceObject rtc_
 
- Protected Attributes inherited from esphome::Nameable
std::string name_
 
std::string object_id_
 
uint32_t object_id_hash_
 
bool internal_ {false}
 
- Protected Attributes inherited from esphome::Component
uint32_t component_state_ {0x0000}
 State of this component. More...
 
float setup_priority_override_ {NAN}
 

Additional Inherited Members

- Data Fields inherited from esphome::switch_::Switch
bool state
 The current reported state of the binary sensor. More...
 

Detailed Description

Definition at line 10 of file output_switch.h.

Member Function Documentation

◆ dump_config()

void esphome::output::OutputSwitch::dump_config ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 9 of file output_switch.cpp.

◆ get_setup_priority()

float esphome::output::OutputSwitch::get_setup_priority ( ) const
inlineoverridevirtual

Reimplemented from esphome::Component.

Definition at line 15 of file output_switch.h.

◆ set_output()

void esphome::output::OutputSwitch::set_output ( BinaryOutput output)
inline

Definition at line 12 of file output_switch.h.

◆ setup()

void esphome::output::OutputSwitch::setup ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 10 of file output_switch.cpp.

◆ write_state()

void esphome::output::OutputSwitch::write_state ( bool  state)
overrideprotectedvirtual

Implements esphome::switch_::Switch.

Definition at line 21 of file output_switch.cpp.

Field Documentation

◆ output_

output::BinaryOutput* esphome::output::OutputSwitch::output_
protected

Definition at line 21 of file output_switch.h.


The documentation for this class was generated from the following files: