Continuing the discussion from Alternative means of measuring room temperature:
So the TL;DR is to use Xiaomi Mijia sensors, Home Assistant (HA) and ESPHome on a Wemos D32 to cheaply and simply get Temperature & Humidity into EmonCMS (and HA).
The long version;
As I said in part one, as much as I like the EmonTH, for me, they are simply too expensive for general deployment around the house, so I have been after a cheaper alternative for a while.
I found a solution, but now I have improved on that massively.
Firstly it still consists of these Xiaomi Mijia Bluetooth Hygrothermograph devices (available for around the £10 mark). I have now had these a year and the AAA battery in each has about 20% left - pretty good!
What I have just done though is massively simplified setting up the reading of the data.
Firstly I bought a Wemos D32 from AliExpress for around £7 from the official store - arrived in 10 days.
I’m quite a fan of HomeAssistant especially the Hass.io variety mainly because of the various add-ons that are available. I have also been a fan of Tasmota, but recently I have moved to ESPHome. The key reason for this change is that I have found it far simpler to set up and it has some built-in components I want, one of which is a component for these temperature sensors. I also have some CO2 sensors in the post that I hope will integrate just as easily onto some Wemos D1 Minis I bought at the same time.
The Hass.io add-on means you can write the config file there, click to build the code, If the D32 is connected to the same computer, you can upload directly or (like me as HA is on a VM), download the binary and flash the D32.
Once done, any configuration update is edited in the HA add-on, complied and flashed from there - just so easy!
The biggest hurdle is overcoming the rather cryptic documentation and getting the config right. I’m still working on that but I’ll post it once done.
Of course, I then publish the data through MQTT and pull it into EmonCMS.
As promised the config:
esphome: name: esp32_ble platform: ESP32 board: lolin_d32 wifi: ssid: "xxxx" password: "xxx" mqtt: broker: x.x.x.x username: xxxx password: xxxxx discovery: false log_topic: 'esp32_ble/debug' # Enable logging logger: # Enable Home Assistant API api: ota: esp32_ble_tracker: scan_interval: 300s sensor: - platform: xiaomi_mijia mac_address: AA:AA:AA:AA:AA:AA temperature: name: "Xiaomi MiJia Temperature" # Adding a 'state_topic` is all that is needed to get it to publish by MQTT state_topic: emon/ble/temp # Add a filter as these sensors have quite a jitter filters: - sliding_window_moving_average: window_size: 15 send_every: 2 humidity: name: "Xiaomi MiJia Humidity" battery_level: name: "Xiaomi MiJia Battery Level"