ESPHome
2022.6.2
esphome
esphome
components
binary_sensor_map
binary_sensor_map.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/components/binary_sensor/binary_sensor.h
"
5
#include "
esphome/components/sensor/sensor.h
"
6
7
namespace
esphome
{
8
namespace
binary_sensor_map {
9
10
enum
BinarySensorMapType
{
11
BINARY_SENSOR_MAP_TYPE_GROUP
,
12
};
13
14
struct
BinarySensorMapChannel
{
15
binary_sensor::BinarySensor
*
binary_sensor
;
16
float
sensor_value
;
17
};
18
23
class
BinarySensorMap
:
public
sensor::Sensor
,
public
Component
{
24
public
:
25
void
dump_config()
override
;
34
void
loop
()
override
;
35
float
get_setup_priority
()
const override
{
return
setup_priority::DATA
; }
42
void
add_channel(
binary_sensor::BinarySensor
*sensor,
float
value);
43
void
set_sensor_type(
BinarySensorMapType
sensor_type);
44
45
protected
:
46
std::vector<BinarySensorMapChannel> channels_{};
47
BinarySensorMapType
sensor_type_{
BINARY_SENSOR_MAP_TYPE_GROUP
};
48
// this gives max 64 channels per binary_sensor_map
49
uint64_t last_mask_{0x00};
54
void
process_group_();
55
};
56
57
}
// namespace binary_sensor_map
58
}
// namespace esphome
loop
void loop()
esphome::setup_priority::DATA
const float DATA
For components that import data from directly connected sensors like DHT.
Definition:
component.cpp:18
esphome::binary_sensor_map::BinarySensorMapChannel
Definition:
binary_sensor_map.h:14
esphome::Component
Definition:
component.h:66
esphome::binary_sensor_map::BinarySensorMapChannel::binary_sensor
binary_sensor::BinarySensor * binary_sensor
Definition:
binary_sensor_map.h:15
binary_sensor.h
sensor.h
esphome::binary_sensor_map::BinarySensorMap::get_setup_priority
float get_setup_priority() const override
Definition:
binary_sensor_map.h:35
esphome::binary_sensor_map::BinarySensorMapChannel::sensor_value
float sensor_value
Definition:
binary_sensor_map.h:16
esphome::binary_sensor_map::BinarySensorMap
Class to group binary_sensors to one Sensor.
Definition:
binary_sensor_map.h:23
esphome::binary_sensor_map::BINARY_SENSOR_MAP_TYPE_GROUP
Definition:
binary_sensor_map.h:11
esphome
Definition:
a4988.cpp:4
component.h
esphome::binary_sensor::BinarySensor
Base class for all binary_sensor-type classes.
Definition:
binary_sensor.h:26
esphome::binary_sensor_map::BinarySensorMapType
BinarySensorMapType
Definition:
binary_sensor_map.h:10
esphome::sensor::Sensor
Base-class for all sensors.
Definition:
sensor.h:47
Generated by
1.8.13