Hi, the last few months I’ve been working on this project of mine called esphomelib. It’s a library designed to greatly simplify your firmware code for ESP32-based devices and has great integration with Home Assistant through MQTT. You can find it here: https://github.com/OttoWinter/esphomelib
With its powerful core, the aim is to make creating things such as lights - which can often be very complicated with effects, etc. - extremely easy to create in code, so that you can focus on making the hardware, not the software for your boards.
I think an example can really show off how easy this library is to use. The following code shows how you can create an RGB light that will automatically show up in Home Assistant through MQTT discovery. This would have taken huge amounts of code and time without esphomelib.
#include "esphomelib/application.h"
using namespace esphomelib;
Application app;
void setup() {
app.set_name("livingroom");
app.init_log();
app.init_wifi("YOUR_SSID", "YOUR_PASSWORD");
app.init_mqtt("MQTT_HOST", "USERNAME", "PASSWORD");
auto *red = app.make_ledc_component(32); // on pin 32
auto *green = app.make_ledc_component(33);
auto *blue = app.make_ledc_component(34);
app.make_rgb_light("Livingroom Light", red, green, blue);
app.setup();
}
void loop() { app.loop(); }
esphomelib tries to be extremely easy to use by abstracting between the back-end (which provides sensor data, PWM, …) and the MQTT front-end and it comes with support for lots of devices and sensors out-of-the-box. In the above code, you could, for example, just switch out the RGB channels with a PCA9685 PWM board, and the light component would still work without a problem.
I’m writing this because I’d like to get some feedback before adding support for more devices. My questions are:
- If you had to re-code all of your espressif microcontrollers, would you consider using this library?
- Are there any features/devices you would really like to see support for?
- Would you like to see ESP8266 support?
- Any general feedback?
Thank you!