ESPHome  2024.9.0
m5stack_8angle_binary_sensor.cpp
Go to the documentation of this file.
2 
3 namespace esphome {
4 namespace m5stack_8angle {
5 
7  int8_t out = this->parent_->read_switch();
8  if (out == -1) {
9  this->status_set_warning("Could not read binary sensor state from M5Stack 8Angle.");
10  return;
11  }
12  this->publish_state(out != 0);
13  this->status_clear_warning();
14 }
15 
16 } // namespace m5stack_8angle
17 } // namespace esphome
void status_set_warning(const char *message="unspecified")
Definition: component.cpp:151
M5Stack8AngleComponent * parent_
Definition: helpers.h:532
void status_clear_warning()
Definition: component.cpp:166
void publish_state(bool state)
Publish a new state to the front-end.
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7