JohanBendz / tech.sonoff

MIT License
3 stars 5 forks source link

Changing settings for TH01/SNZB-02/SNZB-02D has mostly no effect or throws an error #18

Open Boechie opened 1 month ago

Boechie commented 1 month ago

In most of the tries saving settings for TH01/SNZB-02/SNZB-02D devices, a timeout is thrown. This is caused by these devices being sleepy end devices. Restarting the app as proposed in the tooltip on the settings screen does not solve this (i.e. the setting actually getting into effect). Pressing the button on the device within the timeout period, prevents that the timeout exception is thrown during saving settings. However, when saving the settings succeeds, the old settings are saved again, not the newly changed settings. The new settings only get saved after restarting the app (during onNodeInit) in the very lucky case that your device is not sleeping at that time. I found some suboptimalities and errors in the code to save settings. I will propose a PR that solves those.