Presently I have two ESP32 devices connected via wifi and showing up in ESPHome.
Each ESP32 monitors a particular bluetooth device. Note both bluetooth devices in close proximity, no issues getting data into HomeAssistant.
Bluetooth device #1: Xaiomi bluetooth device to monitor temperature/humidity/battery.
Bluetooth deivce #2 TM5035 20355038 bluetooth propane tank level monitor.
I’d like to be able to monitor the two bluetooth devices from one ESP32, is this possbile?
If so, I’m not sure how combine the two ESP32 devices yamal code snippets so that both bluetooth devices can be read by a single ESP32.
Any help on this would be greatly appreciated.
Here are the snippets of working code per device.
ESP32-xxx Device #1:
esp32_ble_tracker:
sensor:
** - platform: xiaomi_lywsd03mmc**
# mac_address: “A4:C1:38:B1:CD:7F” - MAC address needs to be that of the bluetooth device - obtained from Telelink Connection Popup - shows: ATC_0D6AB# for this Xaiomi device.
** mac_address: “A4:C1:38:0D:6A:3B”**
# bindkey: “eef418daf699a0c188f3bfd17e4565d9” - Note below key be is not actual, only number of characters - In this case changed last to characters to match node21 name
** bindkey: “eef418daf699a0c188f3bfd17e456521”**
** temperature:**
** name: “Office Upstairs Temperature”**
** humidity:**
** name: “Office Upstairs Humidity”**
** battery_level:**
** name: “Office Upstairs Battery Level” **
# Reports the signal strength auto magically.
** - platform: ble_rssi**
** mac_address: A4:C1:38:0D:6A:3B**
** name: “WiFi Signal”**
####################################################################
Device #2:
esp32_ble_tracker:
** scan_parameters:**
** interval: 1100ms**
** window: 1100ms**
** on_ble_advertise:**
** - mac_address: DC:05:3D:ED:6A:A0**
** then:**
** - lambda: |-**
** ESP_LOGD(“ble_adv”, " name: %s", x.get_name().c_str());**
** std::string name = x.get_name();**
** if (esphome::str_startswith(name, “level:”)) {**
** name.erase(0,7);**
** std::string value = esphome::str_until(name.c_str(), ’ ');**
** id(propane_level).publish_state(atof(value.c_str()));**
** id(propane_sensor_ok).publish_state(true);**
** }**
** if (esphome::str_startswith(name, “trbl:ACC”)) {**
** name.erase(0,10); **
** std::string value = esphome::str_until(name.c_str(), ‘)’);**
** id(propane_level).publish_state(atof(value.c_str()));**
** id(propane_sensor_ok).publish_state(false);**
** }**
sensor:
# To store the propane level percentage - does nothing on its own.
** - platform: template**
** name: Propane Level**
** id: propane_level**
** unit_of_measurement: ‘%’**
# Reports the signal strength auto magically.
** - platform: ble_rssi**
** mac_address: DC:05:3D:ED:6A:A0**
** name: “WiFi Signal”**
binary_sensor:
** - platform: template**
** name: Propane Sensor Ok**
** id: propane_sensor_ok**
####################################################################