• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pushbullet and pushover
#1
Also, do you maybe have the possibility to look at the pushover and pushbullet actions?
 
Reply
#2
I had a look at both actions. The Pushover action seems to be straight forward (it only sends notifications) and I will create a lua action for it asap.

The c implementation of Pushbullet doesn't seem to be complete. Pushbullet can push notes, links and files. The TYPE option tells Pushbullet what type of push it is receiving, but there is no check in the action for the validity of the TYPE option.

Pushing a file is a two step operation, first uploading the file and then do the push. Also the action would need additional parameters for this. So for sending files (if one would ever wish to do that from pilight Unsure ) the old pushbullet action is inadequate. So we should disallow using "file" as  TYPE option value.

Like sendmail, pushbullet and pushover are intended to allow notifications to be send from rules. Therfore I would suggest to allow only pushing notes for pushbullet, just like it is with pushover. That implies leaving out the TYPE option.

The data to be sent to pushbullet must be in json format. Shall I compose that json myself, or by chance do you have library functions that can be used in lua scripts to create and populate json strings?
 
Reply
#3
Quote:I already told you, just create a new device as you already did and also create a new lua device.
Sorry, but I don't quite understand what you mean.

I created both a protocol and a lua device wrapper for it and I am ready to test them, but a device wrapper can only work with a known device type.  So to put my question differently: What should be the device type for the protocol? As I said, the protocol looks a bit like the label protocol, but has different options and has a state. 

Code:
               "httpresult": {
                       "protocol": [ "generic_http" ],
                       "id": [{
                               "id": 1
                        }],
                       "mimetype": "text/plain",
                       "size": 11,
                       "code": 200,
                       "data": "hello world",
                       "state": "ready"
               }
 
Reply
#4
Quote:The data to be sent to pushbullet must be in json format. Shall I compose that json myself, or by chance do you have library functions that can be used in lua scripts to create and populate json strings?

Just construct that json manually like (as an example) this:
PHP Code:
local json '{"message":"' .. parameters['message'] .. '", "type":"' .. parameters['type'] ..'"}'
So no need for a json library Smile

Quote:What should be the device type for the protocol?
Create a new device type for your situation that fits your needs.
 
Reply
#5
I created the pushbullet action, but it is consistently ending in a segfault that seems to be initiated by this error:

Code:
[Jul 08 19:36:46:810342] pilight-daemon: NOTICE: mbedtls_ssl_handshake: SSL - The connection indicated an EOF

This reminded  me of an issue with pushbullet that already existed end of 2016 See this thread. Your last post in that therad has never been answered by anyone and unfortunately I cannot give you the answer either.

If I remember well, the issue was that pushbullet adapted their ssl implementation to a more secure standard. pilight's ssl implementation did not comply with it and pilight's pushbullet stopped working. I wonder if it ever has been working since then.

The request:

Code:
https://xxxxxxxxxxxxxxxxxxxxxx@api.pushbullet.com/v2/pushes/

should result in an error saying that the request is invalid, but results in the  ssl handshake error shown above and ends with a segfault.


Code:
Thread 1 "pilight-daemon" received signal SIGSEGV, Segmentation fault.
0x76831a94 in plua_network_http_callback (code=404, content=0x0, size=0, type=0x0, userdata=0x4bb40) at /home/pi/pilight/libs/pilight/lua/network/http.c:266
266             switch(state->module->type) {
(gdb) backtrace
#0  0x76831a94 in plua_network_http_callback (code=404, content=0x0, size=0, type=0x0, userdata=0x4bb40) at /home/pi/pilight/libs/pilight/lua/network/http.c:266
#1  0x767cd670 in http_client_close (req=0x4bbb0) at /home/pi/pilight/libs/pilight/core/http.c:488
#2  0x767cd7d4 in timeout (req=0x4c100) at /home/pi/pilight/libs/pilight/core/http.c:532
#3  0x767aeacc in uv__run_timers (loop=0x76fa7f58 <default_loop_struct>) at /home/pi/pilight/libs/libuv/unix/timer.c:165
#4  0x767943e8 in uv_run (loop=0x76fa7f58 <default_loop_struct>, mode=UV_RUN_DEFAULT) at /home/pi/pilight/libs/libuv/unix/core.c:353
#5  0x0001cd34 in main (argc=2, argv=0x7efff7a4) at /home/pi/pilight/daemon.c:3506
(gdb) frame 0
#0  0x76831a94 in plua_network_http_callback (code=404, content=0x0, size=0, type=0x0, userdata=0x4bb40) at /home/pi/pilight/libs/pilight/lua/network/http.c:266
266             switch(state->module->type) {
(gdb)
 
Reply
#6
Mind mailing me the API key so i can check it myself?
 
Reply
#7
A  valid API key is not required to reproduce this error. A wrong api key like xxxxxxxxxxxxxxx should result in an errer response from pushbullet telling that the request is invalid, but because the ssl handshake fails, we never get to that point no matter if a valid key is provided or not.

In the meantime I also created the pushover action and that seems to give exactly the same segfault, but without an ssl handshake error.

So there is probably no correlation between the handshake error with pushbullet  and the segfault.

I have no key for pushover, so I cannot test what would happen with a valid pushover request.

Attached are both pushbullet.lua and pushover.lua

If you still want to have my pushbullet API key, please let me know.


Attached Files
.zip   push actions.zip (Size: 1.76 KB / Downloads: 4)
 
Reply
#8
I've searched the whole evening, but i have no clue. I'm heading to the mbedtls forum.

Damn, can't register, my captcha is continuously rejected. Can you try?
 
Reply
#9
Just tried and managed to register without problems.
 
Reply
#10
Wierd stuff Confused did you manage to ask the question about our problem.
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)