Hi !
I wanted to send PushOver notification with a snapshot of one of my camera and a link to the camera stream to my phone but since I couldn’t find an easy way to do it, I ended up with the following code… Hopefully this might help someone… If you have better ideas, feel free !
I know there might (surely) be a better way to do this but since I couldn’t find it or couldn’t do it with the Push plugin mentioned here :
http://forum.micasaverde.com/index.php/topic,11520.msg82727.html#msg82727
Thats how I did it… Adjust to your need
PushToken = “YourPushOverTokenHere”
PushUser = “YourPushOverUserCodeHere”
PushTitle = “MessageTitle”
PushMessage = “MessageContent”
Snapshot_file = “/tmp/camera_snapshot.jpg”
–This points to one of my BlueIris managed camera
camera=“http://xxx.xxx.xxx.xxx/image/ShortCamName?q=50&s=80&user=XXX&pw=XXX”
–Sound could be : pushover bike bugle cashregister classical cosmic falling gamelan incoming intermission magic mechanical pianobar siren spacealarm tugboat alien climb persistent echo updown none
PushSound = “gamelan”
PushPriority = “1”
–Link to the BlueIris videostream of that camera
PushUrl = “http://xxx.xxx.xxx.xxx/mjpg/ShortCamName&user=XXX&pw=XXX”
PushUrlTitle = “Camera Name”
–Get the snapshot from the camera
local out=assert(io.open(Snapshot_file, “wb”))
local _,data=luup.inet.wget(camera)
out:write(data)
assert(out:close())
–Send PushOver request
curlcommand = “curl -s -F "token=” … PushToken … "" "
… “-F "user=” … PushUser … "" "
… “-F "title=” … PushTitle … "" "
… “-F "message=” … PushMessage … "" "
… “-F "attachment=@” … Snapshot_file … "" "
… “-F "sound=” … PushSound … "" "
… “-F "priority=” … PushPriority … "" "
… “-F "url=” … PushUrl … “" "
… “-F "url_title=” … PushUrlTitle … “" "
…“https://api.pushover.net/1/messages.json”
local handle = io.popen(curlcommand)
local result = handle:read(”*a”)
handle:close()
print (result)
–Delete temporary snapshot
os.remove (Snapshot_file)