ESP RAINMAKER

ESP RAINMAKER

  • Docs
  • API
  • Help
  • Blog
  • GitHub

›Develop Firmware

Get Started

  • Get Started

Develop Firmware

  • Basics
  • Standard Types

Specifications

  • Concepts
  • Node - Cloud communication
  • Client - Cloud communication
  • User - Node Mapping
  • Claiming

Services

  • OTA FW Upgrades
  • Time Service
  • Scheduling

CLI

  • Setup
  • Usage

3rd Party Integrations

  • 3rd Party Integrations

Other Features

  • Node Sharing
  • Local Control

What's Next?

  • What's Next?

Standard Predefined Types

Creating a Device generally requires multiple calls. For example, creating a Lightbulb with name, power and brightness would need:

esp_rmaker_device_t *device = esp_rmaker_device_create("Light", NULL, NULL);

esp_rmaker_device_add_param(device, esp_rmaker_param_create("name", NULL, esp_rmaker_str("Light"),
            PROP_FLAG_READ | PROP_FLAG_WRITE | PROP_FLAG_PERSIST));

esp_rmaker_param_t *power_param = esp_rmaker_param_create("power", NULL, esp_rmaker_bool(true), PROP_FLAG_READ | PROP_FLAG_WRITE);
esp_rmaker_param_add_ui_type(power_param, ESP_RMAKER_UI_TOGGLE);
esp_rmaker_device_add_param(device, power_param);
esp_rmaker_device_assign_primary_param(device, power_param);

esp_rmaker_param_t *brightness_param = esp_rmaker_param_create("brightness", NULL, esp_rmaker_int(100), PROP_FLAG_READ | PROP_FLAG_WRITE);
esp_rmaker_param_add_ui_type(brightness_param, ESP_RMAKER_UI_SLIDER);
esp_rmaker_param_add_bounds(brightness_param, esp_rmaker_int(0), esp_rmaker_int(100), esp_rmaker_int(1));
esp_rmaker_device_add_param(device, brightness_param);

This flexibility is useful as it lets you define any type of device. However, to simplify some common use cases, we have defined some standard types and have added helper APIs for them. Using standard types, the above code will get reduced to this:

light_device = esp_rmaker_lightbulb_device_create("Light", NULL, true);
esp_rmaker_device_add_cb(light_device, write_cb, NULL);

esp_rmaker_device_add_param(light_device, esp_rmaker_brightness_param_create("brightness", 100));

These standard types are also useful for defining some special handling in phone apps or other third party applications like Alexa or Google Voice Assistants. Below is a list of standard devices, services, parameters and ui elements. This list will keep updating as we add new types.

Devices

Parameters in Bold are mandatory.
* indicates primary parameter.

C APIs to implement these can be found here.

NameTypeParamsPrimaryImage
Switchesp.device.switchName, Power*Power
Lightbulbesp.device.lightbulbName, Power*, Brightness, Color Temperature, Hue, Saturation, IntensityPower
Fanesp.device.fanName, Power*, Speed, DirectionPower
Temperature Sensoresp.device.temperature-sensorName, Temperature*Temperature

Services

Parameters in Bold are mandatory.

C APIs to implement these can be found here.

NameTypeParams
OTAesp.service.otaOTA URL, OTA Status, OTA Info

Parameters

C APIs to implement these can be found here.

NameTypeData TypeUI TypeProp-
erties
Min, Max, Step
Nameesp.param.nameStringRead, Write1, 32, -
Poweresp.param.powerBoolesp.ui.toggleRead, Write
Brightnessesp.param.brightnessIntesp.ui.sliderRead, Write0, 100, 1
Color Temperatureesp.param.cctIntesp.ui.sliderRead, Write2700, 6500, 100
Hueesp.param.hueIntesp.ui.sliderRead, Write0, 360, 1
Saturationesp.param.saturationIntesp.ui.sliderRead, Write0, 100, 1
Intensityesp.param.intensityIntesp.ui.sliderRead, Write0, 100, 1
Speedesp.param.speedIntesp.ui.sliderRead, Write0, 5, 1
Directionesp.param.directionIntesp.ui.dropdownRead, Write0, 1, 1
Temperatureesp.param.temperatureFloatRead
OTA URLesp.param.ota_urlStringWrite
OTA Statusesp.param.ota_statusStringRead
OTA Infoesp.param.ota_infoStringRead

UI Elements

These define how the parameters should be rendered in the Phone apps.

NameTypeData TypesRequirementsSample
Text (Default)esp.ui.textAllN/A
Toggle Switchesp.ui.toggleBoolN/A
Slideresp.ui.sliderInt, FloatBounds (min, max)
← BasicsConcepts →
  • Devices
  • Services
  • Parameters
  • UI Elements
Copyright © 2021 Espressif SystemsPrivacy PolicyTerms of Use