5namespace sen21231_sensor {
 
    7static const char *
const TAG = 
"sen21231_sensor.sensor";
 
   12  ESP_LOGCONFIG(TAG, 
"SEN21231:");
 
   15    ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
 
   17  ESP_LOGI(TAG, 
"SEN21231: %s", this->
is_failed() ? 
"FAILED" : 
"OK");
 
   18  LOG_UPDATE_INTERVAL(
this);
 
 
   23  this->
read_bytes(PERSON_SENSOR_I2C_ADDRESS, (uint8_t *) &results, 
sizeof(results));
 
   24  ESP_LOGD(TAG, 
"SEN21231: %d faces detected", results.num_faces);
 
   26  if (results.num_faces == 1) {
 
   27    ESP_LOGD(TAG, 
"SEN21231: is facing towards camera: %d", results.faces[0].is_facing);
 
 
 
bool read_bytes(uint8_t a_register, uint8_t *data, uint8_t len)
Compat APIs All methods below have been added for compatibility reasons.
 
void dump_config() override
 
void publish_state(float state)
Publish a new state to the front-end.
 
struct __attribute__((__packed__)) { person_sensor_results_header_t header; int8_t num_faces; person_sensor_face_t faces[PERSON_SENSOR_MAX_FACES_COUNT]; uint16_t checksum; } person_sensor_results_t
 
Providing packet encoding functions for exchanging data with a remote host.