RainMaker Standard Types

Standard Types

Macros

ESP_RMAKER_UI_TOGGLE
ESP_RMAKER_UI_SLIDER
ESP_RMAKER_UI_DROPDOWN
ESP_RMAKER_UI_TEXT
ESP_RMAKER_PARAM_NAME
ESP_RMAKER_PARAM_POWER
ESP_RMAKER_PARAM_BRIGHTNESS
ESP_RMAKER_PARAM_HUE
ESP_RMAKER_PARAM_SATURATION
ESP_RMAKER_PARAM_INTENSITY
ESP_RMAKER_PARAM_CCT
ESP_RMAKER_PARAM_SPEED
ESP_RMAKER_PARAM_DIRECTION
ESP_RMAKER_PARAM_TEMPERATURE
ESP_RMAKER_PARAM_OTA_STATUS
ESP_RMAKER_PARAM_OTA_INFO
ESP_RMAKER_PARAM_OTA_URL
ESP_RMAKER_PARAM_TIMEZONE
ESP_RMAKER_PARAM_TIMEZONE_POSIX
ESP_RMAKER_PARAM_SCHEDULES
ESP_RMAKER_DEVICE_SWITCH
ESP_RMAKER_DEVICE_LIGHTBULB
ESP_RMAKER_DEVICE_FAN
ESP_RMAKER_DEVICE_TEMP_SENSOR
ESP_RMAKER_SERVICE_OTA
ESP_RMAKER_SERVICE_TIME
ESP_RMAKER_SERVICE_SCHEDULE

Standard Parameters

Functions

esp_rmaker_param_t *esp_rmaker_name_param_create(const char *param_name, const char *val)

Create standard name param

This will create the standard name parameter. This should be added to all devices for which you want a user customisable name. The value should be same as the device name.

All standard device creation APIs will add this internally. No application registered callback will be called for this parameter, and changes will be managed internally.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

esp_rmaker_param_t *esp_rmaker_power_param_create(const char *param_name, bool val)

Create standard Power param

This will create the standard power parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter

esp_rmaker_param_t *esp_rmaker_brightness_param_create(const char *param_name, int val)

Create standard Brightness param

This will create the standard brightness parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter

esp_rmaker_param_t *esp_rmaker_hue_param_create(const char *param_name, int val)

Create standard Hue param

This will create the standard hue parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter

esp_rmaker_param_t *esp_rmaker_saturation_param_create(const char *param_name, int val)

Create standard Saturation param

This will create the standard saturation parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter

esp_rmaker_param_t *esp_rmaker_intensity_param_create(const char *param_name, int val)

Create standard Intensity param

This will create the standard intensity parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter

esp_rmaker_param_t *esp_rmaker_cct_param_create(const char *param_name, int val)

Create standard CCT param

This will create the standard cct parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter

esp_rmaker_param_t *esp_rmaker_direction_param_create(const char *param_name, int val)

Create standard Direction param

This will create the standard direction parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter

esp_rmaker_param_t *esp_rmaker_speed_param_create(const char *param_name, int val)

Create standard Speed param

This will create the standard speed parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter

esp_rmaker_param_t *esp_rmaker_temperature_param_create(const char *param_name, float val)

Create standard Temperature param

This will create the standard temperature parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter

esp_rmaker_param_t *esp_rmaker_ota_status_param_create(const char *param_name)

Create standard OTA Status param

This will create the standard ota status parameter. Default value is set internally.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

esp_rmaker_param_t *esp_rmaker_ota_info_param_create(const char *param_name)

Create standard OTA Info param

This will create the standard ota info parameter. Default value is set internally.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

esp_rmaker_param_t *esp_rmaker_ota_url_param_create(const char *param_name)

Create standard OTA URL param

This will create the standard ota url parameter. Default value is set internally.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

esp_rmaker_param_t *esp_rmaker_timezone_param_create(const char *param_name, const char *val)

Create standard Timezone param

This will create the standard timezone parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter (Eg. “Asia/Shanghai”). Can be kept NULL.

esp_rmaker_param_t *esp_rmaker_timezone_posix_param_create(const char *param_name, const char *val)

Create standard POSIX Timezone param

This will create the standard posix timezone parameter.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] val: Default Value of the parameter (Eg. “CST-8”). Can be kept NULL.

esp_rmaker_param_t *esp_rmaker_schedules_param_create(const char *param_name, int max_schedules)

Create standard schedules param

This will create the standard schedules parameter. Default value is set internally.

Return

Parameter handle on success.

Return

NULL in case of failures.

Parameters
  • [in] param_name: Name of the parameter

  • [in] max_schedules: Maximum number of schedules allowed

Macros

ESP_RMAKER_DEF_NAME_PARAM
ESP_RMAKER_DEF_POWER_NAME
ESP_RMAKER_DEF_BRIGHTNESS_NAME
ESP_RMAKER_DEF_HUE_NAME
ESP_RMAKER_DEF_SATURATION_NAME
ESP_RMAKER_DEF_INTENSITY_NAME
ESP_RMAKER_DEF_CCT_NAME
ESP_RMAKER_DEF_DIRECTION_NAME
ESP_RMAKER_DEF_SPEED_NAME
ESP_RMAKER_DEF_TEMPERATURE_NAME
ESP_RMAKER_DEF_OTA_STATUS_NAME
ESP_RMAKER_DEF_OTA_INFO_NAME
ESP_RMAKER_DEF_OTA_URL_NAME
ESP_RMAKER_DEF_TIMEZONE_NAME
ESP_RMAKER_DEF_TIMEZONE_POSIX_NAME
ESP_RMAKER_DEF_SCHEDULE_NAME

Standard Devices

Functions

esp_rmaker_device_t *esp_rmaker_switch_device_create(const char *dev_name, void *priv_data, bool power)

Create a standard Switch device

This creates a Switch device with the mandatory parameters and also assigns the primary parameter. The default parameter names will be used. Refer esp_rmaker_standard_params.h for default names.

Return

Device handle on success.

Return

NULL in case of failures.

Parameters
  • [in] dev_name: The unique device name

  • [in] priv_data: (Optional) Private data associated with the device. This should stay allocated throughout the lifetime of the device #

  • [in] power: Default value of the mandatory parameter “power”

esp_rmaker_device_t *esp_rmaker_lightbulb_device_create(const char *dev_name, void *priv_data, bool power)

Create a standard Lightbulb device

This creates a Lightbulb device with the mandatory parameters and also assigns the primary parameter. The default parameter names will be used. Refer esp_rmaker_standard_params.h for default names.

Return

Device handle on success.

Return

NULL in case of failures.

Parameters
  • [in] dev_name: The unique device name

  • [in] priv_data: (Optional) Private data associated with the device. This should stay allocated throughout the lifetime of the device

  • [in] power: Default value of the mandatory parameter “power”

esp_rmaker_device_t *esp_rmaker_fan_device_create(const char *dev_name, void *priv_data, bool power)

Create a standard Fan device

This creates a Fan device with the mandatory parameters and also assigns the primary parameter. The default parameter names will be used. Refer esp_rmaker_standard_params.h for default names.

Return

Device handle on success.

Return

NULL in case of failures.

Parameters
  • [in] dev_name: The unique device name

  • [in] priv_data: (Optional) Private data associated with the device. This should stay allocated throughout the lifetime of the device

  • [in] power: Default value of the mandatory parameter “power”

esp_rmaker_device_t *esp_rmaker_temp_sensor_device_create(const char *dev_name, void *priv_data, float temperature)

Create a standard Temperature Sensor device

This creates a Temperature Sensor device with the mandatory parameters and also assigns the primary parameter. The default parameter names will be used. Refer esp_rmaker_standard_params.h for default names.

Return

Device handle on success.

Return

NULL in case of failures.

Parameters
  • [in] dev_name: The unique device name

  • [in] priv_data: (Optional) Private data associated with the device. This should stay allocated throughout the lifetime of the device

  • [in] temperature: Default value of the mandatory parameter “temperature”

Standard Services

Functions

esp_rmaker_device_t *esp_rmaker_ota_service_create(const char *serv_name, void *priv_data)

Create a standard OTA service

This creates an OTA service with the mandatory parameters. The default parameter names will be used. Refer esp_rmaker_standard_params.h for default names.

Return

service_handle on success.

Return

NULL in case of any error.

Parameters
  • [in] serv_name: The unique service name

  • [in] priv_data: (Optional) Private data associated with the service. This should stay allocated throughout the lifetime of the service.

esp_rmaker_device_t *esp_rmaker_time_service_create(const char *serv_name, const char *timezone, const char *timezone_posix, void *priv_data)

Create a standard OTA service

This creates an OTA service with the mandatory parameters. The default parameter names will be used. Refer esp_rmaker_standard_params.h for default names.

Return

service_handle on success.

Return

NULL in case of any error.

Parameters
  • [in] serv_name: The unique service name

  • [in] timezone: Default value of timezone string (Eg. “Asia/Shanghai”). Can be kept NULL.

  • [in] timezone_posix: Default value of posix timezone string (Eg. “CST-8”). Can be kept NULL.

  • [in] priv_data: (Optional) Private data associated with the service. This should stay allocated throughout the lifetime of the service.

esp_rmaker_device_t *esp_rmaker_create_schedule_service(const char *serv_name, esp_rmaker_device_write_cb_t write_cb, esp_rmaker_device_read_cb_t read_cb, int max_schedules, void *priv_data)

Create a standard Schedule service

This creates a Schedule service with the mandatory parameters. The default parameter names will be used. Refer esp_rmaker_standard_params.h for default names.

Return

service_handle on success.

Return

NULL in case of any error.

Parameters
  • [in] serv_name: The unique service name

  • [in] write_cb: Write callback.

  • [in] read_cb: Read callback.

  • [in] max_schedules: Maximum number of schedules supported.

  • [in] priv_data: (Optional) Private data associated with the service. This should stay allocated throughout the lifetime of the service.