I wouldn´t know if a smokealarm cant… I would assume the smokealarm has a test button, and this will send its state when activated.
I understand and accept, there is a problem with contacts if openhab cant read its state when restarting.
But manipulating the contact (ie the openhab contact, not the physical contact) can cause more serious problems, like I mentioned with the open window or even more, if it´s a smokealarm as you mention.
How do you know the state of the smokealarm, to be able to decided when to manipulate the contact? Maybe this smokealarm is faulty. Its state is actually OPEN, (most failsafe devices would be using NO contacts, in case of power lost etc, the contact will OPEN), but you manipulate openhab to believe its CLOSED and working. What will happen in case of a fire in this situation?
When having a option to manipulate a contact in openhab, it´s highly important to understand, that it´s the proxy contact which is beeing manipulated, and not the physical contact itself. (I´m not aware of any devices, where its possible to manipulate the physical contact, without manipulating/activating the device itself). If the device can not report it state back by itself to openhab. The device would need to be triggered/activated somehow for openhab to get the state. If this isn´t possible, I would personally think twice before using such a device in fatal situations (Ie security, alarms etc). Or at least think even harder, before manipulating the contact from within openhab.
Ofcouse you can. You just have to make sure the device can send its state, either by manipulating the device itself, or let openhab read its state (when possible).
I believe most wired modules can send its states when openhab restarting, I have modbus devices as well as IHC devices which works like this). I also have devices which cant. When needed, I do trigger the devices manually to get them to update their state.
No, you trigger the devices to get them to update and send the state. If you cant, you have a situation you can not rely on. Manipulating the proxy item in openhab does NOT solve this situation for you. It may solve some other issues around rules, reporting other states etc in openhab. But the state of the device is the same, (unknown!). Dont you agree?
I dont disagree on the cause. But I highly disagree on the “solution” by manipulating the contact in openhab. Openhab has no control of the state of the device in a situation where it doesnt report its state automaticly and if you cant force it to send its state.
Thats whats highly important to know and to remember. (from my point of view).
When manually manipulating the state of a contact in openhab. Openhab still dont know the state of the physical contact! When doing so, you are “cheating” openhab to think it knows.
Why would anyone want to have a system, where you cant rely on its state?
I know, some would say, what damage does it do manipulating the state of a door/window contact after openhab restarting. It will come back in sync the first time the door/window is “activated” (OPEN/CLOSED). And I agree…
My opinion should be read in general manner - There may be situation where it´s suitable to just do the manually manipulation due to other aspects in openhab. But it´s important for me to stress, you shouldnt, unless you know exactly what you´re dealing with. In case of a door/window sensor etc… You would be better of triggering the contact (open/close the door/window, activte the test button on the smaorkealarm etc), and get the real state of the device returned to openhab. Thats the only way you can rely on the device is working as it´s suppose to.