jhthorsen / homebridge-tasmota-aircon-http

Control Aircon through Tasmota HTTP commands
MIT License
4 stars 2 forks source link

Save state between restarts #11

Open macjl opened 2 years ago

macjl commented 2 years ago

Hello,

I changed the code to use the last release of node-persist.

jhthorsen commented 2 years ago

The tests are complaining about storage.setItem is not a function. I don't think this really uses the latest version..?

macjl commented 2 years ago

I finally understood why the tests are not working. As the init() function is async, the storage may not be initialized when the test runs the setItem() function. In real life, this will probably never happen, because the storage will be initialized fast enough before the user changes a parameter in HomeKit. I will look how to change the tests to wait for initialization of storage before calling setItem(). May you have an idea to do it ?