ESPHome
2026.6.0-dev
Loading...
Searching...
No Matches
esphome
components
m5stack_8angle
binary_sensor
m5stack_8angle_binary_sensor.cpp
Go to the documentation of this file.
1
#include "
m5stack_8angle_binary_sensor.h
"
2
3
namespace
esphome::m5stack_8angle
{
4
5
void
M5Stack8AngleSwitchBinarySensor::update
() {
6
int8_t out = this->
parent_
->read_switch();
7
if
(out == -1) {
8
this->
status_set_warning
(LOG_STR(
"Could not read binary sensor state from M5Stack 8Angle."
));
9
return
;
10
}
11
this->
publish_state
(out != 0);
12
this->
status_clear_warning
();
13
}
14
15
}
// namespace esphome::m5stack_8angle
esphome::Component::status_set_warning
void status_set_warning()
Definition
component.cpp:370
esphome::Component::status_clear_warning
void status_clear_warning()
Definition
component.h:289
esphome::Parented< M5Stack8AngleComponent >::parent_
M5Stack8AngleComponent * parent_
Definition
helpers.h:1872
esphome::binary_sensor::BinarySensor::publish_state
void publish_state(bool new_state)
Publish a new state to the front-end.
Definition
binary_sensor.cpp:20
esphome::m5stack_8angle::M5Stack8AngleSwitchBinarySensor::update
void update() override
Definition
m5stack_8angle_binary_sensor.cpp:5
m5stack_8angle_binary_sensor.h
esphome::m5stack_8angle
Definition
m5stack_8angle_binary_sensor.cpp:3
Generated by
1.12.0