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

I tried it as example with:

rule "switch off release buzzer"
when
    Item ShlPiGeneral_Shutdown received command ON
then
    createTimer(now.plusMillis(1000), [ |
        ShlPiGeneral_Shutdown.sendCommand(OFF)
    ])
end

rule "switch off release buzzer"
when
    Item ShlPiGeneral_Reboot received command ON
then
    createTimer(now.plusMillis(1000), [ |
        ShlPiGeneral_Reboot.sendCommand(OFF)
    ])
end

I found it here. Also there I found the solution that I can use a Switch as a Button. But the problem is not solved.

Remember I used this inside the sitemap:

Switch item=ShlPiGeneral_Reboot icon="exec_restart" label="shlPiGeneral neustarten" mappings=[ON="Neustarten"]

And inside the items I used a string:

String ShlPiGeneral_Reboot "shlPiGeneral Reboot"  (gSystemInfoShlPiGeneral)  { channel="exec:command:openhabianShlPiGeneral_reboot:input" }

Another approach was:

rule "switch off release buzzer"
when
    Item ShlPiGeneral_Reboot changed
then
    if (ShlPiGeneral_Reboot.state == ON) {
        createTimer(now.plusMillis(1000), [ |
            ShlPiGeneral_Reboot.sendCommand(OFF)
        ])
    }
end

I think it`s because of the String. I am not sure how to make a better solution. Hopefully there is someone who can help me. Thanks in advance.