Accéder au contenu principal

Integration of Mijia clock, temperature and humidity sensor to OpenMQTTGateway

Mi flora and Mijia temperature/humidity sensor are now well integrated with OpenMQTTGateway, you can have a temperature sensor that last months just with an ESP32 and one of these 2 devices.

Just upload OMG to the ESP32 and it will automatically read the sensors values published by the devices around you.

A few weeks ago I have seen on aliexpress website a new BLE device made by Xiaomi with a big clock and also the ability to measure temperature and humidity. This device is called Mijia model LYWSD02 and you can find it currently for around 15$.
It was the chance to test it and see if it can be incorporated to OMG.

After a few weeks of waiting :-) I received the device.






We can see directly that it is an e-ink display (same technology used in ereaders), we should have good results in terms of battery lasting.

The device is powered by 2 classical CR2030 Lithium batteries and comes with some stickers and support for different type of mounts.


Once you remove the little part of platic going out the device you create the contact between batteries and the device to power it on.


We can see that the 3 informations expected are here, but there is a big chance that the clock will not be to your timezone.

So as to put the clock at yours you will need to download the xiaomi mi home app on your smartphone and pair the device. There is no button for pairing, you just need to let the device close to your phone several minutes. And after the clock will be automaticaly set to your timezone

Now if we speak to the integration itself, the device was quite easy to add to OpenMQTTGateway

By looking to the service data published by MQTT before the integration I was able to isolate a special hexadecimal code corresponding to the device (205b04). The temperature and humidity are published in the same way the other Xiaomi devices does.
After some code modifications the device is now integrated and can be seen into your favorite home automation controller thanks to MQTT!





Another device compatible added to the list.

PS: you now see that I use MQTT explorer to browse the MQTT messages of my different brokers. It is a very usefull tool when working with MQTT!

Commentaires

  1. Hi. I have a question. Does this device send battery information like his brothers Mijia and Cleargrass?

    Thank you :-)

    RépondreSupprimer
    Réponses
    1. Hi, it doesn't seem to send the battery value.

      Supprimer
    2. Thanks. It seems that, but in the Openmqttgateway code appears battery information. Can anybody confirm that?

      Supprimer

Enregistrer un commentaire

Posts les plus consultés de ce blog

433toMQTTto433 - Bidirectional ESP8266 NodeMCU gateway between RF 433Mhz signal and MQTT

The goal  is to act as a gateway between 433Mhz sensors and a MQTT broker or between the MQTT broker and 433Mhz actuators, It enables to: receive MQTT data from a topic and send RF 433Mhz signal corresponding to the received MQTT data  publish MQTT data to a different topic related to received 433Mhz signal  It can be an interesting part in an home automation system so as to interface sensors and actuators (wall sockets) with software like openhab . List of compatible sensors here The interest of putting this gateway to an ESP8266 and not on a raspberry pi is to be able to manage security actions at gateway level (power on a siren, cut power to certain devices) following RF data received by sensors without being dependent to the PI for security related actions. [EDIT] all infos are now centralized into  the github repository  take a look at it you will find up to date info about OpenMQTTGateway You need: Software: Mosquitto Arduino IDE latest version (tested ok with 1.6.10

Get your BLE sensors data into Home Assistant in 5 minutes

You can now upload your board directly from the web browser!  So let's imagine you want to read data from a sensor like a Mi Flora, an LYWSD03MMC, a weight scale, or any other BLE sensor from this list  Plug an ESP32 dev board to your computer USB port Go to this website: https://docs.openmqttgateway.com/upload/web-install.html Select esp32dev-ble Click the install button Depending on your board you may have to press the BOOT button Choose the port that the ESP is connected to. Wait until the process is complete. Release the BOOT button That's it, OMG is now loaded into your ESP32 board without Arduino IDE, platformIO or a binary flasher. Here are the steps in images: Now comes the Home Assistant part: Add the MQTT integration and activate auto discovery Create a user and a password (Configuration->Users) without administrator right for the gateway Well, this is enough for Home Assistant. So let's now connect both: Check the Wifi Access points available with your smartph

SONOFF RF BRIDGE + Pilight or How to extend the supported protocols by our little bridge

With version V0.9 of OpenMQTTGateway  @steadramon  &  @puuu  (the ESP library creator) enabled by their work to integrate Pilight library on OMG. Permiting to increase significantly the list of RF protocols of OMG . But now that we have this interesting possibility and with the goal of OMG of beiing multi boards compatible, why not trying to put Pilight on a Sonoff RF Bridge . So as to do this test I ordered a new one so as to be on the same hardware as most of the users (my other RF Bridge is a demonstration old one) So as to decode RF signals the Sonoff RF Bridge has a special dedicated chip (EFM8BB1)  that communicate with the esp8285 with a serial connection. If we want to increase the number of RF protocols compatibles on the device without modifying the hardware, the only software based solution is to hack the  EFM8BB1. This hack is available and made by @ Portisch . The list of protocol is interesting but at the moment not as big as Pilight one. Maybe I will t