get parameter values

djewiss
Posts: 1
Joined: Wed Jun 19, 2019 10:44 pm

get parameter values

Postby djewiss » Mon May 24, 2021 9:28 pm

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

ESP_Piyush
Posts: 309
Joined: Wed Feb 20, 2019 7:02 am

Re: get parameter values

Postby ESP_Piyush » Mon May 31, 2021 5:02 pm

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

Who is online

Users browsing this forum: No registered users and 56 guests