Best TCP based protocol for ESP8266 based devices (WebSockets, UDP, MQTT, HTTP REST)

Hi,

I have a couple of ESP8266 based thermostats and valve controllers that I have connected to Homey. I am currently using UDP for data sharing between these devices, HTTP for communication to a web front end and to Homey. Finally I use web sockets for a logging screen in the web app. I also did something similar for a lamp, which uses MQTT.

I am planning to build a next version of the controller software and also an Homey Thermostat app to go with it, but I am not sure what protocol is best for communication between Homey and the ESP8266 devices. I am considering the following four:

  • HTTP work for Homey and ESP8266, but the ESP8266 only supports 5 connections, plus it’s relatively heavy.
  • Web Sockets not sure if that is supported in Node JS on Homey, and the number of connections is also limited to 5 on the ESP side; it is more lightweight though
  • MQTT, in principle great, but in practice, the current Homey MQTT App seems to be unstable
  • UDP, works well for data sharing between ESP devices, but I am not sure if this works on Homey. Also broadcasting does not seem to work on the ESP devices which off course seriously limits the usefulness

Which one would you advice?

Thanks,
Chris

If you’re happy to offload the HTTP and WebSocket parts to a separate controller (RPi or possibly Homey itself), MQTT on the ESP’s should be sufficient to handle all your use case. You don’t need to use the MQTT Client app on Homey, you can also ship your app with its own MQTT client implementation.

You could also consider moving to ESP32’s.

Thanks for your suggestions, they make sense to me. Would your Tasmota app be a good starting point for this?

My Sonoff app (somewhat) supports Tasmota, but you’ll have better luck using the dedicated Tasmota app.

The ESP Easy app (my app)is created for usage with the ESP Easy firmware for ESP8266/ESP32 based devices. The app and the ESP unit communicate by calling HTTP URL’s on each others IP’s. You can abuse my app by sending custom specially formatted HTTP requests. The trickiest thing you’ll have to conform to is having a /json path that kind-of conforms to the format of ESP Easy.
I can help you set it up if you want.

Other option of course is simply to install the ESP Easy firmware and use that :slight_smile:

Hi Robert,

thanks for the tip, I was able to port the MQTT part of the Tasmota app and it work fine!

Chris

Hi Jolee,

I was not aware of that library, so thanks for pointing that put to me. I did use another library, Homeyduino, that worked fine but with some limitations. One of the devices which I build contains thermostats for up to three rooms and a controller for eight valves. With Homeyduino it was impossible to create multiple virtual device for the same ESP device. It still works kind off, but it is not very user friendly, which is why I decided to build something myself. I also have up to 6 temperature sensors connected and share information between devices.

Would ESP Easy support such a use case?

Chris

It does, actually, that’s why I build the app. I haven’t gotten around to actually putting the hardware together but my intention is to control the Honeywell valves of my floor heating installation using an ESP32.
One ESP unit provides 12 (ESP8266) or 32 (ESP32) slots for ‘tasks’. Those can be filled by using plugins which provide support for certain sensors and actuators. Apart from those slots, you can use all output GPIO ports the cards have available, or even extended ports using extension cards. (I support up to 8 MCP23017 boards)

All ‘tasks’/GPIO ports can be added as separate devices in Homey.

ESP Easy also provides ways to script macro’s on the ESP which you can activate using flowcards or direct HTTP calls.