Accéder au contenu principal

Articles

A community space for OpenMQTTgateway discussions

With the increase of OpenMQTTgateway users the current community ecosystem composed of github + a gitter chat is showing its limits, especially for the chat which doesn't enable to structure discussions around a subject. 
So as to have more capitalisation on the questions, answers and informations coming from the community I'm introducing a forum based on discourse
Giving the opportunity to build together a knowledge base around OpenMQTTGateway.




Hope you enjoy it, don't hesitate to post questions and share your thoughts, ideas or information around OpenMQTTGateway.

OpenMQTTGateway now reads Xiaomi Mijia Temperature and Humidity sensor

In the path of integrating BLE devices to OpenMQTTGateway I have found the Xiaomi Mi Jia Humidity and temperature sensor to be a good candidate.

This little indoor sensor is able to measure temperature and humidity and to transmit these data by bluetooth low energy to your smartphone.




As we already integrated another BLE device (Mi Flora) why not extending the integration scope of OpenMQTTGateway to this one.

I ordered one to see if I was able to extract data from it. After a few weeks, I received it, a first test with nRF connect application showed me that this device diffuses data in a quite similar way compared to Mi Flora (using BLE service data exposition).

From this point I had to determine the differences between the data sent from mi flora and the data sent from mi jia hum & temp sensor. The reverse engineering was similar to the one done with Mi Flora and with some offset implementation in the program I was able to read easily the humidity and temperature of the sensor.

You ca…

Adding infrared emitter to SONOFF RF BRIDGE

With the add of  SONOFF RF Bridge  to the OpenMQTTGateway compatibility list we were able to send and receive 433mhz by MQTT. 
The interesting thing with OpenMQTTGateway is the ability to have on one board several gateways (RF, IR, BLE and more to come ;-). 

The last versions of SONOFF RF BRIDGE as two IO free pins, why not using these pins to add a new gateway to this little cheap device and control more devices.



If we follow the interest of the different gateways you are more interested on RF and after comes IR infrared.

My choice came in this case to add an infrared emitter to the RF Bridge, with this gateway we are adding the capacity of controlling TV, DVD, hifi...

On the hardware side, I followed the same schematic for IR setup with ESP8266 with just a little add a protection resistor of 1K for the IR led.
The other resistor is connected between the transistor base and IO5 of the RF Bridge instead of D0.
The IR led is powered by the 3,3V of the Sonoff RF Bridge.

The schema:


Here is how i…

ESP32 compatibility, 433mhz 315mhz communication, BLE presence detection and mi flora readings

While I was waiting for the ESP32 developement environment to be enough mature I found a presence detection implementation from @touliloup. It was the opportunity to put my hands on the ESP32 doit board that was waiting for me.



I started with the BLE gateway development. The first attempt with the libraries supplied with the Arduino ESP32 environement was not successfull. I had to add the library from Neil Kolban : https://github.com/nkolban/ESP32_BLE_Arduino/tree/master
With the examples provided it was quite easy to setup a first system that display on the serial monitor the BLE devices nearby.


The next step was to integrate the function with MQTT and by the way to recover the same level of funcionnality we already had with esp8266 + hm10. Not so difficult until there.
The goal of OpenMQTTGateway is to be able to have on a single system several gateways so as to centralize the telecommunication part of your controller.  In this context the following is easy to guess ;  add another tel…

SONOFF RF BRIDGE with custom firmware

From an user request I took a look into the RF SONOFF Bridge, a quite interesting device from SONOFF. It is able to send and receive 433mhz signal with a very competitive price of less than 10€.

I already own several SONOFF Smart switches on which I loaded custom firmwares with success. One is working since months perfectly!

Here is how the RF bridge looks inside:




First thing I used to do when I launch some new development is to check the state of the art, as we often say google is your friend. And by searching the compatibility between the bridge and RCSwitch library (the main RF library of OpenMQTTGateway) I fall into the very good work of Xose Pérez (Tinkerman)
http://tinkerman.cat/hacking-sonoff-rf-bridge-433/
He ported successfully its ESPURNA code to the Sonoff RF Bridge.

After following its instructions and some mistakes from me (be careful about choosing the good line of pins on the bridge for your FTDI connectors :-( and choose the following parameters except the port) I successful…

Mi flora integration to OpenMQttgateway

Following some users requests on OpenMQTTGateway github I made some research and code to be able to read data from Mi Flora sensor also known as xiaomi flower sensor. The goal is to connect the mi flora to an mqtt compatible controller like openhab or home assistant with a simple arduino or esp8266 connected to an hm10/11 module.


Mi flora use Bluetooth Low Energy technology to communicate to a smartphone.  It gather on one sensor temperature, humidity, hygro and fertility measurement. These measures are available through an app on your smartphone so as to monitor your plants.
As this device use BLE the idea was to be able to read the measures with OpenMqttgateway through the hm10 component.
Some code and library are already available in python for the pi or equivalents. But not for arduino or esp8266.
This is where it begins.
With the current gateway version we were able to receive the mac adress of ble devices including the mi flora one. But not the device measures.
I tried the different …

Changing the openmqttgateway pinout !

By adding more and more modules to the gateway free pins begins to be difficult to find.
The classic wiring used since the begining doesn't answer to the need of adding i2c or rfm69. Rfm69 for instance use fixed pins already used by other component.
Due to these issues we had to redesign a new wiring.
There is no anymore classic, I2C or RFM69 wiring selection in configuration. We now have only one wiring with RF, IR, I2C, ADC, HCSR501 and BT gateway. If you want to add RFM69 and DHT you need to remove I2C , BT and HCSR501.

These 2 configurations are described here.



Of course you can adapt these configurations to suits your needs, they are not a fixed base. 
They are only suggestions corresponding to the wiki schematic and config pins
Thanks for the big work of @hannesdi on the wiki/tests and the suggestion of using RX pin from @gammelobst.