Tips for ESP32 Rainmaker Framework Programming

After a few days of trial & error, I could program my WeAct ESP32 C3 & C6 boards with the Rainmaker Framework.

Here are some tips that might be helpful for building this type of project.

Two nice tutorials (Getting Started):

  1. ESP RainMaker Getting Started with ESP32
  • On/Off Switch
  1. ESP RainMaker Getting Started Tutorial with ESP32 and Arduino IDE
  • On/Off Switch
  • Temperature Device
  • Humidity Device

I) ESP32 Core Version Matters

At first I didn't realize that my Arduino IDE had ESP32 Core 3.1.3 installed. Each Core version contains libraries for specific ESP32 boards, for example:

Core 3.0.1 to 3.1.3 support WeAct ESP32 C3 (the product name is listed for selection)
Core 2.0.17 only generic board names are listed e.g. ESP32C3 Dev Module

Even the "Rainmaker" sketch can be compiled and uploaded successfully, but it may not run. Errors could range from nothing appears, looping, and Claiming failure:

esp-tls-mbedtls: mbedtls_ssl_setup returned -0x7F00
RainMaker esp-tls: create_ssl_handle failed

This happens because each ESP32 device requires a RIGHT ESP32 Core version !! There was a thread here.

Pick a right ESP32 Core version (for correct flash memory generation):
ESP32 C3 - v 2.0.17
ESP32 C6 - v 3.x

However, the board name profile may not support the Rainmaker Framework. For example, when you choose the Board Name WeAct ESP32 C3 (Core 3.x), there will be no Rainmaker entry in the Partition Scheme.

The ESP32 C3 Dev Module should be used instead. And the flash works.

Nonetheless, the WeAct ESP32 C6 is not listed in any Core version, choose the ESP32 C6 Dev Module instead. BTW, the ESP32 C6 Dev is not listed in the low 3.x versions.

II) ESP32 Wi-Fi Provisioning Trick

All Rainmaker ESP32 devices utilize wi-fi provisioning method. A QR code will be generated once the device runs. Once the wi-fi is setup, credential stored on the device, the QR code will not show again.

My WeAct ESP32 C3 runs after pressing the reset button, while my C6 requires power toggle. This is weird !

In order to start wi-fi provisioning again, the credential must be removed from the device by Erase All Flash Before Sketch Upload

There is also the procedure "Holding the Boot Button for 3s" when powering the device, for resetting the wi-fi credential.

The generated text-based QR code must be copied from the Serial Monitor to any text editor for easy scanning. However, coding update may not need to do reprovisioning, just uploading the new sketch and reset the device.

These are the very first basic steps to make your Rainmaker project dance.

III) Tutorials May Not Be Comprehensive

ESP RainMaker Getting Started Tutorial with ESP32 and Arduino IDE

This tutorial provides a simple example for building a Rainmaker project containing 3 devices:

On/Off Switch, Temperature Device and Humidity Device

To create a temperature sensor:

static TemperatureSensor temperature("Temperature");
...
void setup()
{
  //declare node
  Node my_node;
  my_node = RMaker.initNode("Microcontrollerslab");

  button.addCb(write_callback);
  //Add devices
  my_node.addDevice(temperature);
...
}

There are 4 standard device classes defined for easy coding such as Switch, LightBulb, Fan, and TemperatureSensor. See the RMakeDevice.h

But the Rainmaker Framework support many other Devices, see Standard Predefined Types.

So, if you need to create a Contact Sensor device, then you need to follow the Rainmaker coding guideline, for example:

static Device *contactsensor;
...
void setup()
{
   contactsensor = new Device("Contact Sensor", "esp.device.contact-sensor", NULL);
   contactsensor->addNameParam();
   Param deviceParam("Contact Detection State", "esp.param.contact-detection-state" , value(false), PROP_FLAG_READ); 
   contactsensor->addParam(deviceParam);
   my_node.addDevice(*contactsensor);    
...
}

void loop()
{
  contactsensor->updateAndReportParam("Contact Detection State", true);
}

That's it. Enjoy Rainmaking !!

Thanks for the information, I know many will appreciate it.

Yes. I have been pulling my hairs for months before. :rolling_on_the_floor_laughing:

There is very little information on this for the DIY community. Maybe you need to be a commercial developer to access comprehensive getting-started tutorials.

Now, I could not be more than happy :zany_face:

You can add any device into Google Home on your mobile phone !!

Each (Alexa/GVA) device has different behaviors that you can set up in the Automation configuration, on both Rainmaker App and Google Home.

For example, the Door Bell and Security Device can send a push notification to your mobile screen. Google Assistant offers an experimental feature, in the Automation, that allows you to put any command:

Create an event "xxxx" in my calendar in the next 1 minute.

Ta da.. Your ESP32 can create an alarm in your calendar.

But permission is required in your Google Home: Enable "Allow Personal Results" in Google Home App

You can do complex automation. Check out this page Create advanced home automations with the script editor and nice demos by Reed.

BTW, don't forget to Connect ESP RainMaker with Google Home App.

Enjoy your Rain.

how about time series data? have you tried it? for months that thing stresses me out and I can't figure out how to utilize that part even to this day

I have installed the ESP32 Core version 3.1.3
Does that mean that only version, ESP32 Core version 2.0 works with the ESP32 Module:
ESP32-WROOM-32, ESP32-WROOM-32D y ESP32-WROOM-32E?
Is that why I can't use version 3.1.3 with those modules?

Have you tried them out ?

You may share your discoveries here.