I am trying to resolve issue with air-conditioning unit. Unit itself is Sinclair one, connected to WiFi. It can be managed via its own application on iOS. It is based on Gree protocol, so it can be managed with OH via Gree binding and it is working fine. I can the unit in OH and I can manage it somehow.
What I need to achieve is that I want to power it off in specific time and then power it on again, but with same settings as it was before power off. E.g. imagine that I have in certain time cheaper energy. I have switch (e.g. local cost energy ON or OFF) and if this switch goes OFF I want to power off the Unit (again there is simple switch for it in OH). Then low cost energy switch goes ON and I want to power AC unit AC, but with setting which were there before power off. All these details are in OH, like mode, fan speed, temperature etc.
Is there any way how to store these details and re-use it?
Even if the unit was OFF before low cost energy went OFF, I want to keep it OFF once low cost energy went ON.
See Actions | openHAB storeStates and restoreStates, but that will only save the values as a variable in the rule. You’ll lose the values if OH restarts or you reload the rule.
For a more robust solution you’ll want to use Persistence. Make sure all the Items you need are stored in persistence (note: rrd4j which is the default does not store all Item types). Create a DateTime Item that you will populate with the instant right before you turned off the AC. When it’s time to restore the Items, get the historic state of each Item using that DateTime Item’s state as the timestamp and command the Items with the retrieved states.
Be careful though as not all Item type’s states can be used as commands. If you run into trouble come back and we can work through it.
Comment ; you might need to think about storing some/all saved states in separate Items. For example, when the device does power up and reports “target temperature” or something like, that will trample over any linked openHAB Item from before, persisted or not.