ESPHome
2026.11.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
(!this->
status_comm_result
(out != -1, LOG_STR(
"Could not read binary sensor state from M5Stack 8Angle."
)))
8
return
;
9
this->
publish_state
(out != 0);
10
}
11
12
}
// namespace esphome::m5stack_8angle
esphome::Component::status_comm_result
bool status_comm_result(bool ok)
Clears the warning when ok, else sets it with message (default "Communication failed"); returns ok.
Definition
component.cpp:293
esphome::Parented< M5Stack8AngleComponent >::parent_
M5Stack8AngleComponent * parent_
Definition
helpers.h:2084
esphome::binary_sensor::BinarySensor::publish_state
void publish_state(bool new_state)
Publish a new state to the front-end.
Definition
binary_sensor.cpp:18
esphome::m5stack_8angle::M5Stack8AngleSwitchBinarySensor::update
void update() override
Definition
m5stack_8angle_binary_sensor.cpp:5
out
std::vector< uint8_t > & out
Definition
gif.cpp:49
m5stack_8angle_binary_sensor.h
esphome::m5stack_8angle
Definition
m5stack_8angle_binary_sensor.cpp:3
Generated by
1.12.0