ESPHome  2024.3.1
pipsolar_output.cpp
Go to the documentation of this file.
1 #include "pipsolar_output.h"
2 #include "esphome/core/log.h"
3 #include "esphome/core/helpers.h"
4 
5 namespace esphome {
6 namespace pipsolar {
7 
8 static const char *const TAG = "pipsolar.output";
9 
11  char tmp[10];
12  sprintf(tmp, this->set_command_.c_str(), state);
13 
14  if (std::find(this->possible_values_.begin(), this->possible_values_.end(), state) != this->possible_values_.end()) {
15  ESP_LOGD(TAG, "Will write: %s out of value %f / %02.0f", tmp, state, state);
16  this->parent_->switch_command(std::string(tmp));
17  } else {
18  ESP_LOGD(TAG, "Will not write: %s as it is not in list of allowed values", tmp);
19  }
20 }
21 } // namespace pipsolar
22 } // namespace esphome
std::vector< float > possible_values_
void write_state(float state) override
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
bool state
Definition: fan.h:34