Pushbullet Action Add-on

pushbullet
openhab1-addons
Tags: #<Tag:0x00007f0148462968> #<Tag:0x00007f0148462828>

(bro) #22

@rlkoshak
@joshpond80

Can you guys please re-upload the install files as OP is apparently gone?


(joshpond80) #23

@bro

here are the ones that I have. If anyone has a better and free place to share them that would be good so I can remove it from my dropbox.
Josh


(Ross Dargan) #24

Personally I decided to move away from this since OP had vanished, and I don’t think the source code is available. I started using Telegram as that is well supported…


(Kuba Wolanin) #25

Thank you Josh!
I wish the addon was still supported or at least opensourced, so other developers had a chance to contribute to this. Pushbullet has a large community as well.


(Rich Koshak) #26

Since the original author did not post a license I don’t feel comfortable posting the code.

Probably an even better solution is to search the forum for “Pushbullet” and you should find a recent post on how to send directly using Exec binding or HTTP binding.


(Hakan Tandogan) #27

To avoid duplication of effort:

Since I could not reach the original author and there seems to be a real demand for a pushbullet action, I started a clean-room re-implementation of such an addon. It will be available as source for integration into the main source tree on github.

As usual, no timeframe, it will be done when it is done :wink:


(Dan) #28

Would be lovely if you could add an action for pushing an image - pushbullet does this better than anything else I’ve found, and it’s invaluable for sending me images when a security camera detects movement.

At the moment I do this with a rather unsatisfactory series of shell scripts. That said, the shell scripts work, and an action is neater but not necessarily better. So, if you do look at this, please don’t spend too much time on it!

Dan


(Hakan Tandogan) #29

Let me check what I can do after doing the basics first. Feel free to prod me again after the first version is written and merged into the core :slight_smile:


(Kuba Wolanin) #30

@hakan have you made any progress with Pushbullet action lastly?


(Hakan Tandogan) #31

Actually, I restarted working on this just two days ago :smile:

It was a pretty hard effort to rebase everything back to the current development HEAD, but after that, I’m back on track.


(Kuba Wolanin) #32

Awesome! Let us know if you need any help with testing.

In the meantime I found a way (workaround actually) to notify my pushbullet using simple Node.js script.
Here’s the pushbullet package in npm I’m using.

And my script:

var PushBullet = require('pushbullet');
var pusher = new PushBullet('APIKEY');
var noteTitle = process.argv[3] || "OpenHAB";
var noteBody = process.argv[2];

if(noteBody) {
	pusher.note({}, noteTitle, noteBody, function(error, response) {
	    if(error) {
	    	console.log(error);
	    }
	    console.log(response);
	});
}

In openHAB rules I’m just calling this Node.js script like so:

executeCommandLine("node@@/etc/openhab2/html/pushbullet/push@@Hello there")

As you see, it’s poor mans pushbullet integration, but I’m really looking forward to see @hakan work in action :slight_smile:


(Ahiel) #33

Thanks @kubawolanin!!!
The solution is great for me!


(Hakan Tandogan) #34

News, news :slight_smile:

I have a working pushbullet action now, which I have successfully used to push messages for a few days now.

Pull Request:

Downloadable jar:

https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/action/org.openhab.action.pushbullet/1.11.0-SNAPSHOT/org.openhab.action.pushbullet-1.11.0-SNAPSHOT.jar

I have created an entry at the marketplace as well, and it has been moderated just now:

Let’s hope I can get the action through the review process in a shorter time than it took me to finally get off my butt and write the code :stuck_out_tongue:


(Hakan Tandogan) #35

Nice, Jenkins successfully built my PR, so you don’t have to download the archive from dropbox anymore :slight_smile:


(Dan) #36

This is fantastic.

As promised, I am now greedily prodding you to see if you can add the ability to push images…


(Hakan Tandogan) #37

As soon as the initial version is merged into master :smile:


(Kuba Wolanin) #38

@hakan is there a simple way to receive pushes through your action?
Presumably it’ll require a separate binding, right?

Right now I have a simple node.js script sitting on my RaspberryPI.
Its only job is to pass the text to openHAB’s /voice/interpreters/.

var PushBullet = require('pushbullet');
var request = require('request');
var pusher = new PushBullet('TOKEN');

var openHABdevice = "SOME_DEVICE_ID";

var sender_email = [
    'my@email.com',
    'second@email.com'
];

var stream = pusher.stream();
stream.connect();

stream.on('message', function(push) {
    if( push.type === "tickle" && push.subtype === "push" ) {
        var options = {
            limit: 1
        };

        pusher.history(options, function(error, response) {
            var lastPush = response.pushes[0];
            var iden = lastPush.iden;
            if( lastPush.target_device_iden === openHABdevice && 
                lastPush.type === "note" && 
                sender_email.indexOf(lastPush.sender_email) > -1 ) {
                request.post(
                    'http://openhabianpi:8080/rest/voice/interpreters',
                    { body: lastPush.body },
                    function (error, response, body) {
                        if (!error && response.statusCode == 200) {
                            pusher.deletePush(iden);
                        }
                    }
                );
            }
        });
    }
});

I run this script using forever.

How feasible it is to react on new pushes from openHAB?

Cheers,
Kuba


(Hakan Tandogan) #39

I wanted to look into receiving as well, as this would be a nice way to create a pushbullet / openHAB bot :smile:

I think as well that this would require a separate binding. I am not sure how well this would work with OH1 and actions, maybe I woul end up creating something completely new for OH2. In any case, I fear this would take some time for me to get around to.


(Hakan Tandogan) #40

Just out of interest, do you have your Pi reachable from the internet? Opening up the box to HTTP requests from the outside (possibly unauthenticated, as I cannot control the pushbullet servers) would give me a slightly bad feeling :blush:


(Kuba Wolanin) #41

Nope :slight_smile: