ESPHome 2026.5.1
Loading...
Searching...
No Matches
binary_sensor_map.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <vector>
8
10
16
27
33 public:
34 void dump_config() override;
35
42 void loop() override;
43
50 void add_channel(binary_sensor::BinarySensor *sensor, float value);
51
59 void add_channel(binary_sensor::BinarySensor *sensor, float prob_given_true, float prob_given_false);
60
61 void set_sensor_type(BinarySensorMapType sensor_type) { this->sensor_type_ = sensor_type; }
62
63 void set_bayesian_prior(float prior) { this->bayesian_prior_ = prior; };
64
65 protected:
66 std::vector<BinarySensorMapChannel> channels_{};
68
69 // this allows a max of 64 channels/observations in order to keep track of binary_sensor states
70 uint64_t last_mask_{0x00};
71
72 // Bayesian event prior probability before taking into account any observations
74
82 void process_group_();
83 void process_sum_();
84 void process_bayesian_();
85
95 float bayesian_predicate_(bool sensor_state, float prior, float prob_given_true, float prob_given_false);
96};
97
98} // namespace esphome::binary_sensor_map
Base class for all binary_sensor-type classes.
Class to map one or more binary_sensors to one Sensor.
void add_channel(binary_sensor::BinarySensor *sensor, float value)
Add binary_sensors to the group when only one parameter is needed for the configured mapping type.
void set_sensor_type(BinarySensorMapType sensor_type)
float bayesian_predicate_(bool sensor_state, float prior, float prob_given_true, float prob_given_false)
Computes the Bayesian predicate for a specific observation If the sensor state is false,...
void loop() override
The loop calls the configured type processing method.
std::vector< BinarySensorMapChannel > channels_
void process_group_()
Methods to process the binary_sensor_maps types.
Base-class for all sensors.
Definition sensor.h:47
struct esphome::binary_sensor_map::BinarySensorMapChannel::@13::@14 probabilities
union esphome::binary_sensor_map::BinarySensorMapChannel::@13 parameters