- Platform information:
- Hardware: Raspberry Pi 4 4Gb
- OS: openHabian
- openHAB version: openHAB 3.2.0
- Zigbee2MQTTversion: 1.24.0
What can I do so that openHab can restore the last state of a device connected via zigbee2mqtt? There are several dimmers YSR-MINI-01_dimmer (YSRSAI YSR-MINI-01_dimmer control via MQTT | Zigbee2MQTT). The problem is that when the electricity disappears and appears, they automatically turn on. Devices do not know how to save the last state.
How can I make it so that openhab can control them? If the dimmer was turned off before the power outage, then so that when the power comes on it would remain off. And vice versa.
I read about Persistence in the official documentation. In the \openHAB-conf\persistence folder, I created the rrd4j.persist file in which I specified the Items that should save their state. In the Settings->Persistence menu, I selected the item
RRD4j. But in a test power outage, it didn’t work.
// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
// for rrd charts, we need a cron strategy
everyMinute : "0 * * * * ?"
}
Items {
Bra_Left_Living_room_On_Off, Bra_Right_Living_room_On_Off, Countertop_Lighting_Kitchen_On_Off : strategy = everyChange, restoreOnStartup
}
Bra_Left_Living_room_On_Off, Bra_Right_Living_room_On_Off, Countertop_Lighting_Kitchen_On_Off these are items with a switch property.
As an experiment, I added another item of the switch type to this file, but it is not from the zigbee device, but from wi-fi. And he also did not return to the state in which he was before the disappearance of electricity. It seems to me that when loading openhabian, the zigbee2mqtt service does not have time to fully load and openhab can and tries to send a command to enable or disable, but it does not reach. With a wi-fi device, the same thoughts. I would like to solve this problem. Has anyone encountered a similar problem and how do you deal with it?