Page 1 of 1

get parameter values

Posted: Mon May 24, 2021 9:28 pm
by djewiss
Hi There

I have a parameter that I have created-

Code: Select all

    sched_param = esp_rmaker_power_param_create("Schedule", DEFAULT_POWER);
    esp_rmaker_device_add_param(switch_device, sched_param);
    esp_rmaker_device_assign_primary_param(switch_device, sched_param);
I am controlling this parameter through a schedule (on at 5am and off at 5pm). And I am trying to get the value of this parameter, how do I do this?

I tried

Code: Select all

sched_param = esp_rmaker_device_get_param_by_name(switch_device, "Schedule");
But I am unsure how to get value of the parameter from this.

Regards Darryl

Re: get parameter values

Posted: Mon May 31, 2021 5:02 pm
by ESP_Piyush
Hi Darryl,

We are adding an API to read the parameter values, but I do not think that is what you are looking for.

RainMaker already has a schedules service which maintains everything for you internally. You can find more information about that here. This is well integrated in the phone apps, so you don't even have to worry about passing correct payloads to the service (even though you can do that as well, by checking out this section. When a schedule triggers for any parameter, the callback for the given device gets invoked, with the request source value set to ESP_RMAKER_REQ_SRC_SCHEDULE. You can check this code to see how to find the request source in a write callback.

I hope this helps. Let us know if you were looking for something else.

Regards,
Piyush