Posts: 11
Threads: 3
Joined: Mar 2017
Reputation:
0
12.04.2017, 13:47
Hi, I'm working this example
http://openrb.com/send-instant-messages-...s-with-lm/
but I have a question about this.
Regarding this part of the code:
Require 'ssl.https'
Local pushover_url = 'https://api.pushover.net/1/messages.json'
In this line, "pushover_url" this direction from where was taken?
Well I already have the account in pushover, and I got the key and the token but it still does not let me send messages from the script.
Thank you.
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
Hi,
Did you set default gateway and DNS in your network adapter settings?
BR,
Erwin
Posts: 36
Threads: 13
Joined: Mar 2017
Reputation:
0
Hi , I have the application on the cell phone, or do I need to work on the desktop version?
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
17.04.2017, 14:48
(This post was last modified: 17.04.2017, 14:49 by Erwin van der Zwart.)
Hi,
You need to create a application on the website of pushover and put the generated application token in the script and you can use the phone app, in the app you see your user token, this one must also be put in the script.
After both keys are filled in you should be able to receive push messages on your phone.
BR,
Erwin
Posts: 36
Threads: 13
Joined: Mar 2017
Reputation:
0
It works, thank you for your help.
Posts: 13
Threads: 1
Joined: Jun 2016
Reputation:
0
30.01.2018, 18:02
(This post was last modified: 30.01.2018, 20:28 by Keitz.)
I will send a jpeg file attachments with pushover. But I do not know how.
Can anybody help me ?
i have tried this :
local data_str = 'token=****************&user=*******************&device=gsm&message=snapshot.jpeg&attachment=' .. image .. '&title=LogicMachine&sound=bike&priority=0'
local res, code, headers, status = ssl.https.request(pushover_url, data_str)
I receive a message with an icon of a image but no my image is not there.
this is info from pushover :
other HTTP headers]
Content-Type: multipart/form-data; boundary=--abcdefg
----abcdefg
Content-Disposition: form-data; name="user"
[ your Pushover user key ]
----abcdefg
Content-Disposition: form-data; name="token"
[ your Pushover API token ]
----abcdefg
Content-Disposition: form-data; name="message"
your message here
----abcdefg
Content-Disposition: form-data; name="attachment"; filename="your_image.jpg"
Content-Type: image/jpeg
[ raw binary data of image file here ]
----abcdefg--
Posts: 4646
Threads: 24
Joined: Aug 2017
Reputation:
207
Hi
Why do you bother with this, use our notifications see this thread
https://forum.logicmachine.net/showthrea...ifications
BR
------------------------------
Ctrl+F5
Posts: 57
Threads: 7
Joined: Jul 2016
Reputation:
1
31.01.2018, 12:21
(This post was last modified: 31.01.2018, 12:40 by bmodeco.)
Daniel.Hi
[quote pid='7142' dateline='1517397272']
Why do you bother with this, use our notifications see this thread
https://forum.logicmachine.net/showthrea...ifications
BR
[/quote]
Hi Daniel,
I have been using pushover for several months now and am sending more than 10.000 messages a month using the LM5 in my KNX-system. Since the number of messages is too (limit of 7.500) high I use different pushover-applications to separate the messages (weather, heating, alarmsystem, ventilation, etc...). It also allows formatting in the messages (I included a screendump from my ipad). Apart from that it also allows for priority-messaging: most of my message are just logging (low priority), you can elevate priority level so a pop-up box shows f.e. when an alarm is triggered.
I did not know that it also allows for sending of attachments - apparently since mid january... This was for me the only thing still missing since I want to send pics taken by my security cams.
So I do think that the pushover platform still has some advantages...maybe some good ideas for your next version...
Keep up the good work, still loving my LM.
Thanks, Bart
(30.01.2018, 18:02)Keitz Wrote: I will send a jpeg file attachments with pushover. But I do not know how.
Can anybody help me ?
i have tried this :
local data_str = 'token=****************&user=*******************&device=gsm&message=snapshot.jpeg&attachment=' .. image .. '&title=LogicMachine&sound=bike&priority=0'
local res, code, headers, status = ssl.https.request(pushover_url, data_str)
I receive a message with an icon of a image but no my image is not there.
this is info from pushover :
other HTTP headers]
Content-Type: multipart/form-data; boundary=--abcdefg
----abcdefg
Content-Disposition: form-data; name="user"
[ your Pushover user key ]
----abcdefg
Content-Disposition: form-data; name="token"
[ your Pushover API token ]
----abcdefg
Content-Disposition: form-data; name="message"
your message here
----abcdefg
Content-Disposition: form-data; name="attachment"; filename="your_image.jpg"
Content-Type: image/jpeg
[ raw binary data of image file here ]
----abcdefg--
Hi Keitz,
I am very much interested in this feature also...
This is the link with some more info: https://pushover.net/api#attachments
Apparently it needs some sub-headers to identify what type of image.
Don't know on how to implement it in the existing code.
Maybe admin, Daniel or Erwin can have a look...
Thanks, Bart
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
Try this, I've tested it with nginx and apache so other servers might reject this request. Fill params table with your post arguments, filedata variable should contain binary data of your jpeg image, set request url as needed.
Code: require('ssl.https')
boundary = os.date('%d%m%Y%H%M%S')
params = {
{
name = 'token',
value = '12345',
},
{
name = 'user',
value = 'testuser',
},
{
name = 'attachment',
filename = 'snapshot.jpg',
ctype = 'image/jpeg',
value = filedata,
}
}
body = { '--' .. boundary }
for _, param in ipairs(params) do
line = string.format('Content-Disposition: form-data; name=%q', param.name)
if param.filename then
line = string.format('%s; filename=%q', line, param.filename)
end
body[ #body + 1 ] = line
if param.ctype then
body[ #body + 1 ] = string.format('Content-Type: %s', param.ctype)
end
body[ #body + 1 ] = ''
body[ #body + 1 ] = param.value
body[ #body + 1 ] = '--' .. boundary
end
-- last boundary
body[ #body ] = body[ #body ] .. '--'
-- empty line at the end
body[ #body + 1 ] = ''
bodydata = table.concat(body, '\r\n')
resp = {}
log(
ssl.https.request({
url = 'https://...',
sink = ltn12.sink.table(resp),
method = 'POST',
source = ltn12.source.string(bodydata),
headers = {
['content-length'] = #bodydata,
['content-type'] = 'multipart/form-data; boundary=' .. boundary
}
})
)
log(table.concat(resp))
Posts: 57
Threads: 7
Joined: Jul 2016
Reputation:
1
(01.02.2018, 13:09)admin Wrote: Try this, I've tested it with nginx and apache so other servers might reject this request. Fill params table with your post arguments, filedata variable should contain binary data of your jpeg image, set request url as needed.
Code: require('ssl.https')
boundary = os.date('%d%m%Y%H%M%S')
params = {
{
name = 'token',
value = '12345',
},
{
name = 'user',
value = 'testuser',
},
{
name = 'attachment',
filename = 'snapshot.jpg',
ctype = 'image/jpeg',
value = filedata,
}
}
body = { '--' .. boundary }
for _, param in ipairs(params) do
line = string.format('Content-Disposition: form-data; name=%q', param.name)
if param.filename then
line = string.format('%s; filename=%q', line, param.filename)
end
body[ #body + 1 ] = line
if param.ctype then
body[ #body + 1 ] = string.format('Content-Type: %s', param.ctype)
end
body[ #body + 1 ] = ''
body[ #body + 1 ] = param.value
body[ #body + 1 ] = '--' .. boundary
end
-- last boundary
body[ #body ] = body[ #body ] .. '--'
-- empty line at the end
body[ #body + 1 ] = ''
bodydata = table.concat(body, '\r\n')
resp = {}
log(
ssl.https.request({
url = 'https://...',
sink = ltn12.sink.table(resp),
method = 'POST',
source = ltn12.source.string(bodydata),
headers = {
['content-length'] = #bodydata,
['content-type'] = 'multipart/form-data; boundary=' .. boundary
}
})
)
log(table.concat(resp))
Thanks admin for the fast response! Will try it out.
Posts: 13
Threads: 1
Joined: Jun 2016
Reputation:
0
(01.02.2018, 15:37)bmodeco Wrote: (01.02.2018, 13:09)admin Wrote: Try this, I've tested it with nginx and apache so other servers might reject this request. Fill params table with your post arguments, filedata variable should contain binary data of your jpeg image, set request url as needed.
Code: require('ssl.https')
boundary = os.date('%d%m%Y%H%M%S')
params = {
{
name = 'token',
value = '12345',
},
{
name = 'user',
value = 'testuser',
},
{
name = 'attachment',
filename = 'snapshot.jpg',
ctype = 'image/jpeg',
value = filedata,
}
}
body = { '--' .. boundary }
for _, param in ipairs(params) do
line = string.format('Content-Disposition: form-data; name=%q', param.name)
if param.filename then
line = string.format('%s; filename=%q', line, param.filename)
end
body[ #body + 1 ] = line
if param.ctype then
body[ #body + 1 ] = string.format('Content-Type: %s', param.ctype)
end
body[ #body + 1 ] = ''
body[ #body + 1 ] = param.value
body[ #body + 1 ] = '--' .. boundary
end
-- last boundary
body[ #body ] = body[ #body ] .. '--'
-- empty line at the end
body[ #body + 1 ] = ''
bodydata = table.concat(body, '\r\n')
resp = {}
log(
ssl.https.request({
url = 'https://...',
sink = ltn12.sink.table(resp),
method = 'POST',
source = ltn12.source.string(bodydata),
headers = {
['content-length'] = #bodydata,
['content-type'] = 'multipart/form-data; boundary=' .. boundary
}
})
)
log(table.concat(resp))
Thanks admin for the fast response! Will try it out. Thanks I will try it.
local data_str = 'token=token&user=user&device=gsm&message=test&attachment='??????'&title=LogicMachine&sound=bike&priority=0'
local res, code, headers, status = ssl.https.request(pushover_url, data_str)
Posts: 13
Threads: 1
Joined: Jun 2016
Reputation:
0
It works fine thank you. Now I can send an image from my camera to pushover message.
|