Skip to main content

Can I use custom device types instead of standard types?

Yes. Standard types (e.g., Switch, LightBulb, Fan) are helpers that provide better default integration with phone apps and voice assistants. You can create fully custom device types and parameters for any use case (e.g., soil moisture, water level, air cooler).

Create a custom device:

esp_rmaker_device_t *device = esp_rmaker_device_create("Air Cooler", "my.device.air-cooler", NULL);
esp_rmaker_device_add_cb(device, write_cb, NULL);

/* Add parameters with esp_rmaker_param_create(), bounds, UI types */
esp_rmaker_param_t *power_param = esp_rmaker_power_param_create("Power", true);
esp_rmaker_device_add_param(device, power_param);
esp_rmaker_device_assign_primary_param(device, power_param);

/* Add custom params: toggle, slider, dropdown */
esp_rmaker_param_t *speed = esp_rmaker_param_create("Speed", "esp.param.range",
esp_rmaker_int(3), PROP_FLAG_READ | PROP_FLAG_WRITE);
esp_rmaker_param_add_ui_type(speed, ESP_RMAKER_UI_SLIDER);
esp_rmaker_param_add_bounds(speed, esp_rmaker_int(0), esp_rmaker_int(5), esp_rmaker_int(1));
esp_rmaker_device_add_param(device, speed);

esp_rmaker_node_add_device(node, device);

For details, see Custom Types & Standard Types.