Open sijoalexjohnson opened 1 year ago
@sijoalexjohnson , are you using the default switch example as it is, or is it some modified code?
Im using arduino code in the esp32.
I think arduino rainmaker example code have this issue. Using esp-idf its working fine
Hi @sijoalexjohnson,
This issue arises because, in the Switch example, the variable my_switch
is initialized outside the setup()
function. The statement static Switch my_switch("Switch", &gpio_switch);
creates all parameters (name, power) and tries to read their stored values from nvs before nvs has been initialized. Hence, it does not read the name from storage on reboot.
To fix this, you need to make the following changes:
static Switch my_switch;
setup()
function
void setup()
{
my_switch = Switch("Switch", &gpio_switch);
// Existing Code
}
I've tested this on ESP32 using Arduino Switch Example.
Best Regards, Sanket
Hi @sanketwadekar Thanks. i have tested, its working fine. Regards SijO
in the ESP32 firmware if we name the Switch as Switch1. After connecting to the mobile APP if we change the Switch name to Light it reflect in the APP. after restarting the ESP32 hardware . the App shows previous name Switch 1 only. how to solve this issue. Can you update this in the next version.
Switch name is Switch 1
Renamed Switch 1 name as Light
After reboot the esp32 hardware . App shows previous name
![5](https://user-images.githubusercontent.com/8470062/180394312-f4acb6c5-7c56-4d9c-904e-9fe4e01cfb79.jpeg)