10 #include <esp_gattc_api.h> 20 0x1a, 0x28, static_cast<char>(0xaa), 0x2a, 0x43, 0x6e, 0x3,
static_cast<char>(0xd1),
21 static_cast<char>(0xff),
static_cast<char>(0x9c), static_cast<char>(0x85)});
22 static const int16_t GENI_RESPONSE_HEADER_LENGTH = 13;
23 static const size_t GENI_RESPONSE_TYPE_LENGTH = 8;
25 static const uint8_t GENI_RESPONSE_TYPE_FLOW_HEAD[GENI_RESPONSE_TYPE_LENGTH] = {31, 0, 1, 48, 1, 0, 0, 24};
26 static const int16_t GENI_RESPONSE_FLOW_OFFSET = 0;
27 static const int16_t GENI_RESPONSE_HEAD_OFFSET = 4;
29 static const uint8_t GENI_RESPONSE_TYPE_POWER[GENI_RESPONSE_TYPE_LENGTH] = {44, 0, 1, 0, 1, 0, 0, 37};
30 static const int16_t GENI_RESPONSE_VOLTAGE_AC_OFFSET = 0;
31 static const int16_t GENI_RESPONSE_VOLTAGE_DC_OFFSET = 4;
32 static const int16_t GENI_RESPONSE_CURRENT_OFFSET = 8;
33 static const int16_t GENI_RESPONSE_POWER_OFFSET = 12;
34 static const int16_t GENI_RESPONSE_MOTOR_POWER_OFFSET = 16;
35 static const int16_t GENI_RESPONSE_MOTOR_SPEED_OFFSET = 20;
39 void setup()
override;
42 esp_ble_gattc_cb_param_t *param)
override;
void set_head_sensor(sensor::Sensor *sensor)
sensor::Sensor * power_sensor_
const float DATA
For components that import data from directly connected sensors like DHT.
void handle_geni_response_(const uint8_t *response, uint16_t length)
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override
bool is_current_response_type_(const uint8_t *response_type)
void set_flow_sensor(sensor::Sensor *sensor)
sensor::Sensor * flow_sensor_
float get_setup_priority() const override
void set_speed_sensor(sensor::Sensor *sensor)
void extract_publish_sensor_value_(const uint8_t *response, int16_t length, int16_t response_offset, int16_t value_offset, sensor::Sensor *sensor, float factor)
void dump_config() override
This class simplifies creating components that periodically check a state.
sensor::Sensor * voltage_sensor_
static ESPBTUUID from_uint16(uint16_t uuid)
sensor::Sensor * speed_sensor_
void send_request_(uint8_t *request, size_t len)
void set_voltage_sensor(sensor::Sensor *sensor)
void set_current_sensor(sensor::Sensor *sensor)
Implementation of SPI Controller mode.
static ESPBTUUID from_raw(const uint8_t *data)
Base-class for all sensors.
void set_power_sensor(sensor::Sensor *sensor)
uint8_t response_type_[GENI_RESPONSE_TYPE_LENGTH]
esphome::sensor::Sensor * sensor
sensor::Sensor * head_sensor_
sensor::Sensor * current_sensor_