ESP Rainmaker App reverts to old param values

mdesigner
Posts: 5
Joined: Sun Oct 17, 2021 9:31 pm

ESP Rainmaker App reverts to old param values

Postby mdesigner » Sun Nov 21, 2021 5:50 am

Has anyone experienced an issue with the Rainmaker app reverting to showing incorrect values for parameters?

For example if I change my Hue slider my device updates its color correctly, but then the slider in the app moves back to its previous position after a couple seconds.

Reposting because I'm not sure if my forum posts are going through at all.

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

Re: ESP Rainmaker App reverts to old param values

Postby ESP_Piyush » Mon Nov 22, 2021 5:06 pm

Hello,

All your posts are indeed getting posted and now I see 3 of them :). Will delete 2 later.

I just checked with some older firmware as well as the latest firmware and latest Android app. I was not able to reproduce this issue.
Note that the phone app queries periodically for the param values so that the UI is in sync with the actual values. The issue you mentioned can occur only if the parameter update message sent by device to cloud has failed for some reason or is not formatted correctly, thereby causing the new value to not reflect correctly. Can you check the prints on the device side and see what message it is sending after param updated successfully?

Regards,
Piyush

mdesigner
Posts: 5
Joined: Sun Oct 17, 2021 9:31 pm

Re: ESP Rainmaker App reverts to old param values

Postby mdesigner » Mon Nov 22, 2021 6:57 pm

Yeah, sorry for the spam :shock:

I forgot to mention I've been doing my testing on iOS up to this point. Doing a test on Android now to see if error persists.

Yes, the Android phone app also reverts its values. I am using this line of code to periodically check the stored value:
ESP_LOGI(TAG, "current rmaker color value = %d", esp_rmaker_param_get_val(esp_rmaker_device_get_param_by_name(light_device, "Color"))->val.i);

Here is what log of the ESP IDF monitor when it receives a message from the app to change color from 292 to 100:

I (14521) app_main: current rmaker color value = 292
I (15021) app_main: current rmaker color value = 292
I (15471) esp_rmaker_param: Received params: {"Mididesign.io Logo Light":{"Color":100}}
I (15481) app_main: Received write request via : Cloud
I (15481) app_main: Received value = 100 for Mididesign.io Logo Light - Color
I (15491) esp_rmaker_param: Reporting params: {"Mididesign.io Logo Light":{"Color":100}}
I (15521) app_main: current rmaker color value = 100

The value returned by esp_rmaker_param_get_val changes correctly and does not revert. However the value displayed in the app slider always eventually moves back to the position it was in when the device powered on.

mdesigner
Posts: 5
Joined: Sun Oct 17, 2021 9:31 pm

Re: ESP Rainmaker App reverts to old param values

Postby mdesigner » Mon Nov 22, 2021 7:52 pm

In my previous reply I had not yet noticed the Rainmaker tab in the explorer that displays the current values.

I can confirm that the values in Rainmaker Cloud do NOT update at all - this is clearly why the app values are reverting. However I am not sure how to fix this. I was under the impression that the line:

Code: Select all

esp_rmaker_param_update_and_report(param, val);
in my Rainmaker callback function would properly update the Cloud parameter.

My calls to esp_rmaker_param_update_and_report return ESP_OK so there isn't an error there.

This issue is applying to all parameters including power, meaning none of my updates are properly making it to the cloud. So all the parameters in the app revert back to whatever they were initialized to in esp_rmaker_param_create.

Another point of interest is that if I go to https://dashboard.rainmaker.espressif.com/home/nodes and sign in as the same account that I am signed into Rainmaker on in VSCode, I don't see any devices or nodes at all. I'm not sure if I should be able to though.
Last edited by mdesigner on Tue Nov 23, 2021 1:42 pm, edited 1 time in total.

mdesigner
Posts: 5
Joined: Sun Oct 17, 2021 9:31 pm

Re: ESP Rainmaker App reverts to old param values

Postby mdesigner » Mon Nov 22, 2021 8:18 pm

Reply 3/3 (Please approve them all so I dont look crazy)

I have fixed the issue by adding

Code: Select all

esp_rmaker_report_node_details()
after

Code: Select all

 esp_rmaker_param_update_and_report(param, val)
in my callback function.

However, the documentation says not to use

Code: Select all

esp_rmaker_report_node_details()
in this manner and I have no idea why param_update_and_report fails to update the cloud but report_node_details does. Any idea why this would be happening? Both functions return ESP_OK.

endlessparadigm
Posts: 16
Joined: Mon Oct 25, 2021 4:15 am

Re: ESP Rainmaker App reverts to old param values

Postby endlessparadigm » Mon Nov 22, 2021 10:07 pm

From my understanding, App basically send messages directly to the Node(via cloud or local control). The Node would then have to process the param itself and update the cloud with the new values.

Phone --(write)--> Node --(write)--> Cloud ---(read)---> Phone

If you use the app to update a param then that value is sent to the Node. At this point you should assign a "write callback" that handles that new param value(hue slider). Before returning from the callback make sure to update the param from the node by using
  1. esp_rmaker_param_update_and_report()
function.


Correct me If I'm wrong :D

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

Re: ESP Rainmaker App reverts to old param values

Postby ESP_Piyush » Tue Nov 23, 2021 4:50 pm

Hello,

Thanks for sharing the logs. Seems that the "." in the device name is the culprit in this case. The parameter update handling logic treats the dot as a special delimiter and so the update fails in the cloud backend. For the time being, an easier solution would be to not use dots in the device name. We will find a solution for this and fix in the backend soon.

Note that this name and the user visible name in the apps or Alexa/GVA need not be the same, since the user visible editable name is a separate parameter of type esp.param.name.

mdesigner
Posts: 5
Joined: Sun Oct 17, 2021 9:31 pm

Re: ESP Rainmaker App reverts to old param values

Postby mdesigner » Wed Nov 24, 2021 12:05 am

Amazing. Thanks Piyush, I would not have figured that out. Will be easy to remove the offending ".".

xKidera
Posts: 1
Joined: Thu Mar 02, 2023 5:38 am

Re: ESP Rainmaker App reverts to old param values

Postby xKidera » Thu Mar 02, 2023 5:42 am

ESP_Piyush wrote:
Tue Nov 23, 2021 4:50 pm
Hello,

Thanks for sharing the logs. Seems that the "." in the device name is the culprit in this case. The parameter update handling logic treats the dot as a special delimiter and so the update fails in the cloud backend. For the time being, an easier solution would be to not use dots in the device name. We will find a solution for this and fix in the backend soon.

Note that this name and the user visible name in the apps or Alexa/GVA need not be the same, since the user visible editable name is a separate parameter of type esp.param.name.
There is a way to get the UI name ? I want to use it to alerts.

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

Re: ESP Rainmaker App reverts to old param values

Postby ESP_Piyush » Thu Mar 02, 2023 5:50 pm

If you use `esp_rmaker_param_update_and_notify()` to raise a notification, the phone app indeed reads the corresponding custom name to show in the notification.

Who is online

Users browsing this forum: No registered users and 13 guests