runningtoy / InkBird_BLE2MQTT

ibbq Inkbird ble to mqtt bridge ESP32 based
37 stars 19 forks source link

Can't find Thermometer? #6

Open ajobbins opened 3 years ago

ajobbins commented 3 years ago

I have an Inkbird IBT-6XS and an ESP32 DEVKITV1.

Flashed this software fine and the device boots and connects to WiFi/MQTT but doesn't seem to be picking up a thermometer? I am not seeing any topics being published to the MQTT server and the logs don't seem to indicate any issue that is obvious to me. Any clues as to what is going wrong?

Full log below. It stops at the last line (MQTT Connected) and doesn't do anything further.

[17:54:47]ets Jun  8 2016 00:22:57
[17:54:47]
[17:54:47]rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[17:54:47]configsip: 0, SPIWP:0xee
[17:54:47]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[17:54:47]mode:DIO, clock div:2
[17:54:47]load:0x3fff0018,len:4
[17:54:47]load:0x3fff001c,len:1044
[17:54:47]load:0x40078000,len:8896
[17:54:47]load:0x40080400,len:5828
[17:54:47]entry 0x400806ac
[17:54:47]E (10) BBQ: WiFi not connected. Try to reconnect
[17:54:48]E (1793) BBQ: WiFi not connected. Try to reconnect
[17:54:49]E (1998) BBQ: SYSTEM_EVENT_STA_STOP
[17:54:49]E (2811) BBQ: WiFi not connected. Try to reconnect
[17:54:50]E (3015) BBQ: SYSTEM_EVENT_STA_STOP
[17:54:50]E (3827) BBQ: WiFi not connected. Try to reconnect
[17:54:51]E (4031) BBQ: SYSTEM_EVENT_STA_STOP
[17:54:51]E (4843) BBQ: WiFi not connected. Try to reconnect
[17:54:52]E (5047) BBQ: SYSTEM_EVENT_STA_STOP
[17:54:52]D (5859) BBQ: Scanning
[17:54:55]E (8894) BBQ: WiFI Connected
[17:54:57]D (10458) BBQ: -------------
[17:54:57]D (10458) BBQ: IPv4: 192.168.2.84
[17:54:57]D (10459) BBQ: Subnet: 255.255.248.0
[17:54:57]D (10459) BBQ: Gateway: 192.168.1.1
[17:54:57]D (10459) BBQ: DNS1: 192.168.1.1
[17:54:57]D (10462) BBQ: DNS2: 0.0.0.0
[17:54:57]D (10465) BBQ: -------------
[17:54:57]I (10556) BBQ: MQTT Connected
[17:54:57]D (10556) BBQ: mqttReconnect()
[17:55:23]I (36552) BBQ: MQTT Connected
LM2001 commented 3 years ago

I have exactly the same response as you do, constant MQTT connect messages.

ajobbins commented 3 years ago

I ended up just using the BLE Tracker from ESPHome and it's works great

reinder83 commented 2 years ago

I ended up just using the BLE Tracker from ESPHome and it's works great

You have it fully functional in ESPHome? I'm trying to do the same, do you have more information on this?

Edit: I found the info how to set it up, and it's working for me as well -> https://community.home-assistant.io/t/inkbird-bt-thermometer-ibbq-with-esp32/325825

ajobbins commented 2 years ago

found the info how to set it up, and it's working for me as well -> https://community.home-assistant.io/t/inkbird-bt-thermometer-ibbq-with-esp32/325825

For completeness, here is my code. I updated it to include the device and state class, which then allows you to swap between C and F in the HomeAssistant UI if you need.

substitutions:
  esp_name: ble_tracker

esphome:
  name: ble_tracker
  platform: ESP32
  board: nodemcu-32s
  on_boot:
    priority: -10
    then:
      - switch.turn_off: annoyingled
      - lambda: |-
          {
          id(ble_sensor_1).publish_state(0);
          id(ble_sensor_2).publish_state(0);
          id(ble_sensor_3).publish_state(0);
          id(ble_sensor_4).publish_state(0);         
          id(ble_sensor_5).publish_state(0);
          id(ble_sensor_6).publish_state(0);         
          }
      - delay: 1 sec
      - switch.turn_on: annoyingled
      - delay: 1 sec
      - switch.turn_off: annoyingled

wifi:
  ssid: ""
  password: ""
  fast_connect: true

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Ble Tracker Fallback Hotspot"
    password: ""

captive_portal:

web_server:
  port: 80

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: ""

ota:
  password: ""

time:
  - platform: homeassistant

esp32_ble_tracker:
  on_ble_advertise:
    - lambda: |-
        if (x.get_name() != "iBBQ") return;
        ESP_LOGI("ble_adv", "New BLE device");
        ESP_LOGI("ble_adv", "  address: %s", x.address_str().c_str());
        ESP_LOGI("ble_adv", "  name: %s", x.get_name().c_str());
        ESP_LOGI("ble_adv", "  Advertised service UUIDs:");
        for (auto uuid : x.get_service_uuids()) {
            ESP_LOGI("ble_adv", "    - %s", uuid.to_string().c_str());
        }
        ESP_LOGI("ble_adv", "  Advertised service data:");
        for (auto data : x.get_service_datas()) {
            ESP_LOGI("ble_adv", "    - %s: (length %i)", data.uuid.to_string().c_str(), data.data.size());
        }
        ESP_LOGI("ble_adv", "  Advertised manufacturer data:");
        for (auto data : x.get_manufacturer_datas()) {
            ESP_LOGI("ble_adv", "    - %s: (%s)", data.uuid.to_string().c_str(), hexencode(data.data).c_str());
            if (data.uuid.contains(0, 0)) {

              int probe0 = (data.data[9] << 8) + data.data[8];
              int probe1 = (data.data[11] << 8) + data.data[10];
              int probe2 = (data.data[13] << 8) + data.data[12];
              int probe3 = (data.data[15] << 8) + data.data[14];
              int probe4 = (data.data[17] << 8) + data.data[16];
              int probe5 = (data.data[19] << 8) + data.data[18];              
              ESP_LOGI("ble_data", "    - %f %f %f %f %f %f", probe0 / 10.0, probe1 / 10.0, probe2 / 10.0, probe3 / 10.0, probe4 / 10.0, probe5 / 10.0);
              if (probe0 < 60000) {
                id(ble_sensor_1).publish_state(probe0 / 10.0);
              } else {
                id(ble_sensor_1).publish_state(0);                
              }
              if (probe1 < 60000) {
                id(ble_sensor_2).publish_state(probe1 / 10.0);
              } else {
                id(ble_sensor_2).publish_state(0);                
              }
              if (probe2 < 60000) {
                id(ble_sensor_3).publish_state(probe2 / 10.0);
              } else {
                id(ble_sensor_3).publish_state(0);                
              }
              if (probe3 < 60000) {
                id(ble_sensor_4).publish_state(probe3 / 10.0);
              } else {
                id(ble_sensor_4).publish_state(0);                
              }
              if (probe4 < 60000) {
                id(ble_sensor_5).publish_state(probe4 / 10.0);
              } else {
                id(ble_sensor_5).publish_state(0);
              }
              if (probe5 < 60000) {
                id(ble_sensor_6).publish_state(probe5 / 10.0);
              } else {
                id(ble_sensor_6).publish_state(0);
              }

            }
        }

switch:
  - platform: gpio
    name: "${esp_name}-Onboard-LED"
    pin: 2
    inverted: False
    id: annoyingled
  - platform: restart
    name: ${esp_name}-restart
    id: restart_switch

sensor:
  - platform: uptime
    name: "${esp_name}_Uptime Sensor"

  - platform: wifi_signal
    name: "${esp_name} WiFi Signal"
    update_interval: 60s

  - platform: template
    name: "Inkbird Temperature Probe 1"
    id: ble_sensor_1
    icon: "mdi:thermometer"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 0

  - platform: template
    name: "Inkbird Temperature Probe 2"
    id: ble_sensor_2
    icon: "mdi:thermometer"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 0

  - platform: template
    name: "Inkbird Temperature Probe 3"
    id: ble_sensor_3
    icon: "mdi:thermometer"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 0

  - platform: template
    name: "Inkbird Temperature Probe 4"
    id: ble_sensor_4
    icon: "mdi:thermometer"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 0

  - platform: template
    name: "Inkbird Temperature Probe 5"
    id: ble_sensor_5
    icon: "mdi:thermometer"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 0

  - platform: template
    name: "Inkbird Temperature Probe 6"
    id: ble_sensor_6
    icon: "mdi:thermometer"
    unit_of_measurement: "°C"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 0
1technophile commented 2 years ago

All the Inkbird BBQ and many more are natively integrated into OpenMQTTGateway for ESP32 and Theengs gateway for Raspberry/servers. With OMG you don't need any yaml as the sensors are autodiscovered. With Theengs the autodiscovery is being added.