-
How should we implementing persistent accessories in HomeSpan? For example, restoring a switch's power state to the previous value after a reboot. I notice HomeSpan is already using nvs/flash to store wifi credentials and info about the accessory database. (The library seems to handle quite a lot already, so I'm half expecting I'm just missing info somewhere in the docs!) PS. Merry Xmas. 🎅🤶🎄 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Merry Xmas as well! I recommend you use the NVS structure to store persistent state variables. The native esp32 functions are fairly straightforward and very flexible so I did not create any special HomeSpan handlers. By using the NVS protocol (instead of the emulated Arduino EEPROM functions) you can create your own name space in the NVS partition without worrying about colliding with any of the HomeSpan spaces. I'll probably add a list of the HomeSpan space names to the documentation so users know which names NOT to use. I will shortly be publishing the code for two real-world devices I created with HomeSpan to control a few appliances in my home. Both use an RF transmitter (which was the original impetus for HomeSpan) and one of them (my version of a universal controller for Somfy motorized window shades) requires saving a "rolling code." You'll be able to see exactly how to do that using NVS. |
Beta Was this translation helpful? Give feedback.
-
I notice you've posted some demo project repos, notably the Somfy example with use of ESP32 NVS. Thanks, I'll take a deeper look. |
Beta Was this translation helpful? Give feedback.
Merry Xmas as well! I recommend you use the NVS structure to store persistent state variables. The native esp32 functions are fairly straightforward and very flexible so I did not create any special HomeSpan handlers. By using the NVS protocol (instead of the emulated Arduino EEPROM functions) you can create your own name space in the NVS partition without worrying about colliding with any of the HomeSpan spaces. I'll probably add a list of the HomeSpan space names to the documentation so users know which names NOT to use.
I will shortly be publishing the code for two real-world devices I created with HomeSpan to control a few appliances in my home. Both use an RF transmitter (which was t…