OH3: Execute command with Cell Widget press

I have the “Execute” binding installed, and i am trying to create a Cell widget that will toggle an Item linked to the “Running” channel of the ExecuteCommand Thing.

ExecuteCommand item says to send an ON command to run, so I have set it up as a Toggle item and when toggled send “ON” however no luck.

This is the command I have set for the Thing which will will ssh into my Ras-Pi and execute a script that runs the shutdown command.

sshpass -p password ssh user@ ./p_off.sh

It will ssh into my Ras-Pi and execute a script that runs the shutdown command.

My end goal is to perform a commanded shutdown of an RPi4 running OctoPrint, delay for x amount of time for poweroff, then power off the ZWave outlet my 3d printer is plugged in to.

Not certain how to tie this all together with OH3.

Any suggestions?


Have a look in your openhab.log
You don’t mention making a whitelist entry?
Link a String Item to output, see if you get a message.

1 Like

Thanks rossko57.
I did have the command in the whitelist file.
I’ve been messing around with this for a bit and have made progress. Thanks for suggesting to link the string output, I have added this.
I deleted and unlinked all the items and then recreated them again. I now have success. Not exactly sure what was wrong before as there was nothing showing in the log file however since redoing all it is working!

The “Execute SHUTDOWN…” control does display “ON” when it is pressed and executes the command. This is a snip of the controls after execution of the script file, and the Pi going offline.


may be, this could help:
Beginner’s guide to an openHABian reboot/shutdown switch

That guide is for shutting down the Pi that’s running openHAB, not another RPi.

@Craigers, out of curiousity, why do you want to shut down the OctoPrint Pi? Wouldn’t it be better to leave it running full-time? I’ll likely set up OctoPrint in the near/distant future, and I would think you would want it running so that you can send print jobs over WiFi without having to power it back up. I’m only planning to monitor it from openHAB so that I know when to shut down my printer.

Thanks @hare0815, but I’m running OH3 an ESXI VM.
@rpwong I have modded my Ender3-Pro that the RasPi is connected to its power supply, so the printer needs to be on for the Pi to be powered on. In afterthought of doing this it’s great to save a power outlet, but like you suggest adds a layer of inconvenience. I may undo this some day when I do some re-arranging in my house as I have a spare room the printer may end up in.


1 Like