7 namespace inkbird_ibsth1_mini {
9 static const char *
const TAG =
"inkbird_ibsth1_mini";
12 ESP_LOGCONFIG(TAG,
"Inkbird IBS TH1 MINI");
15 LOG_SENSOR(
" ",
"Humidity", this->
humidity_);
33 ESP_LOGVV(TAG,
"parse_device(): unknown MAC address.");
37 ESP_LOGVV(TAG,
"parse_device(): address is not public");
41 ESP_LOGVV(TAG,
"parse_device(): service_data is expected to be empty");
45 if (mnf_datas.size() != 1) {
46 ESP_LOGVV(TAG,
"parse_device(): manufacturer_datas is expected to have a single element");
49 auto mnf_data = mnf_datas[0];
50 if (mnf_data.uuid.get_uuid().len != ESP_UUID_LEN_16) {
51 ESP_LOGVV(TAG,
"parse_device(): manufacturer data element is expected to have uuid of length 16");
54 if (mnf_data.data.size() != 7) {
55 ESP_LOGVV(TAG,
"parse_device(): manufacturer data element length is expected to be of length 7");
58 if ((mnf_data.data[6] != 8) && (mnf_data.data[6] != 6)) {
59 ESP_LOGVV(TAG,
"parse_device(): unexpected data");
72 auto external_temperature = NAN;
75 auto measured_temperature = ((int16_t) mnf_data.uuid.get_uuid().uuid.uuid16) / 100.0f;
78 if (mnf_data.data[2] == 0) {
80 }
else if (mnf_data.data[2] == 1) {
81 external_temperature = measured_temperature;
83 ESP_LOGVV(TAG,
"parse_device(): unknown sensor type");
87 auto battery_level = mnf_data.data[5];
88 auto humidity = ((mnf_data.data[1] << 8) + mnf_data.data[0]) / 100.0f;
const std::vector< ServiceData > & get_manufacturer_datas() const
sensor::Sensor * battery_level_
void publish_state(float state)
Publish a new state to the front-end.
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
sensor::Sensor * temperature_
const std::vector< ServiceData > & get_service_datas() const
void dump_config() override
esp_ble_addr_type_t get_address_type() const
uint64_t address_uint64() const
sensor::Sensor * humidity_
sensor::Sensor * external_temperature_
Implementation of SPI Controller mode.