Exec: RPI turn on off HDMI

Dear all, i am running a digital picture frame on a RPI zero.
After updating to Openhab 4 i can not turn my picture frame display on and off using the exec script anymore. I do have 2 exec things to turn the display on and off:

UID: exec:command:ee2a5fc818
label: Bilderrahmen Anschalten
thingTypeUID: exec:command
configuration:
  transform: REGEX((.*))
  interval: 0
  autorun: false
  command: ssh -i /var/lib/openhab2/.ssh/id_rsa pi@192.168.0.199 sudo vcgencmd
    display_power 1
  timeout: 15
UID: exec:command:289ac5ff6f
label: Bilderrahmen Ausschalten
thingTypeUID: exec:command
configuration:
  transform: REGEX((.*))
  interval: 0
  autorun: false
  command: ssh -i /var/lib/openhab2/.ssh/id_rsa pi@192.168.0.199 sudo vcgencmd
    display_power 0
  timeout: 15

To be honest its years ago since i setup these things. I have no idea how to fix this. Can someone help how i can send sudo vcgencmd display_power to a RPI in the network?

Thank you

I can’t help with the command itself, but have you tried to execute exactly the same command via command line?

Without any log files provided we don’t know if your command is not working (e.g. is the path still openhab2 after upgrade?) or if the issue is with the exec binding and your thing configuration?

Does the migrated installation still have the openhab2 directory under /var/lib ?

Hi Matze, good question. Can you tell me how to run a command via command line using openhab ssh? Do i have to enter a command mode first?

Hi Wolfgang, no i performed a fresh openhabian installation for openhab 4. I think because of this there is no openhab2 folder anymore.

I’m using putty to connect to OH server.

With a fresh installation at least the directory changed

Your command executes a ssh command using a private key id_rsa which is stored in direcotory /var/lib/openhab2. If you setup it from scratch without that direcotory the command will not be exeucted if the private ssh key is missing. Besides that if you set it up from scratch you again have to grant sudo privileges.

Putty is not required ssh is executed in the exec command.

The command you need to test is e.g.

ssh -i /var/lib/openhab2/.ssh/id_rsa pi@192.168.0.199 sudo vcgencmd     display_power 0

but with adapted content with regard to your new setup. E.g. id_rsa is most probably not stored in /var/lib/openhab2 any longer. Is the IP still correct ? Is the user pi still correct ? Does that user accept login using the private key id_rsa ?

Yes thats right. The folder /var/lib/openhab2 doesnt exist anymore. IP and user pi is still correct. Didnt change anything on the digital picture frame.

I do have the folder /var/lib/openhab however, there is no /.ssh/id_rsa anymore. How can i re-setup the thing with openhab4?

Right now I am typing on a smartphone thus not very comfotable.
Search for how to cteate public private ssh keypair.
This What is ssh-keygen & How to Use It to Generate a New SSH Key?
should help.

Dear all, thank you for your help.
Due to the fact that i do already have mqtt on the picture frame i am now using mqtt to turn on and off the screen.
Using this little script here:

1 Like