9 static const char *
const TAG =
"switch.hbridge";
13 ESP_LOGCONFIG(TAG,
"Setting up H-Bridge Switch '%s'...", this->
name_.
c_str());
26 if (initial_state.has_value())
31 LOG_SWITCH(
"",
"H-Bridge Switch",
this);
32 LOG_PIN(
" On Pin: ", this->
on_pin_);
33 LOG_PIN(
" Off Pin: ", this->
off_pin_);
34 ESP_LOGCONFIG(TAG,
" Pulse length: %" PRId32
" ms", this->
pulse_length_);
36 ESP_LOGCONFIG(TAG,
" Wait time %" PRId32
" ms", this->
wait_time_);
46 uint32_t next_timeout = 0;
virtual void digital_write(bool value)=0
void set_timeout(const std::string &name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
void dump_config() override
float get_setup_priority() const override
optional< bool > get_initial_state_with_restore_mode()
Returns the initial state of the switch, after applying restore mode rules.
void write_state(bool state) override
constexpr const char * c_str() const
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Implementation of SPI Controller mode.
void publish_state(bool state)
Publish a state to the front-end from the back-end.
bool state
The current reported state of the binary sensor.
value_type value_or(U const &v) const