HomeGenie Forum

Automation Program Plugins and Wizard Scripting => APP Contributions => Topic started by: mvdarend on May 05, 2015, 09:02:40 AM

Title: PushBullet (PushingBox alternative)
Post by: mvdarend on May 05, 2015, 09:02:40 AM
Since I've moved back to Android from Windows and I'm now using PushBullet for PC -> phone notifications I decided to integrate PushBullet into Homegenie.

You can associate modules with PushBullet or call it independently with the following code:
Code: [Select]
var pushBullet = Modules.InDomain("HomeAutomation.Network.Pushbullet").WithAddress("1").Get();
pushBullet.Command("Send").Set("Message to send.");

Here's more info:
https://www.pushbullet.com/ (https://www.pushbullet.com/)
Title: Re: PushBullet (PushingBox alternative)
Post by: thundergreen on May 12, 2015, 08:08:41 AM
hey  all. is there any possibility to use.this addon with xmpp / jabber ? I have my own xmpp server running and would just like.to integrate some events via xmpp like motion control or notifications when some sensors have an alert. Is that possible in some way? would highly appreciate

Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on May 12, 2015, 09:02:01 AM
To be honest, I have no idea how  xmpp / jabber works.

A quick Google search for "xmpp / jabber pushbullet" doesn't help much, it looks like you need a third party app (Zapier, Cloudpipes) to get them to communicate.
Title: Re: PushBullet (PushingBox alternative)
Post by: thundergreen on May 12, 2015, 11:46:13 AM
hi all. i try to make HG communicate with mqtt and xmpp. maybe this can be an idea.. i'm a newbie in linux and don't know how to realize this, but it should be possible and it would be great if someone could write a plugin for HG?

http://ceit.uq.edu.au/content/using-xmpp-home-and-building-automation-first-post (http://ceit.uq.edu.au/content/using-xmpp-home-and-building-automation-first-post)

http://ceit.uq.edu.au/system/files/blog/41194386_-_Thesis_Proposal_-_Using_XMPP_in_Home_and_Building_Automation.pdf (http://ceit.uq.edu.au/system/files/blog/41194386_-_Thesis_Proposal_-_Using_XMPP_in_Home_and_Building_Automation.pdf)

Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on June 02, 2015, 08:43:03 PM
I've added a new .hgx file with the following line added to ignore any certificate warnings:
Code: [Select]
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
I was getting a 'Error getting response stream (Write: The authentication or decryption has failed.): SendFailure' error and mozroots --import --ask-remove wasn't helping. So I decided to just trust the certificate.
Title: Re: PushBullet (PushingBox alternative)
Post by: kevin1 on June 03, 2015, 01:03:01 PM
Just curious, is there an advantage of PushBullet over sending text messages via email?
Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on June 03, 2015, 01:38:09 PM
Just curious, is there an advantage of PushBullet over sending text messages via email?
For me the main advantage is that PushBullet 'Alerts' are separate from my emails. (I don't like my email cluttered with other messages.)

But, in the end it's just another way to send a message (although PushBullet can do more than just messaging),  some people prefer WhatsApp over Email, others prefer texting :)
Title: Re: PushBullet (PushingBox alternative)
Post by: KaZe on August 17, 2015, 08:35:29 PM
Hi!

It's nice program. Works fine. But, can I change character encoding?

The program send me that:

Code: [Select]
Riaszt� rendszer �les�tve!
Riaszt� rendszer �les�tve!

but really like this:
Code: [Select]
Riasztó rendszer élesítve!
Riasztó rendszer élesítve!
Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on August 18, 2015, 07:07:45 AM
Quote
But, can I change character encoding?
I don't know... I'll see if I can find something. A quick Google search for Pushbullet and encoding doesn't help me much, and I don;t have much experience with character encoding.

If all else fails I can strip the diacritics before sending, is that an option for you?

eg:
Riasztó rendszer élesítve!
will become
Riaszto rendszer elesitve!
Title: Re: PushBullet (PushingBox alternative)
Post by: KaZe on August 18, 2015, 10:30:44 AM
Thanks!

But I have the same problem with mirage. :( ( http://www.homegenie.it/forum/index.php?topic=1031.0 (http://www.homegenie.it/forum/index.php?topic=1031.0) )

I'll wait a bit to see if Gene knows what's wrong.
Title: Re: PushBullet (PushingBox alternative)
Post by: Bitcraze on August 21, 2015, 08:53:39 PM
Hi, mvdarend

I am running latest HG (493) on Windows.

Have added your pushbullet and copied and pasted my pushbullet Access Token.

On my one light switch, I selected pushbullet and ticket Notifications Change.

Issue: Not working, no Notification received on my Android cellular for pushbullet app?

Any help will be much appreciated.
Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on August 21, 2015, 09:08:10 PM
Hi BitCraze,

I just tested it on my Windows test machine (v.493) with a Philips Hue light and a Virtual switch and both worked for me.

Can you send test messages from the PushBullet site to your mobile device?

Is it possible that your firewall is blocking outgoing traffic?

Can you double check the access token?
Title: Re: PushBullet (PushingBox alternative)
Post by: Bitcraze on August 31, 2015, 04:39:51 PM
Hi, mvdarend

Checked PushBullet: Using correct Access Token in HG (copied and pasted).

Tested PushBullet web link to my phone: Received.

HG: Added "TestPB" virtual switch: Seems greyed out. Nothinh happens when clicked.
Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on August 31, 2015, 04:43:04 PM
HG: Added "TestPB" virtual switch: Seems greyed out. Nothinh happens when clicked.
Could you add a screenshot of that?

Have you also tried temporarily disabling the firewall on the HomeGenie machine?
Title: Re: PushBullet (PushingBox alternative)
Post by: Bitcraze on September 22, 2015, 05:14:35 PM
Hi, mvdarend

It's running on a Windows PC. Have disabled Firewall and tested: No change.

Works from PushBullet website to my Android phone.

My test button is attached. Nothing happens when clicked.
Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on September 22, 2015, 08:16:04 PM
To be honest I have no idea what you are trying to do... Have you tried it with a normal switch or button?

- What is TestPB, it doesn't look like a normal button to me, does it actually have a change event?
- Why have you given 'Network 1' the name 'PushBullet'? The name is probably conflicting with the actual PushBullet APP.

And how exactly are the three screenshots related to each other?

Title: Re: PushBullet (PushingBox alternative)
Post by: Gene on September 22, 2015, 08:56:03 PM
Hi Bitcraze,

"gray led" means that the program is not enabled. starting from r494, hg won't let disabled program to run. so enable that program first (yellow led).

Title: Re: PushBullet (PushingBox alternative)
Post by: Bitcraze on September 23, 2015, 09:54:15 AM
Hi, Gene

Thanks for the reply. :)

It is enabled (see attached), bit icons show blue?

The code is eneterd.
Title: Re: PushBullet (PushingBox alternative)
Post by: Gene on September 23, 2015, 10:35:01 AM
Well the name of the button is different from the name shown in this screenshot. So where is that grayed button coming from? :)

Title: Re: PushBullet (PushingBox alternative)
Post by: Bitcraze on September 23, 2015, 06:05:08 PM
Hi, Gene

I don't quite understand?

Let me tell you the steps I took:

I added the .hgx file to "Messaging and Social" and enabled. Then added the Authorization token. Should it show BLUE on the left?

In Configure, Groups, I added a Test Group.

In that Group, I added Module by selecting from the List: Pushbullet 1000

The Button Pushbullet then shows under Test Group. The light is Grey, but goes yellow for a split second when I click it, then back to Grey.

Every 6th click or so, it would go green, and stay green, until clicked.

No PushBullet Notifications received on my Android phone.


Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on September 23, 2015, 07:04:56 PM
I think you're misunderstanding how the PushBullet APP works. Basically it's the same as the Pushing Box APP.

Quote
In that Group, I added Module by selecting from the List: Pushbullet 1000

You don't need to do that, just activating the APP is enough. (Blue is in the latest test version, I think it means running in background.)

Add a simple switch, light or sensor to a group, and then activate Pushbullet notifications. When a value changes for the given switch, light or sensor you should receive a pushbullet notification.

Or you can try the C# example from the first post.
Title: Re: PushBullet (PushingBox alternative)
Post by: Bitcraze on September 29, 2015, 08:40:40 AM
Hi,

Thanks so much: Working perfectly!  ;)
Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on October 28, 2015, 11:58:44 AM
Hi!

It's nice program. Works fine. But, can I change character encoding?

The program send me that:

Code: [Select]
Riaszt� rendszer �les�tve!
Riaszt� rendszer �les�tve!

but really like this:
Code: [Select]
Riasztó rendszer élesítve!
Riasztó rendszer élesítve!

Hi KaZe, I noticed while testing something else today that the character encoding works properly, could you confirm?. (I'm running v498)
Title: Re: PushBullet (PushingBox alternative)
Post by: KaZe on October 28, 2015, 12:31:08 PM
Hi mvdarend!

I test it on v499. You're right. I confirm that, the character encoding works properly for me too. Nice :)
Title: Re: PushBullet (PushingBox alternative)
Post by: KaZe on November 30, 2015, 08:07:52 PM
Hi!

I add 1 more feature to the program. "Pushbullet notifications only under away security mode".
So, if this checkbox checked, you only get the notifications, if the security system is "away" mode. (so, nobody at home)
I think this feature usefull for everyone, who use built in security system.
Title: Re: PushBullet (PushingBox alternative)
Post by: roger.wills on December 21, 2015, 11:27:55 AM
Hi,

Pushbullet is working as described above. How do I go about changing the message text so that it reads more like real english. So to be clear, at the moment I get a message along the lines of:

Module: Roger's Garage Door
 Parameter: Status.Level
 Value: 0

But I want to change it to something like:

Roger's Garage Door is closed.

Similarly, when it is open, i.e. status level is 1, I want it to say something along the lines of "Roger's Garage Door is open".

 It will help with the WAF!
Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on December 21, 2015, 11:40:53 AM
One way is to change the program itself to check for the type of sensor and then to give custom strings depending on the sensor type, you can then change this line for a more friendly message:

Code: [Select]
string theMessage = String.Format("Module: {0}{3} Parameter: {1}{3} Value: {2}{3}", module.Instance.Name, property.Name, property.Value, Environment.NewLine);   

Another way is to not use the 'Pushbullet notifications' checkbox. I only ever use it for testing, for 'real' messages I usually create a new program with something like the following:

Code: [Select]
When.ModuleParameterChanged( (module, parameter) =>
{                             
  if (module.Is("Roger's Garage Door"))
  {   
    if(parameter.Name == "Status.Level")
    {     
      var pushBullet = Modules.InDomain("HomeAutomation.Network.Pushbullet").WithAddress("1").Get();
      string messageToSend = String.Empty;
      if(parameter.Value == "1")
      {
        messageToSend = "Roger's Garage Door is open!";
      }
      else
      {
        messageToSend = "Roger's Garage Door is closed.";
      }
      pushBullet.Command("Send").Set(messageToSend);
      return false;
    }
  }
  return true;
}); 

I haven't tested the above code.
Title: Re: PushBullet (PushingBox alternative)
Post by: roger.wills on December 28, 2015, 06:04:09 PM
Hey Marcel,

Your code was absolutely spot on! Thanks very much.

Next question!

I need to be able to send pushbullet messages to more than one recipient. In my particular scenario, we have a double garage, one port is used by me, the other by my wife. I need to be able to notify her when door opens and closes and I need to notify me whenever my door opens or closes (I may also choose to add a notification to me whenever my wife's garage door opens or closes as well). How do I go about that? Is it a case of having a second instance of the Pushbullet program say Pushbullet2 so that I can input my wife's access token and then modify the code you have written accordingly? Or is there a simpler way? I assume that Pushbullet2 would also require some modification?

Thanks,

Roger
Title: Re: PushBullet (PushingBox alternative)
Post by: mvdarend on December 28, 2015, 08:09:38 PM
To be honest, I've never tried anything like that.

Your idea sounds like it should work, but I've no idea if it will. I fear you'll have some conflicts with two almost identical programs running.