Bypass noolite router via mtrf64 + esp8266 + MQTT Buddy Android app
Task
Bypass the noolite router and control the noolite lighting quickly, efficiently and without using a home server. Global decentralization and total use of cloud solutions in home devices and Internet things. What? ....
Hello!
Again, with my lapt and tale about how to overcome the expensive noolite router, start controlling the lighting and not bother with the soldering of boards, controllers and in general - I want it to turn on / install the application and it works without additional dances. Yes ... everyone writes about it, but few do, because often all decisions rest on complex instructions. And I'll show you, now :) - well, go ahead friends!
All who bought noolite lighting blocks, all ran into the following problems. Let's
get
straight and straight: 1. I stuck, ok! and then what? how to manage fashionable blocks, but they also appeared with some kind of encryption and feedback ( article ) 2. yeah ... they want an Ethernet gateway ... for xxx greens ... to manage - OK! and application? there is yes ...?! well ahead 3. I started to manage - but it's expensive ... it's the same lighting, I want this cool, but I also want scenarios - and where can I get them? (at the end of the article mega bonus scenarios!) and a home server is also necessary: (- all this at the end leads to costs and already ... not very budgetary.
These (or similar) items also slow down users in expanding home automation.
The task is clear: we need to simplify life and make it convenient - now let's try to solve it by resorting to radical methods. We remove the home server, we remove the noolite Ethernet gateway.
(noolite team laughter)
There remain the lighting control units and ... the user.
(there should be a picture of one user in the field :) with a noolite block)
To start managing these blocks, we need to think about the technologies used first and then understand what hardware will help us to do this.
Recently, the data transfer protocol is very popular: MQTT - yes, this is a cool and very convenient data transfer protocol. With the team of pervert enthusiasts, we developed an application for this protocol that helps Android users (iOS build and windows phone in the process of delivery to the markets). Link to the application at the end of the article, do not consider it PR;) - yes, all right - this is PR: D - but we need a good application that will help us to make the world better. MQTT is cool - YES!
We take the MQTT protocol - great. The application for it is - great. Now note: the question on the backfill :) - what hardware does MQTT support? - YES, they all said with one voice: of course, ESP 8266.
Cooking borshch further and stirring the added ingredients, visit the noolite site and see what they have there with communication modules ... oh!
So they have modules for communicating with these blocks. We need only exotic. Why? Yes, because we have no home server, nothing but blocks and the notion of "decentralization". Oh ... looking forward to arguments and shouts - but oh well, karma on my head - we go on!
We look, on the site - and we see - 2 modules: MTRF64 USB and MTRF64 - so, one USB, the second just UART. Well, we have found a solution :) - since USB for computers and the power supply there under 5V - and here mr uart himself and 3.3V adapted too - it's beautiful.
What do we have?
1. блок noolite SLF-1-300 (блок с обратной связью и шифрованием)
(картинка noolite SLF-1-300)
2. MTRF64 UART модуль (который стоит дешевле чем USB, за счет отсутствия чипа по работе с USB! упрощен до «плинтусного» состояния ;) )
(картинка MTRF64 UART)
3. ESP8266 модуль
(картинка ESP8266)
3. приложение для работы с MQTT (MQTT Buddy)
(картинка)
(картинка noolite SLF-1-300)
2. MTRF64 UART модуль (который стоит дешевле чем USB, за счет отсутствия чипа по работе с USB! упрощен до «плинтусного» состояния ;) )
(картинка MTRF64 UART)
3. ESP8266 модуль
(картинка ESP8266)
3. приложение для работы с MQTT (MQTT Buddy)
(картинка)
Video
Now you need to simplify life and give you a code for the soul - that is. Who wants to sit and write a lot of code, especially with MTRF64, we need to go to the docks, and there ... there are a lot of useful things ( link ) - but we need to quickly and efficiently . Open Source from our team - welcome: D> GitHub
We also need to prepare ESP8266 - who “burned it” - knows, it is not difficult - 2 minutes and everything will work for you.
Get ready and take off!
- We can download the firmware from the site ( https://nodemcu-build.com ), we can take it directly from the github repository , which is provided with all the code
- Burn ESP8266 with the command:
sudo python esptool.py --port /dev/ttyUSB0 write_flash -fm dio -fs 32m 0x00000 {your_nodemcu_firmware.bin}
- Check that esp8266 is connected as / dev / ttyUSB0
- Check that {your_nodemcu_firmware.bin} you replaced with the name of your firmware
- If there is no esptool (download it here ;))
- Take ESP8266 dev board - and burn it, “burn” by full!
Now attention, we take and download the ready code : worker.
Read before filling code!
— подставить свои данные wifi роутера с логин\пасс и подставить свой MQTT брокер с логином и пасом. В коде используется free MQTT broker от cloudmqtt.com. Наша команда подняла свой бесплатный брокер, который Вы можете использовать: mqtt.ximxim.com (mqtt\mqtt)
Link to GitHub repository: mqtt_buddy-mtrf64-noolite-esp8266 - the code was developed by Dmitry Karaba (I thank him so much!).
The code is specially re-released from the closed repository of our company XIM, INC - to an open public for free download.
Be sure to replace the data with your
-- Credentials
SSID = "YOUR SSID NAME"
PASSWORD = "YOUR PASSWORD"
MQTT_SERVER = "m21.cloudmqtt.com"
MQTT_SERVER_PORT = 16487
MQTT_USER = "noo"
MQTT_PASS = "noo"
Fill the code on the ESP8266 through the ESPLORER tool.
Now connect esp8266 dev board + MTRF64.
esp8266 D7 rx — MTRF64 TX
esp8266 D8 tx — MTRF64 TX
esp8266 GND — MTRF64 GND
esp8266 3V3 — MTRF64 3V3
(фото подключения)
esp8266 D8 tx — MTRF64 TX
esp8266 GND — MTRF64 GND
esp8266 3V3 — MTRF64 3V3
(фото подключения)
As soon as you upload the code to esp8266 - after a reboot, you will not be able to reach it and change something (code) - you need to rewrite the firmware again. Why? because, esp8266 automatically switches to the UART9600 connection and starts communicating with the MTRF64 module. The code uses an alternative connection uart through pins d7 \ d8, basic RX, TX pins are free to work. You can easily add your own terms to “interrupt” the transition to the uart9600 to communicate with the MTRF64 - since this was not our goal and main task.
What we have done and how it works
The mtrf64 module is connected via UART with esp8266, which in turn connects to the Internet via your router and connects to the MQTT free broker. On the other hand, as a user, you also connect to this cloud broker via a mobile application and start sending commands to the MQTT channels, which in turn are “parsed” on the fly and, depending on the command, are transmitted via the UART MTRF64 module! Yes! That's how we turned and cool budget! Yes! It's pretty darn cool when you realize that you have built a clear logical chain of technologies that work for you. Thank ;)
Video
Control
Go ahead: we are connected and what's next? How to manage;) - it's simple! Merge our app MQTT Buddy from Google Play (link at the end of the article) and add the broker MQTT there - for example mqttcloud.com. Now add a new snap button noolite block to the MTRF64 - let's befriend them!
Commands to communicate with MTRF64
Дмитрий Караба, разработчик кода для esp8266 под MTRF64 — сделал следующий формат команд по MQTT для общения с модулем.
Из MQTT топиков видно, что вы можете работать как с каналами напрямую, так и с адресами конкретных устройств, тем самым можно привязать все устройства на один канал, но работать с каждым по конкретному адресу. Адрес можно узнать в топике mqtt_buddy/sys при привязке, модуль отвечает адресом привязанного устройства.
-- mqtt_buddy/noolight/<int:channel>-- mqtt_buddy/noolight/<int:channel>/<XX-XX-XX-XX:address>-- mqtt_buddy/noolight/<int:channel>/bind-- mqtt_buddy/noolight/<int:channel>/unbind-- mqtt_buddy/noolight/<int:channel>/devices
Из MQTT топиков видно, что вы можете работать как с каналами напрямую, так и с адресами конкретных устройств, тем самым можно привязать все устройства на один канал, но работать с каждым по конкретному адресу. Адрес можно узнать в топике mqtt_buddy/sys при привязке, модуль отвечает адресом привязанного устройства.
Add a button to MQTT Buddy (or use your MQTT client, console, python with paho at the end!). In MQTT Buddy - click "+" - enter the name of the button and the topic.
Adding a control button to MQTT Buddy
mqtt_buddy/noolight/0 и data: «on, off или switch»
и отмечаем одну галку: publish — чтобы при нажатии на кнопку — мы смогли послать команду в mqtt topic.
и отмечаем одну галку: publish — чтобы при нажатии на кнопку — мы смогли послать команду в mqtt topic.
Video
We added a button, now we do the standard block binding: click on the block, click on the bind button in our application and see how the block is attached to the module, the blinking indicator on the SLF block goes out.
If you want more information - you can read the messages in the topic: mqtt_buddy / sys - all the information from the block arrives there - every time, all 17 bytes of data, where you can find out the addresses of the blocks and what is going on there “in the technical basement” ...
Video
After binding - we create a new control button already with these blocks with the topic.
Block management through MQTT topic in MQTT Buddy
mqtt_buddy/noolight/0 и data: «on, off или switch»
в настройках приложения, отмечаем галочки: switch\retained\publish — теперь при нажатии на кнопку — будет посылаться команда в топик «mqtt_buddy/noolight/0» — esp8266 получит эти данные и разберет топик и отправит нужную команду модулю MTRF64 noolite и произойдет чудо… чудо технологии, которое Вы смогли воплотить в реальность и без сложных действий.
в настройках приложения, отмечаем галочки: switch\retained\publish — теперь при нажатии на кнопку — будет посылаться команда в топик «mqtt_buddy/noolight/0» — esp8266 получит эти данные и разберет топик и отправит нужную команду модулю MTRF64 noolite и произойдет чудо… чудо технологии, которое Вы смогли воплотить в реальность и без сложных действий.
The firmware and management of the first block will take you about 5 minutes if you are already familiar with esp8266 and at least once flashed it.
=================== tear off ============================
Links to hardware and software on the article
- MTRF 64 block
- ESP8266 dev board - Aliexpress \ radio markets \ online stores
- MQTT Buddy Android app (iOS \ windows phone in the stage of adaptation)
- mqtt.ximxim.com - our website - we made SHOW room on esp8266 for a larger fan;) - Many thanks to all for the positive rating, we are trying to make IOT more real, Smart Automation Team> XIM, Inc.
Forgot home selfie stick
Ну и… забыл дома селфи стик, пришлось офисный пылесос быстренько переделать ;)
============== MQTT Buddy Bon scripts =========================
Since the system is decentralized and no home server - who will run the scripts? Yes - it works, yes - the author uses this functionality. How does it work and where? In our MQTT Buddy app. Everything is quite simple: you add the MQTT broker and enter it, further up there is a button in the form of a watch - these are the scenarios.
Adding Script to MQTT Buddy
При клике — добавляем сценарий и если Ваш брокер доступен в среде интернет — тогда в нужное время (внимание, учитываются временные зоны, Вам не надо париться и думать об этом — просто скажите системе, во сколько Вы хотите и что послать в нужный Вам топик) — отработка 100% через QOS = 1 MQTT протокола). Мы максимально упростили сервис для пользователей, что бы они не думали про техническую часть и не заморачивались, а просто сказали «что я хочу» :) — и чтобы это работало.
This is a real service that really works. If anyone wants to get the free code MQTT Buddy on the PRO functionality - you can subscribe to the form on the website mqtt.ximxim.com :)) - there you can also find the showroom from the web access. Everything! I bow out!
Have a great day and good mood, thank you for your feedback, positive feedback and sensible criticism! Be kinder.
Your automator, Alex B.