espressif / esp-rainmaker

ESP RainMaker Agent for firmware development
Apache License 2.0
433 stars 146 forks source link

Rainmaker doesnt sync after power cycle (MEGH-3752) #160

Closed Mri007 closed 1 year ago

Mri007 commented 1 year ago

The esp32 doesnt sync with cloud after powering off and turning back on.

sanketwadekar commented 1 year ago

Please provide more details about the issue. It will also help if you provide logs.

Mri007 commented 1 year ago

Suppose i have one light turned on from mobile app. It remain on till i turn off esp32. After re-powering esp the light remain off.. It doesnt sync with cloud after connecting to wifi i.e. turn the light on again.

shahpiyushv commented 1 year ago

@Mri007 , we do not have logic of fetching previous state from cloud because it is not guaranteed that the cloud has the latest state. Instead, there is an option to store it in nvs memory. You just need to add the PROP_FLAG_PERSIST as shown here. Then, after a reboot, the RainMaker core code will invoke your callbacks with the values from nvs. Note that the write callback should be registered for the device before adding the param, for this to work.

shahpiyushv commented 1 year ago

Closing this issue as appropriate solution has been provided.