Skip to content

Instantly share code, notes, and snippets.

@fboldog
Last active January 9, 2022 16:03
Show Gist options
  • Save fboldog/deefecf41b2c55e83e3f05ba250c3325 to your computer and use it in GitHub Desktop.
Save fboldog/deefecf41b2c55e83e3f05ba250c3325 to your computer and use it in GitHub Desktop.
hass.io - Xiaomi Temperature Sensor 2 w/ ESP32

Required HW + SW:

  • Mi Temperature and Humidity Monitor 2
  • ESP32 (flash size min: 4mb) with BT LE
  • MQTT
  • HASS.IO

Steps: ESP32 + bluetooth firmware: http://ota.tasmota.com/tasmota32/release/tasmota32-bluetooth.bin

Flash to esp https://tasmota.github.io/docs/Esptool/

Setup esp

  1. bluetooth (bind_key) https://tasmota.github.io/docs/Bluetooth/#encryption-and-bind_key important step: rule1 on System#Boot do backlog NRFkey ... NRFkey format: https://tasmota.github.io/docs/Commands/#nrfkey

  2. mqtt (change topic to specific esp, etc...) https://tasmota.github.io/docs/MQTT/

Add a mqtt.sensor into hass-io configuration.yml https://www.home-assistant.io/integrations/sensor.mqtt/

Example:

sensor:
  - platform: mqtt
    unique_id: xiaomi_temperature_l33t
    name: Mi Temperature
    state_topic: tele/tasmota_btle_L33T/SENSOR
    unit_of_measurement: 'C'
    value_template: '{{ value_json.SENSORKEY.Temperature }}'
    icon: mdi:thermometer
  - platform: mqtt
    ...
    value_template: '{{ value_json.SENSORKEY.Humidity }}'
    ...

Restart hass-io

Check hass-io/config/entities for Mi ... entries

Customize your hass-io dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment