I want to copy the image file which is a local URL coming from pushover (URL item) to a local file at /etc/openhab/camera/ipcamera.jpg. I have created the directory “camera” first.
Reason for this is that pushover needs to local file as attachment to show in the notification and the local URL as attachment will not work outside the network.
When I run the script:
executeCommandLine(Duration.ofSeconds(15), “curl http://192.168.1.5:45347/ipcamera.jpg --output /etc/openhab/camera/ipcamera.jpg”) I get the following error:
Failed to execute commandLine ‘[curl http://192.168.1.5:45347/ipcamera.jpg --output /etc/openhab/camera/ipcamera.jpg]’
All the rest is working
I have no clue whether the command is the issue or it might be permission.
Who can assist?
The exec binding has no shell so would not be able to find the curl command. Many people have had success creating a Linux shell script and running that with the exec binding.
This is what I have for the same situation:
executeCommandLine(Duration.ofSeconds(30), "/usr/bin/curl", "-k", "https://192.168.0.220/cgi-bin/currentpic.cgi", "-o", "/tmp/pic.jpg")
logInfo("away", "Sending pushover message")
val actions = getActions("pushover", "pushover:pushover-account:2424242424")
actions.sendAttachmentMessage("No one at home and there's motion in the lounge", "", "/tmp/pic.jpg", "image/jpeg")
The things that looks different are a) I have separate arguments to
executeCommandLine, b) I specify the full path to
curl and c) I’m sticking the file in
/tmp to avoid permission issues.
Not sure if any of those help at all.
Worked straight away.
Thank you so much!!
Thanks Bruce. Andy helped me out.