miFlora not showing in Home Assistant

Hi,

I’ve successfully put the MiFlora sensors into HA before through the core HA component. However, due to the position of the sensors and my RPi, I decided to use an ESP32 as a BLE hub for better connectivity.

I’ve followed the instructions and everything appears to be working. The sensor node is online and it is detecting the MAC address of the MiFlora sensor. It is not however showing up in Home Assistant.

This is my yaml:

esphome:
  name: blehubtrack
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: "**********"
  password: "***********"

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

esp32_ble_tracker:
  scan_interval: 300s

sensor:
  - platform: xiaomi_miflora
    mac_address: C4:7C:8D:67:C0:8B
    temperature:
      name: "Xiaomi MiFlora Temperature"
    moisture:
      name: "Xiaomi MiFlora Moisture"
    illuminance:
      name: "Xiaomi MiFlora Illuminance"
    conductivity:
      name: "Xiaomi MiFlora Soil Conductivity"
    battery_level:
      name: "Xiaomi MiFlora Battery Level"     

This is the logs once all uploaded:

[16:01:30][I][application:097]: esphome-core version 1.12.2 compiled on Apr 24 2019, 15:59:09
[16:01:30][C][wifi:371]: WiFi:
[16:01:30][C][wifi:253]:   SSID: [redacted]
[16:01:30][C][wifi:254]:   IP Address: 192.168.1.49
[16:01:30][C][wifi:256]:   BSSID: [redacted]
[16:01:30][C][wifi:257]:   Hostname: 'blehubtrack'
[16:01:30][C][wifi:261]:   Signal strength: -54 dB ▂▄▆█
[16:01:30][C][wifi:262]:   Channel: 6
[16:01:30][C][wifi:263]:   Subnet: 255.255.255.0
[16:01:30][C][wifi:264]:   Gateway: 192.168.1.1
[16:01:30][C][wifi:265]:   DNS1: 192.168.1.1
[16:01:30][C][wifi:266]:   DNS2: 0.0.0.0
[16:01:30][C][logger:142]: Logger:
[16:01:30][C][logger:143]:   Level: DEBUG
[16:01:30][C][logger:144]:   Log Baud Rate: 115200
[16:01:30][C][logger:145]:   Hardware UART: UART0
[16:01:30][C][esp32_ble_tracker:703]: BLE Tracker:
[16:01:30][C][esp32_ble_tracker:704]:   Scan Interval: 300 s
[16:01:30][C][esp32_ble_tracker:712]:   Xiaomi 0000C47C8D67C08B
[16:01:30][C][esp32_ble_tracker:713]:     Temperature  'Xiaomi MiFlora Temperature'
[16:01:30][C][esp32_ble_tracker:713]:       Unit of Measurement: '°C'
[16:01:30][C][esp32_ble_tracker:713]:       Accuracy Decimals: 1
[16:01:30][C][esp32_ble_tracker:715]:     Moisture  'Xiaomi MiFlora Moisture'
[16:01:30][C][esp32_ble_tracker:715]:       Unit of Measurement: '%'
[16:01:30][C][esp32_ble_tracker:715]:       Accuracy Decimals: 0
[16:01:30][C][esp32_ble_tracker:715]:       Icon: 'mdi:water-percent'
[16:01:30][C][esp32_ble_tracker:716]:     Illuminance  'Xiaomi MiFlora Illuminance'
[16:01:30][C][esp32_ble_tracker:716]:       Unit of Measurement: 'lx'
[16:01:30][C][esp32_ble_tracker:716]:       Accuracy Decimals: 0
[16:01:30][C][esp32_ble_tracker:716]:       Icon: 'mdi:brightness-5'
[16:01:30][C][esp32_ble_tracker:717]:     Conductivity  'Xiaomi MiFlora Soil Conductivity'
[16:01:30][C][esp32_ble_tracker:717]:       Unit of Measurement: 'µS/cm'
[16:01:30][C][esp32_ble_tracker:717]:       Accuracy Decimals: 0
[16:01:30][C][esp32_ble_tracker:717]:       Icon: 'mdi:flower'
[16:01:30][C][esp32_ble_tracker:718]:     Battery Level  'Xiaomi MiFlora Battery Level'
[16:01:30][C][esp32_ble_tracker:718]:       Unit of Measurement: '%'
[16:01:30][C][esp32_ble_tracker:718]:       Accuracy Decimals: 0
[16:01:30][C][esp32_ble_tracker:718]:       Icon: 'mdi:battery'
[16:01:30][C][api:101]: API Server:
[16:01:30][C][api:102]:   Address: blehubtrack.local:6053
[16:01:30][C][ota:127]: Over-The-Air Updates:
[16:01:30][C][ota:128]:   Address: blehubtrack.local:3232
[16:06:25][D][esp32_ble_tracker:431]: Found device C4:7C:8D:67:C0:8B RSSI=-44
[16:06:25][D][esp32_ble_tracker:452]:   Address Type: PUBLIC

Now, one thing I have noticed from the ESPHome guides. When discovering devices, it has never displayed this:

Xiaomi MiFlora 94:2B:FF:5C:91:61 Got temperature=23.4°C

Which as per this page, it should. Is it a case that it can see the device, but isn’t recognising it as a MiFlora device? Running sudo hcitool lescan shows C4:7C:8D:67:C0:8B Flower care when run from my Pi.

How long have you waited? Not long by the look of the log :slight_smile:

Yes, but the log I pasted shows the MiFlora within a few minutes (that’s the device C4:7C:8D:67:C0:8B) - it’s just not being fed into HA. I’ve had it going for a good few hours now, no change in HA.

You already know the MAC, so why are you running the tracker? From my reading, thast only needs to run when discovering devices. Try taking that out and don’t forget that, in the words of the docs,

Note that it can sometimes take some time for the first BLE broadcast to be received.

Is the ESPhome device shown in the integrations page?
You should see that miflora with 5 sensors.

sigh One day I will learn…

I’d assumed because I’d bought the device recently that the firmware would be fairly up to date. Wrong. Found out how to update the firmware on the MiFlora and it is now broadcasting correctly.

Sorry for the stupidity.

Having trouble - lovelace plant card not showing values for home assistant and miflora

Help please.

esphome:
  name: esphome-web-2a0f70

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-2A0F70"
    password: "xxxxxxxxxxxxxxxxx"

captive_portal:

esp32_ble_tracker:

sensor:
  - platform: xiaomi_hhccjcy01
    mac_address: C4:7C:8D:6D:B8:7D
    temperature:
      name: "miflora_3_temperature"
    moisture:
      name: "miflora_3_moisture"
    illuminance:
      name: "miflora_3_light"
    conductivity:
      name: "miflora_3_conductivity"
    battery_level:
      name: "miflora_3_battery"

  - platform: xiaomi_hhccjcy01
    mac_address: C4:7C:8D:6D:A2:DF
    temperature:
      name: "miflora_4_temperature"
    moisture:
      name: "miflora_4_moisture"
    illuminance:
      name: "miflora_4_light"
    conductivity:
      name: "miflora_4_conductivity"
    battery_level:
      name: "miflora_4_battery"

  - platform: xiaomi_hhccjcy01
    mac_address: C4:7C:8D:6D:9A:27
    temperature:
      name: "miflora_8_temperature"
    moisture:
      name: "miflora_8_moisture"
    illuminance:
      name: "miflora_8_light"
    conductivity:
      name: "miflora_8_conductivity"
    battery_level:
      name: "miflora_8_battery"

  - platform: xiaomi_hhccjcy01
    mac_address: C4:7C:8D:6D:99:D3
    temperature:
      name: "miflora_7_temperature"
    moisture:
      name: "miflora_7_moisture"
    illuminance:
      name: "miflora_7_light"
    conductivity:
      name: "miflora_7_conductivity"
    battery_level:
      name: "miflora_7_battery"

and ha config example is this (I have only showed a few of the miflora for example)

'# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# Plants

plant:
  #Cestrum Nocturnum:
  raat_ki_rani:
    sensors:
      moisture: sensor.mi_flora_1_moisture
      battery: sensor.mi_flora_1_battery
      temperature: sensor.mi_flora_1_temperature
      conductivity: sensor.mi_flora_1_conductivity
      brightness: sensor.mi_flora_1_light_intensity
    min_moisture: 15
    max_moisture: 60
    min_battery: 15
    min_conductivity: 350
    max_conductivity: 2000
    min_temperature: 6
    max_temperature: 32
    min_brightness: 3500
    max_brightness: 50000
  #Cestrum Nocturnum:
  raat_ki_rani_2:
    sensors:
      moisture: sensor.mi_flora_2_moisture
      battery: sensor.mi_flora_2_battery
      temperature: sensor.mi_flora_2_temperature
      conductivity: sensor.mi_flora_2_conductivity
      brightness: sensor.mi_flora_2_light_intensity
    min_moisture: 15
    max_moisture: 60
    min_battery: 15
    min_conductivity: 350
    max_conductivity: 2000
    min_temperature: 6
    max_temperature: 32
    min_brightness: 3500
    max_brightness: 50000
  #Cestrum Nocturnum:
  raat_ki_rani 3:
    sensors:
      moisture: sensor.mi_flora_3_moisture
      battery: sensor.mi_flora_3_battery
      temperature: sensor.mi_flora_3_temperature
      conductivity: sensor.mi_flora_3_conductivity
      brightness: sensor.mi_flora_3_light_intensity
    min_moisture: 15
    max_moisture: 60
    min_battery: 15
    min_conductivity: 350
    max_conductivity: 2000
    min_temperature: 6
    max_temperature: 35
    min_brightness: 3500
    max_brightness: 50000'

Can you let us know how to update the firmware without the Xiaomi hub?