Pushbullet Action Add-on

Hi,

I already posted this to another thread, but as I need more testers and feedback I will open this one. I developed a Pushbullet Binding (and Action). You can send and receive pushes with openhab. Feel free to test and please leave feedback. In previous tests sending messages from openHAB worked without any problems, but receiving was not reliable and til now I don’t know why

Link

unzip the two files to your addons-folder (note: you can use the binding without the action, but you cannot use the action without the binding)

modify your openhab.cfg add:

################################## PushBullet Binding #################################
#
# accesstoken can be found under settings, when you login to www.pushbullet.com 
pushbullet:accesstoken=
# choose a device name for your openHAB-Client
pushbullet:devicename=openHAB
# defaultreceiver of your pushes (Nickname of one of your devices)
pushbullet:defaultreceiver=

items can be defined by adding this to your items file:

String pb {pushbullet="item:<itemName>"} (example: String pb {pushbullet:"item:light"})

if you want to send a message to openHAB, go to your pushbullet app, choose openHAB as receiver and send a message: <itemName>:<value> (example: light:on)

if you want openHAB to send a message, you can simply call:

sendPushToDefaultDevice(String message)
sendPushToSpecificDevice(String deviceNickName, String message)

At the moment it’s not possible to send pushes to all devices in one account. This will be added in a later version.

3 Likes

Okay some dumb questions, I’m very green at this and testing a few things.

I’ve setup the config and I can see openHAB as a device. Bindings are in the addons folder, just unzipped and copied both.

I’m trying to send a message, I have created a switch item called Test

How do I call a message? I’ve tried this in my rules:
Is this how it is supposed to be done?

rule "Test"
when
    Item Test received command
then
    switch(receivedCommand) {
        case ON : sendPushToDefaultDevice(String hello)
        case OFF : sendPushToDefaultDevice(String bye)
	}
end

All I get is:

Error during the execution of rule 'Test': The name 'String' cannot be resolved to an item or type.

For receive I send

Test:on

to openHAB and all I see in the even log is Message for other recipient.

Thanks Josh

Hi,

sorry for the late answer, but here it is:

your methodcalls have to look like this

sendPushToDefaultDevice("hello")
sendPushToDefaultDevice("bye")

To receive a message the item has to look like this in your exampel

String anyItemNameYouCanImagine {pushbullet="item:Test"}

if you want to send a message to openHAB, go to your pushbullet app, CHOOSE OPENHAB AS RECEIVER and send a message: Test:on

this will set anyItemNameYouCanImagine to the value “on”

Thanks for testing!

Thanks for writing this.

I’ve tested (only using default device though) and it’s all working as expected. Should allow me to send a push to android device of my choosing and then get Tasker to respond.

After you posted the solution I figured out why the receive wasn’t working, in you initial post

String pb {pushbullet="item:<itemName>"} (example: String pb {pushbullet:"item:light"})

The example has a : instead of = and I copied and pasted that without thinking.

Josh

You are my personal hero! Just needed this, right after coding a dirty shellscript to post Messages to the pushbullet-api!

Really nice, I’ll play with this later tonight.

Could you by any chance give a link to the “other thread” you mentioned and maybe your source repository as well?

Installed this afternoon and so far has worked through all my test cases. I am only sending to my phone though, not sending anything to openHAB.

Thanks for the work on this!

Very good work. Thanks. It is working very well. I just tested the direction openHAB to pushbullet.

Nice work. Thank you. Working fine for the “outbound”. I did not test receiving with Openhab (to be honest I don’t know a proper use case).

I would wish 4 things:

  1. Return the message ID when using sendPushToDefaultDevice or sendPushToSpecificDevice
  2. Call Pushbullet to delete a message https://docs.pushbullet.com/#delete-push
  3. Call Pushbullet to delete all messages https://docs.pushbullet.com/#delete-all-pushes
  4. Maybe make “update Push” API call available

Would you mind making the code open source? If so I can implemented the changes and send you a pull request in github.

Once again: good work!

Cheers

Works fab! Push bullet notifications from my doorbell ftw!

Please consider open sourcing it!

Hi @exilhanseat, it works like a charm. Nonetheless, I detected that when I’m binding pushbullet it exists a big networking leak with high traffic from/to the address 173.255.112.173, which seems to be a Google IP. Any solution? As I said it works perfect not missing any push, but my Internet access has got a big lag. Thanks again!

I encountered something yesterday that I would call a bug in the binding. Last night my ISP decided to do some work and cut my network connection to the Internet. While it was disconnected I got around 100 lines per second of errors in my log.

 2016-02-08 02:41:00.179 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.187 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.194 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.201 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.209 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.216 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.224 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.231 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.239 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.247 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.254 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.261 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.269 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.276 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.284 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.291 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.299 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.306 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.314 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.321 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.329 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.336 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.343 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.351 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.358 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.366 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.374 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.382 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.389 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.397 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.404 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.411 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.419 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.428 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.436 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.444 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.
 2016-02-08 02:41:00.451 [ERROR] [.jpushbullet2.PushbulletClient] - Error connecting to Pushbullet websocket: Connection failed.

My internet was offline for about six hours so you can imagine what this did to my logs.

Would you mind opening an issue, @rlkoshak?

No problem, but has this binding been officially accepted yet? It doesn’t appear when I search for it in apt-cache. If not, is it appropriate to open the issue? That is the main reason I haven’t opened one up yet.

Ah, my mistake. Since the code is not from the openhab repo, it indeed doesn’t make any sense to open an issue against it there. The best one could do is probably what you did – report it on this thread! Sorry for the careless advice. :sleeping:

I’ve started to see these errors and I haven’t made any changes. Any ideas before I start play around with settings?

Thanks Josh

05:52:10.867 [INFO ] [.jpushbullet2.PushbulletClient:152 ] - Timer discovered that websocket was closed. Attempting to reopen…
05:52:10.898 [ERROR] [.jpushbullet2.PushbulletClient:200 ] - Error connecting to Pushbullet websocket: Connection failed.

Link no longer works? I was really hoping to ditch text messages as they seem to be really slow.

For what it’s worth you can create a simple script that allows you to push from items or rules. To push from a rule you simply execute a command line like this:

var title = "Title"
var message = "Message"
executeCommandLine("pushbullet.sh@@" + title + "@@" + message)

The script consists of this. Name the file “pushbullet.sh”, make it executable and be sure to include the path to the file in the command above.

#!/bin/sh
    
curl --header 'Access-Token: <access-token>' \
     --header 'Content-Type: application/json' \
     --data-binary "{\"body\":\"$2\",\"title\":\"$1\",\"type\":\"note\"}" \
     --request POST \
     https://api.pushbullet.com/v2/pushes
3 Likes

@exilhanseat seems that link is dead already. Could you provide the github URL or any other place where we could try it out?
Looks amazing, I’d love to try it out.

Best regards,
Kuba

Thanks @frankose. I found it very useful only for push notifications, it’s uncoupled from any binding.