ESPHome 2025.5.0
Loading...
Searching...
No Matches
binary_sensor_map.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <vector>
8
9namespace esphome {
10namespace binary_sensor_map {
11
17
28
34 public:
35 void dump_config() override;
36
43 void loop() override;
44
51 void add_channel(binary_sensor::BinarySensor *sensor, float value);
52
60 void add_channel(binary_sensor::BinarySensor *sensor, float prob_given_true, float prob_given_false);
61
62 void set_sensor_type(BinarySensorMapType sensor_type) { this->sensor_type_ = sensor_type; }
63
64 void set_bayesian_prior(float prior) { this->bayesian_prior_ = prior; };
65
66 protected:
67 std::vector<BinarySensorMapChannel> channels_{};
69
70 // this allows a max of 64 channels/observations in order to keep track of binary_sensor states
71 uint64_t last_mask_{0x00};
72
73 // Bayesian event prior probability before taking into account any observations
75
83 void process_group_();
84 void process_sum_();
85 void process_bayesian_();
86
96 float bayesian_predicate_(bool sensor_state, float prior, float prob_given_true, float prob_given_false);
97};
98
99} // namespace binary_sensor_map
100} // namespace esphome
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:57
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
struct esphome::binary_sensor_map::BinarySensorMapChannel::@13::@14 probabilities
union esphome::binary_sensor_map::BinarySensorMapChannel::@13 parameters