How to restart or shutdown a remote Raspberry Pi over SSH within openHAB

Persistence records the last value sent to the item. That’s covered in the tutorial in the section about persistence.

I’ve abandoned this strategy after realizing it wasn’t necessary. Instead, I just send Flag_System an empty command before rebooting or powering off my system, which becomes the state that’s restored by MapDB.

Basically, have your rule send the item a command before you run the shutdown/reboot command, and that’s what will be restored when OH restarts.

You can’t send ON/OFF commands to a string. It won’t know what to do with states. But you don’t need ON/OFF…you just need a single string item to which you’ll send string values from your sitemap. Your rule will trigger based on the string value.

The solution is in the tutorial if you want it. It’s certainly not the only way to do it, but I’ve received lots of positive feedback on it.