Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
PushBullet plugin (Pako)
Re: PushBullet plugin (Pako)
Hi All,
I have recently updated my PushBullet app on my phone (iPhone). Since then I can't send 'commands' to my PC. As there is now no "Subject" box to type in.
All my 'pushes' come through as "Pushbullet.Note.Note" now, whereas before I could send a 'shutdown' command from the subject box:- "Pushbullet.Note.Shutdown"
which would turn my PC off.
Is there anyway round this?
Cheers
Paul.
I have recently updated my PushBullet app on my phone (iPhone). Since then I can't send 'commands' to my PC. As there is now no "Subject" box to type in.
All my 'pushes' come through as "Pushbullet.Note.Note" now, whereas before I could send a 'shutdown' command from the subject box:- "Pushbullet.Note.Shutdown"
which would turn my PC off.
Is there anyway round this?
Cheers
Paul.
Re: PushBullet plugin (Pako)
Quick question,
is there a way to send a pushbullet to eventghost using HTTP Get, or Post? without having to have a client?
is there a way to send a pushbullet to eventghost using HTTP Get, or Post? without having to have a client?
-
Darkflame808
- Posts: 1
- Joined: Sun Jul 12, 2015 8:46 pm
Re: PushBullet plugin (Pako)
Hi Paul,
Let me tell you first off I do not know how to utilize the full power of eventghost but I was also in the same situation as you.
I will give you an example of how I fixed my problem and hopefully you'll be able to tailor the solution to my problem to match your needs.
Ok I use eventghost to run commands from my PC using another macro player (because i'm too lame to understand how to use eventghost). Before I would do something like this.
Pushbullet.Note.Print -> Run C:\macros\printreports.a3u
Since the update, I changed it to.....
Pushbullet.Note.* -> Run C:\macros\{eg.event.payload[0]}.a3u which equals to C:\macros\keyword.a3u
Then I renamed all the files in my macros directory to whatever I wanted the commands to be.
Before I had files called printreports.a3u, turnoffpc.a3u, turnoffsound.a3u etc...They have been renamed to the keyword of the commands
printreports.a3u->print.a3u
turnoffpc.a3u->shutdown.a3u
turnoffsound.a3u->mute.a3u
To figure out how to parse more information I used the reply feature the pushbullet plugin.
Set a macro for Pushbullet.Note.* and a action "Push a reply" then put "This is what I see....<{eg.event.payload[0]}> <{eg.event.payload[1]}> <{eg.event.payload[2]}> <{eg.event.payload[3]}> <{eg.event.payload[4]}> <{eg.event.payload[5]}> and you'll see what values you can extract. From there you can utilize that information as needed.
Again, I have no experience in eventghost. I made an account just to answer your question. I hope this helped!
Let me tell you first off I do not know how to utilize the full power of eventghost but I was also in the same situation as you.
I will give you an example of how I fixed my problem and hopefully you'll be able to tailor the solution to my problem to match your needs.
Ok I use eventghost to run commands from my PC using another macro player (because i'm too lame to understand how to use eventghost). Before I would do something like this.
Pushbullet.Note.Print -> Run C:\macros\printreports.a3u
Since the update, I changed it to.....
Pushbullet.Note.* -> Run C:\macros\{eg.event.payload[0]}.a3u which equals to C:\macros\keyword.a3u
Then I renamed all the files in my macros directory to whatever I wanted the commands to be.
Before I had files called printreports.a3u, turnoffpc.a3u, turnoffsound.a3u etc...They have been renamed to the keyword of the commands
printreports.a3u->print.a3u
turnoffpc.a3u->shutdown.a3u
turnoffsound.a3u->mute.a3u
To figure out how to parse more information I used the reply feature the pushbullet plugin.
Set a macro for Pushbullet.Note.* and a action "Push a reply" then put "This is what I see....<{eg.event.payload[0]}> <{eg.event.payload[1]}> <{eg.event.payload[2]}> <{eg.event.payload[3]}> <{eg.event.payload[4]}> <{eg.event.payload[5]}> and you'll see what values you can extract. From there you can utilize that information as needed.
Again, I have no experience in eventghost. I made an account just to answer your question. I hope this helped!
Re: PushBullet plugin (Pako)
Thanks for the reply Darkflame808,
Unfortunately I am not good with Eventghost either, I have no idea how to do what you said.
I just hope that a few people are in the same position as me. So hopefully then either Pushbullet (IOS) app will be changed or someone comes up with a simple workaround.
Again thanks for the reply,
Paul.
Unfortunately I am not good with Eventghost either, I have no idea how to do what you said.
I just hope that a few people are in the same position as me. So hopefully then either Pushbullet (IOS) app will be changed or someone comes up with a simple workaround.
Again thanks for the reply,
Paul.
Re: PushBullet plugin (Pako)
Is there a way I can get this to work behind a HTTP proxy server?
Re: PushBullet plugin (Pako)
@Paul
As a suggestion
Create a macro that is triggered by PushBullet.Note.Note
Then create a python script with something like this:
this will then trigger an event called main. followed by the payload of the pushbullet message.
use that new trigger to trigger whatever you need.
Its not the ideal solution e.g. if the pushbullet message is more than one word, but it would work for some basic commands such as shutdown as you had in the past.
As a suggestion
Create a macro that is triggered by PushBullet.Note.Note
Then create a python script with something like this:
Code: Select all
result = eg.event.payload[0]
eg.plugins.EventGhost.TriggerEvent(result)
use that new trigger to trigger whatever you need.
Its not the ideal solution e.g. if the pushbullet message is more than one word, but it would work for some basic commands such as shutdown as you had in the past.
Re: PushBullet plugin (Pako)
@ Phil,
You sir are a legend!

You sir are a legend!
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: PushBullet plugin (Pako)
New version (0.2.7) released.
News:
News:
- - added End-To-End Encryption support
- - uses the first word out of the body as the event suffix (optionaly)
- - added response to ping message
You know flattr ? You can 

Re: PushBullet plugin (Pako)
Trying to get info about incoming phone calls.
I have everything setup, and when an incoming call comes on my phone it mirrors to EG with PB plugin.
I get the following trigger.
PushBullet.Mirror.{phone_number}
So, it appears I can trigger a macro with:
PushBullet.Mirror.*
And from that I can parse out:
{eg.event.payload[0]}
which is "Incoming Call"
payload[1] is my phone device name
payload[2] is a huge string of text.
It seems the only place the phone # is listed is in the actual trigger event.
Is there a way to parse out the phone number from the event:
PushBullet.Mirror.{phone_number}
So I can display it??
thanks
UPDATE:
Ok I figured out how to do this with eg.event.string and parsing out the last variable.
However, this is not ideal.
For phone numbers without a stored contact it pulls out the number.
However if I have a contact named "John Smith" the event returns as:
PushBullet.Mirror.JohnSmith
I mean, it works...but I really dislike having the name concatenated together this way. I don't see a reasonable way to parse it out unless I can be sure that all contacts have this format.
While looking at the logging of the plugin I see that right before the PushBullet.Mirror.JohnSmith a PushBullet web socket message comes in.
The tail end of this message looks like this:
I am assuming that the plugin is building the event to fire out of this web socket message. Would it somehow be possible to parse this value out pure as it comes in?
I have everything setup, and when an incoming call comes on my phone it mirrors to EG with PB plugin.
I get the following trigger.
PushBullet.Mirror.{phone_number}
So, it appears I can trigger a macro with:
PushBullet.Mirror.*
And from that I can parse out:
{eg.event.payload[0]}
which is "Incoming Call"
payload[1] is my phone device name
payload[2] is a huge string of text.
It seems the only place the phone # is listed is in the actual trigger event.
Is there a way to parse out the phone number from the event:
PushBullet.Mirror.{phone_number}
So I can display it??
thanks
UPDATE:
Ok I figured out how to do this with eg.event.string and parsing out the last variable.
However, this is not ideal.
For phone numbers without a stored contact it pulls out the number.
However if I have a contact named "John Smith" the event returns as:
PushBullet.Mirror.JohnSmith
I mean, it works...but I really dislike having the name concatenated together this way. I don't see a reasonable way to parse it out unless I can be sure that all contacts have this format.
While looking at the logging of the plugin I see that right before the PushBullet.Mirror.JohnSmith a PushBullet web socket message comes in.
The tail end of this message looks like this:
Code: Select all
'title': 'John Smith', 'application_name': 'Pushbullet', 'client_version': 206, 'source_device_iden': 'ujzCKnnwJsysjBiVsKnSTs', 'type': 'mirror'}, 'type': 'push', 'targets': ['stream']}Re: PushBullet plugin (Pako)
So I have been able to fix my issue from the previous post by modifying the code.
I added the "title" into the payload of the mirror function as shown below.
You are processing the 'title' directly for your enabMirr function, but since you do not pass it on in the payload it is unavailable for anyone else to use for custom functions.
This works for me, but I am unsure without vetting the whole code if this has the possibility to break other interoperability.
I think it is likely safe except for those people that are already processing the payload (in which case it might be best to add it as the last payload parameter?).
Pako - can you comment and perhaps make an official fix that passes this data on?
Thanks!
FYI, my goal here is to grab the incoming phone and text/emails and push them into XBMC as toast notifications. The plugin works great and easy if you want to use the built-in Mirror pop-ups, but I just don't like the look of those.
It would be great if it were easier to export the formatted data as seen in the built-ins to anything. Below is the python script I am firing when I get a Mirror event coming in. I think there must/should be an easier way:
I added the "title" into the payload of the mirror function as shown below.
You are processing the 'title' directly for your enabMirr function, but since you do not pass it on in the payload it is unavailable for anyone else to use for custom functions.
This works for me, but I am unsure without vetting the whole code if this has the possibility to break other interoperability.
I think it is likely safe except for those people that are already processing the payload (in which case it might be best to add it as the last payload parameter?).
Pako - can you comment and perhaps make an official fix that passes this data on?
Thanks!
Code: Select all
def processMirror(self, push):
body = decode_(push[u'body']) if push['body'] else ""
title = decode_(push['title']) \
if 'title' in push and push['title'] else ""
dev = self.GetDevice(push['source_device_iden']) \
if 'source_device_iden' in push else "Unknown"
pushDict = {
'package_name': decode_(push['package_name']) \
if 'package_name' in push else None,
'source_user_iden': push['source_user_iden'] \
if 'source_user_iden' in push else None,
'source_device_iden': push['source_device_iden'] \
if 'source_device_iden' in push else None,
}
try:
if "conversation_iden" in push:
pushDict["conversation_iden"] = push['conversation_iden']
suffix = "ReplyAllowingMirror"
else:
suffix = "Mirror"
self.TriggerEvent(
"%s.%s" % (
suffix,
title.title().replace(" ", "").replace(".",":") \
if title else suffix,
),
payload = [
title,
body,
dev,
push[u'icon'],
pushDict
]It would be great if it were easier to export the formatted data as seen in the built-ins to anything. Below is the python script I am firing when I get a Mirror event coming in. I think there must/should be an easier way:
Code: Select all
phoneNumber=eg.event.payload[0]
phoneNumber=phoneNumber.split(".")[-1]
eventName=eg.event.payload[1]
for items in eg.event.payload[4]:
if items == "package_name":
packageName = eg.event.payload[4][items]
textBody = eventName.replace('\n', ' ')
if packageName == "com.google.android.talk":
notificationString=u'"' + phoneNumber + '","' + textBody +'","https://xtraweb.files.wordpress.com/2013/11/hangouts-1024x1024.png",30000'
eg.plugins.XBMC2.JSONRPC(u'GUI.ShowNotification', notificationString, False)
if eventName == "Incoming call":
notificationString=u'"' + eventName + '","' + phoneNumber +'","http://www.boemagroup.com/images/call.png",15000'
eg.plugins.XBMC2.JSONRPC(u'GUI.ShowNotification', notificationString, False)
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: PushBullet plugin (Pako)
I understand that in some cases (for further processing - for example display) this kind of formatting event suffix may be disadvantageous.
However, I do not like when the event string contains a space character. This is very confusing.
So if you need instead of "JohnSmith" get "John Smith", you can use the following script:Pako
However, I do not like when the event string contains a space character. This is very confusing.
So if you need instead of "JohnSmith" get "John Smith", you can use the following script:
Code: Select all
import re
contactName = " ".join(re.findall('[A-Z][a-z]*', eg.event.suffix.split(".")[-1]))You know flattr ? You can 

Re: PushBullet plugin (Pako)
Thanks Pako - I understand your hesitation about spaces in the event string, and while I have never seen it cause a problem, I agree that I think it is best to remove them.Pako wrote:I understand that in some cases (for further processing - for example display) this kind of formatting event suffix may be disadvantageous.
However, I do not like when the event string contains a space character. This is very confusing.
So if you need instead of "JohnSmith" get "John Smith", you can use the following script:PakoCode: Select all
import re contactName = " ".join(re.findall('[A-Z][a-z]*', eg.event.suffix.split(".")[-1]))
However, as my follow up e-mail shows, I was not looking for a way to get a space in the event name, but rather to see the caller's name (title) in a pure way.
As I mention above, it seems you are providing more raw data to your mirror plugin then you actually return in the trigger payload. In my example code above I add the "title" back in to the payload and then I am able to extract it in its pure form to process on my own.
Without this you will NEVER get the pure form by parsing it from the trigger event, because the event sanitizes more than just the spaces. For instance, if the contact name was "BO plumber" the event will be *.BoPlumber.
There is not really any good way to ever know how to convert that back to the original, so it needs to be supplied in the payload.
Would you consider something like my changes above so we can get ALL the events (most importantly title) either in a payload section or at least in a dictionary at the end which we can parse from?
Thanks for your work.
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: PushBullet plugin (Pako)
That would not be good to make a similar change for backward compatibility.bengalih wrote:Would you consider something like my changes above ...
So I found another solution.
In the main configuration dialog plugin I've added a checkbox "Use the complete original push as last part of the payload".
You can download the new version 0.2.8.
Pako
You know flattr ? You can 

Re: PushBullet plugin (Pako)
(note, I have a few posts after this with multiple changes I did...just want you to be sure to read them all before going to deep into any one!)Pako wrote:That would not be good to make a similar change for backward compatibility.bengalih wrote:Would you consider something like my changes above ...
So I found another solution.
In the main configuration dialog plugin I've added a checkbox "Use the complete original push as last part of the payload".
You can download the new version 0.2.8.
Pako
Thanks Pako -
In my testing I had changed it to the last payload (after the pushDict) and it didn't seem to have ill effects on anything else, although admittedly I didn't regression test everything.
I have gone ahead and added a new action to the plugin "Dismiss event." This required the addition of the new action and the parsing out of some additional variables in the processMirrorEvent.
I have attached the updated .py as well as my sample tree as an example of what I am doing.
Basically, I wanted to get the mirror notifications to XBMC/Kodi, which wasn't to difficult with the existing plugin (apart from adding the title in as discussed).
What was more challenging was that I was looking to process mirrors for Incoming Calls, and for text messages from Hangouts.
The problem with the text messages from hangouts was that the body that PB sends looks like this for the first text message:
"Hello World Number One!/n"
But if that text message isn't acknowledged, then the next message comes like this:
"Hello World Number One!/n"Hello World Number Two!/n2/n"
and the third:
"Hello World Number One!/n"Hello World Number Two!/n"Hello World Number Three!/n3/n"
Basically, always sending the number of unacknowledged messages along. I could have parsed out the last number, but this had many issues still:
- Sometimes the last last number would be valid (like in "This is the number 1")
- Even if I did this, the whole body gets sent each time so the notification will always be the full text of acknowledged strings, which is quite annoying.
After a lot of deliberation, I decided there really is not foolproof way to handle this and the only option is to dismiss the message when received so that you are always getting a fresh body with each new message.
My EG tree works by toggling notifications on or off at will. When toggled on they will start processing for 2 hours (based on timer) and then auto toggle off.
This is a safety so that I don't dismiss all notifications when I am away from watching XBMC. This happened last night accidentally to me as I left my test running...I kept feeling my phone buzz, but when I looked at it there was no notification! Not until this morning did i realize what happened.
Anyway, hope you will consider including this in the main plugin.
NOTE: For anyone looking to modify the sample EG tree. In the custom script you will want to modify the e-mail address to yours and the device names and friendly names.
It will work without doing this, but the display won't be as "friendly". You also need to modify the plugin properties for XBMC and PB to put in your addresses/creds/api keys.
One final comment on your fix for "Use the complete original push..."
You have nested it under the mirrored notifications, but my purpose in using this is NOT to use your mirror popups, but process my own. Therefore, it probably shouldn't be dependent on using your mirror notifications.
I was still able to get it to work by enabling Mirror popups, checking the "Use the complete..." option, then disabling the mirror popups again.
But, you might want to consider moving it out to the main dialog.
Also, can you please clarify for me use case of:
"The title of the push to use as:" eventSuffix vs. payload[0]
In my use cases I'm not seeing what this modifies or how it could be useful.
Thanks!
- Attachments
-
- pb-xbmc-notifications.xml
- sample EG tree
- (6.26 KiB) Downloaded 72 times
-
- __init__.py
- __init__.py with dismiss action added
- (190.03 KiB) Downloaded 110 times
Last edited by bengalih on Thu Sep 24, 2015 11:31 pm, edited 1 time in total.
Re: PushBullet plugin (Pako)
Pako - I've made one more addition.
I've created a handler for the "sms_changed" type.
Apparently, PB doesn't fully support sending SMS events from most SMS applications.
All they send is an sms_changed event and then apparently it is up to the notified to somehow retrieve the messages.
They don't seem to have published the API info yet to do this, so the best we can tell is that an SMS was received (by getting the sms_changed event).
I've added a new function "processSMSChanged" which basically creates an event trigger for this event. There isn't a lot of data that comes with it, so in my case I settle for an alert that says:
"SMS received, check your device"
I made this a separate function, although you may wish to either incorporate it in with processMirror or else add the enabMirr functionality to the function so that you can get popups.
Technically it isn't a mirror, but most people probably want the same functionality.
I didn't totally have time to figure our the icon processing, or else I would have replicated the enabMirr as it stands.
Again, hope you consider implementing this in the base code so I don't have to keep on modifying
I've created a handler for the "sms_changed" type.
Apparently, PB doesn't fully support sending SMS events from most SMS applications.
All they send is an sms_changed event and then apparently it is up to the notified to somehow retrieve the messages.
They don't seem to have published the API info yet to do this, so the best we can tell is that an SMS was received (by getting the sms_changed event).
I've added a new function "processSMSChanged" which basically creates an event trigger for this event. There isn't a lot of data that comes with it, so in my case I settle for an alert that says:
"SMS received, check your device"
I made this a separate function, although you may wish to either incorporate it in with processMirror or else add the enabMirr functionality to the function so that you can get popups.
Technically it isn't a mirror, but most people probably want the same functionality.
I didn't totally have time to figure our the icon processing, or else I would have replicated the enabMirr as it stands.
Again, hope you consider implementing this in the base code so I don't have to keep on modifying
- Attachments
-
- __init__.py
- with dismiss and sms_changed functions
- (190.89 KiB) Downloaded 112 times