B4R Question APP TUYA and B4R

Gerardo Tenreiro

Active Member
Licensed User
Good
I'm a bit green on this so after searching the forum and not finding anything about it, who did I ask?
Someone use ESP8266 or ESP32 to create a device compatible with YOUR APP?
Some point to start a library, a website or something.
Thank you so much.
 

Gerardo Tenreiro

Active Member
Licensed User
No, I don't have a link. I'm still starting out and I need some help that I can't find.
Some example or something similar that allows us to advance.
I started the project this weekend and it is about a control of windows and doors to know if it opens, closes, ventilates or hits.
The intention is to apply the digital inputs to an ESP8266 or an ESP32 and send the status of the door or window allowing some adjustments such as the vibration level, alarm hours and the like.
I did not find anything similar so it occurred to do it and at the same time practice a little with B4R and the ESPs who are very grateful to work with them.
Any help is welcome.
Thanks
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Make a local wireless network with your ESP boards, and maybe a WiFi-router. One of these devices should be a web-server with control\status interface to see all the devices via a webview app opening this web-site to control whole the system.
It looks like the Internet connection here is not needed at all, only if you need to get alerts and status outside. In this case the server must be on a secured host (with Internet connection) with user auth to login first.
Search for "MQTT" by the way...
 
Last edited:
Upvote 0

QtechLab

Active Member
Licensed User
Longtime User
Good
I'm a bit green on this so after searching the forum and not finding anything about it, who did I ask?
Someone use ESP8266 or ESP32 to create a device compatible with YOUR APP?
Some point to start a library, a website or something.
Thank you so much.
Personally i would made the ESP a tcp server.

The ESP server would handle some “commands”:

CMD_READ = 1
Return a stream of byte with the info of all the io pins or what you need

CMD_SET = 2
+ byte of the IO pin you want to change
+ bytes of settings
Return CMD_OK (value you want)

CMD_SET_ALL = 3
+ All bytes needed to configure the system IO pins
Return CMD_OK

CMD_ONOFF = 4
+ Bytes with all outputs state(If you use less then 9 outputs you can fit the states in one byte)
Return CMD_OK

——-
Android app with a tcp client that respect the tcp protocol tou made and thats it

Good luck with project ?

EDIT:

i just undesrtood too late that you need to interface with an existing service. So all the things above are useless for you. But who knows ?
 
Last edited:
Upvote 0

Gerardo Tenreiro

Active Member
Licensed User
Hello
The intention is to integrate the window control into the TUYA application so that later from TUYA it can be integrated into HOME ASSISTANT or similar.
It is not a question of a management of isolated doors and windows but it has to be able to be fully integrated into the system so that if the windows are in the ventilating position, the heating is turned off, if the door is opened the associated cameras take a photo, yes. The alarm is connected and a window or door is opened, the alarm system is notified, if none of the windows was put in the ventilating position within a set period of time, the air renewal system is connected and so on, many more things.
For this reason, this is a small piece to fit in the whole house and with looking not only at this element but also that it can be integrated into the total.

The option of making an application like this means that it is a product that can be fully integrated into any modern home.

Regarding the MQTT I'm working on it but I don't see a way to integrate it into TUYA and the like. I will continue advancing in that sense to see where I end up.

Thanks for the help.
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Hi, did you find your way with TUYA? I started looking at it today out of curiosity of what TUYA is, since AliExpress is full of TUYA devices and it got my attention. I've watched a video of what TUYA is today which fully explains the concept and then I realized that it is a concept and a company handling it and not just an IoT company (yeah, I know, partly right, since it provides the microcontrollers to embed in smart devices)... So any luck since you are 2 years ahead?
 
Last edited:
Upvote 0

Gerardo Tenreiro

Active Member
Licensed User
Hello
Yes I found the way to TUYA but not with B4R but with TUYA modules directly

That was a project for a window manufacturer that wanted to sell its windows with integrated home automation

My intention was to use an ESP32 with B4R, but instead I ended up using some specific modules from TUYA that they sell at a reasonable price and that have some GPIO pins. They provide the integration part with TUYA, you only have to do the part of your signals and integrate it into their core, so to speak.
They have everything closed and controlled, but you have to follow the rules and you can do things with them
In my case they gave me support from TUYA CHINA directly by email and WHATSAPP in a very friendly and fast way.

The experience was average since they did the business more than me but in the end it is another job. :eek:

Today it is also very fashionable to use HOME ASSISTANT to domotize things, it is different from TUYA in that the total platform is from TUYA and it is turned on and run, but in HOME ASSISTANT you can also integrate the ESP32 or TUYA modules in the application and it is something More open

If you need anything else, don't hesitate to ask.:D

Thank you
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Thank you for the information. And what about the programming language of TUYA Modules?
 
Upvote 0

Gerardo Tenreiro

Active Member
Licensed User
The TUYA modules use C, the program structure and the libraries are provided to you directly by TUYA, as well as the variables that link between your application and its platform.

It is a standard sketch that they have for their modules, there are different modules with more or less GPIOs and capacities, I used the simplest one since the window control was simple.

In addition, the TUYA team guided me through the process, you have to do things according to their standards so that it can be integrated into their platform, that is why all the manufacturers that integrate into TUYA have the same structure and very similar settings, for example The timer setting is already integrated into TUYA in a very specific way so that users can always use it in the same way.

As I mentioned previously, the TUYA platform is very interested in integrating modules from different manufacturers into their collection and they are very willing to have thousands of modules purchased for the devices. The first thing they want to know from TUYA is how many units are expected to be manufactured each year and a brief description of the application.

Now I think they have a code for the ESP32, but I didn't press it just yet because I didn't get a job for it.

I hope the information is useful to you and if anyone else can comment it would be appreciated.
 
Upvote 0
Top