jhthorsen / homebridge-tasmota-aircon-http

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

Save state between restarts #4

Open macjl opened 2 years ago

macjl commented 2 years ago

Hello,

I’ve found that at Homebridge restart, the AC devices provided by this plugin are set to off, with 20°C temperatures.

It’s not synchronized to the real state of AC, that could have been set to On, with different temperatures, or fan speed previously.

I think the plugin should save the last state at each commands, and restore it at launch. This would avoid this issue.

I don’t know how to do it, or if there are Homebridge function to do it. If you have an idea and can tell me where to search, I can try to submit a PR if you are ok with it.

jhthorsen commented 2 years ago

Sounds like an excellent addition! I looked at #6, which I think is a very good start. I'm curious if you have a reference Homebridge plugin that also use https://www.npmjs.com/package/node-persist ?

jhthorsen commented 2 years ago

I'm going to close this issue, since I'm confident #7 will get merged. Great work!

jhthorsen commented 2 years ago

Sorry, but I had to revert the commit, since it broke all the tests and was using an old version of node-persist.

macjl commented 2 years ago

Hello, Did you see the update I made on the PR ? It now uses the last version of node-persist. But I did not look at the tests for now.

jhthorsen commented 2 years ago

Yes, I did: https://github.com/jhthorsen/homebridge-tasmota-aircon-http/pull/11#issuecomment-1139635704