RainMaker Standard Types

Standard Types

Macros

ESP_RMAKER_UI_TOGGLE
ESP_RMAKER_UI_SLIDER
ESP_RMAKER_UI_DROPDOWN
ESP_RMAKER_UI_TEXT
ESP_RMAKER_UI_HUE_SLIDER
ESP_RMAKER_UI_HUE_CIRCLE
ESP_RMAKER_UI_PUSHBUTTON
ESP_RMAKER_UI_TRIGGER
ESP_RMAKER_UI_HIDDEN
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_PARAM_SCENES
ESP_RMAKER_PARAM_REBOOT
ESP_RMAKER_PARAM_FACTORY_RESET
ESP_RMAKER_PARAM_WIFI_RESET
ESP_RMAKER_PARAM_LOCAL_CONTROL_POP
ESP_RMAKER_PARAM_LOCAL_CONTROL_TYPE
ESP_RMAKER_PARAM_TOGGLE
ESP_RMAKER_PARAM_RANGE
ESP_RMAKER_PARAM_MODE
ESP_RMAKER_PARAM_BLINDS_POSITION
ESP_RMAKER_PARAM_GARAGE_POSITION
ESP_RMAKER_PARAM_LIGHT_MODE
ESP_RMAKER_PARAM_AC_MODE
ESP_RMAKER_DEVICE_SWITCH
ESP_RMAKER_DEVICE_LIGHTBULB
ESP_RMAKER_DEVICE_FAN
ESP_RMAKER_DEVICE_TEMP_SENSOR
ESP_RMAKER_DEVICE_LIGHT
ESP_RMAKER_DEVICE_OUTLET
ESP_RMAKER_DEVICE_PLUG
ESP_RMAKER_DEVICE_SOCKET
ESP_RMAKER_DEVICE_LOCK
ESP_RMAKER_DEVICE_BLINDS_INTERNAL
ESP_RMAKER_DEVICE_BLINDS_EXTERNAL
ESP_RMAKER_DEVICE_GARAGE_DOOR
ESP_RMAKER_DEVICE_GARAGE_LOCK
ESP_RMAKER_DEVICE_SPEAKER
ESP_RMAKER_DEVICE_AIR_CONDITIONER
ESP_RMAKER_DEVICE_THERMOSTAT
ESP_RMAKER_DEVICE_TV
ESP_RMAKER_DEVICE_WASHER
ESP_RMAKER_DEVICE_OTHER
ESP_RMAKER_SERVICE_OTA
ESP_RMAKER_SERVICE_TIME
ESP_RMAKER_SERVICE_SCHEDULE
ESP_RMAKER_SERVICE_SCENES
ESP_RMAKER_SERVICE_SYSTEM
ESP_RMAKER_SERVICE_LOCAL_CONTROL

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

  • [in] val: The device name

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

esp_rmaker_param_t *esp_rmaker_scenes_param_create(const char *param_name, int max_scenes)

Create standard Scenes param

This will create the standard scenes 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_scenes: Maximum number of scenes allowed

esp_rmaker_param_t *esp_rmaker_reboot_param_create(const char *param_name)

Create standard Reboot param

This will create the standard reboot parameter. Set value to true (via write param) for the action to trigger.

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_factory_reset_param_create(const char *param_name)

Create standard Factory Reset param

This will create the standard factory reset parameter. Set value to true (via write param) for the action to trigger.

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_wifi_reset_param_create(const char *param_name)

Create standard Wi-Fi Reset param

This will create the standard Wi-Fi Reset parameter. Set value to true (via write param) for the action to trigger.

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_local_control_pop_param_create(const char *param_name, const char *val)

Create standard Local Control POP param

This will create the standard Local Control POP 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. “abcd1234”). Can be kept NULL.

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

Create standard Local Control Type param

This will create the standard Local Control security type 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

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
ESP_RMAKER_DEF_SCENES_NAME
ESP_RMAKER_DEF_REBOOT_NAME
ESP_RMAKER_DEF_FACTORY_RESET_NAME
ESP_RMAKER_DEF_WIFI_RESET_NAME
ESP_RMAKER_DEF_LOCAL_CONTROL_POP
ESP_RMAKER_DEF_LOCAL_CONTROL_TYPE

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.

esp_rmaker_device_t *esp_rmaker_create_scenes_service(const char *serv_name, esp_rmaker_device_write_cb_t write_cb, esp_rmaker_device_read_cb_t read_cb, int max_scenes, bool deactivation_support, void *priv_data)

Create a standard Scenes service

This creates a Scenes 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_scenes: Maximum number of scenes supported.

  • [in] deactivation_support: Deactivation callback support.

  • [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_system_service(const char *serv_name, void *priv_data)

Create a standard System service

This creates an empty System service. Appropriate parameters should be added by the caller.

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_create_local_control_service(const char *serv_name, const char *pop, int sec_type, void *priv_data)

Create a standard Local Control service

This creates a Local Control 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] pop: Proof of possession

  • [in] sec_type: Security type

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