[OBSOLETE] Pushbullet Notifier 1.2.1

Updated the github to 1.1.0

It now has the capability to notify for a temperature sensor. You can choose a temperature threshold and get a notification if it get’s above or below that number. I put this in the app as well: I suggest inputing a minimum number of minutes between notifications unless you want to get a notification every single time the temperature changes past the threshold.

Enjoy!

@625alex @baldeagle072 I so do luv the push bullet and so using it now for everything…without bothering the missus…

2 Likes

I’m glad you’re enjoying it!

I’ve created a service manager. It uses a slightly different device type. If you have been using @625alex’s device type, you will have to switch to mine. Instructions for installation are on the github for the project. Check out the new topic for more information : Pushbullet device with service manager

1 Like

I’m glad you picked it up and making a good use out of it!

You may also be interested in upgrading and using my “State Of The World” app with your new device type.

This app monitors a number of devices. When something changes, it pushes a summary message with statuses of all devices.

https://github.com/625alex/SmartThings/blob/master/apps/StateOfTheWorld.groovy

Just updated github to version 1.2. There are new capabilities: Sleep and Button (I did these to test Jawbone reaction times)

@625alex @baldeagle072 Probably one of the best integration, guys! Valentine’s Day and a happy missus (no more do not care notifications!)… Priceless! Do they have some kind of a limit? I luv it…

1 Like

I’m a little confused by this and the Service Manager… So I need to re-install the app for each thing I want to be notified about?

You can write your own app and use it for anything. You just need the device type. If @baldeagle072 doesn’t mind you can modify that your purpose. I modified my custom SmartApps to use pushbullet instead of push notifications for non critical messages so as not to bug missus.

Notifier - You need a new instance of the app for each capability you want to get notified about. I did this for personal reasons mostly for message customizability. The code wouldn’t be that hard to adapt to make it one app for all the different capabilities at the same time using this code as an example. I just don’t have the time to do that right now.

Service Manager - Currently, you need to install a separate instance for each pushbullet device you want to get a notification on. This was done for ease of coding at the moment to get it to work. I haven’t gotten a chance to figure out how to make it a one app for all devices yet, but it is a plan for the future.

1 Like

So haven’t really looked at your code and it is absolutely light years beyond what I have done. I did just modify the Something Left Open app that uses pushover to send notifications about open/close sensors to use pushbullet as well.

I saw that you said you need multiple instances for each device, dunno if this is helpful, but you can send a pushbullet notification to all devices if you withhold the iden identification. I am not sure if this applies to the v1 api but with the v2 api, you only need to send the type (note), the title, and the body. If you do not include an iden then it will broadcast to all devices. From what I know of the v2 api, it’s either all or one. The api currently doesn’t take multiple devices. Personally, I want it going over since pushbullet notifications are managed across devices and I can dismiss them from my laptop or phone.

My only thought would be to have the ability to add multiple API keys (so like a pushbullet #1, #2, etc) so that if me and the wife both want notifications, I can set them up separately and maybe for her use an iden but for me on all devices.

Anyhow…got this working on the Something Left Open app and it broadcasts to all my devices. It’s working great and would love to add to pretty much all smart apps.

I am going to look at what you have as it seems to be able to send a notification for any sensor on a statechange, is that right? If so, just tweaking the options to get it to send to all would be perfect and this would be my new favorite app!

Let me know if you want to chat any further!

Tony

This is true. When I made the service manager, it was because I wanted a way to add individual pushbullet devices easily. I would rather push to a single device rather than all my devices mostly because I want some notifications on my computer, but not ones that I don’t want my students to see (I am a teacher and use my computer at school).

The notifier does take multiple pushbullet devices, so you can get notified on more than one device.

I am planning on this, but have not had time to work on it yet.

Yeah my apologies Eric, once I delved in deeper I saw how complete the integration is. Very well done!

I think it would be fairly easy to add an option to the smartapp that if an iden is provided it goes to those devices else it pushes to all. Let me know if you could use some help and I could take a look.

I would also look into (and this is probably way future state) adding the ability to do a timer in there as well. So essentially you could perform the “Something Left Open” functionality within the service manager. It may also be too much too?

I would love to have a super app that I could use to say if this door is opened longer than x, send pushbullet, if this temp goes over this, send pushbullet, one someone arrives/leaves, pushbullet. Essentially criteria for every sensor and it’s corresponding message. That way you could have a singular super smartapp for all sensors instead of deploying multiple apps per sensors. May be a pipe dream…I dunno…I just recently started looking at the code.

Tony

@ffingers

All you need is the device type and in your SmartApp just call the method sendMessage(msg) from anywhere in the code passing in the message.

Courtesy/Extract taken from @baldeagle072’s code for my use.

  section( "Notifications" ) {
        input "pushbullets", "device.pushbullet", title: "Pushbullet Device(s)", multiple: true, required: false
    } 

//blah...blah....

def sendMessage(msg){
	log.debug "send message: ${msg}"
	def title = "SmartThings: ${app.label}"
    pushbullets.each() {it ->
        it.push(title, msg)
    }
}

Hmm that’s interesting…maybe I’ll look into trying out a smartapp from the ground up and using that.

I guess of the few people reading this…(I know for me) But what would be the appetite of having a smartapp that utilizes pushbullet that sort of consolidated notifications for multiple different types of statechanges along with potential constraints all within a singular app. I am trying to visualize it in my head…may need to tinker and see what I can do first.

Only problem, only have a limited number of devices at the moment to test it out with :frowning:

Here is a complete untested SmartApp which checks if all your doors are locked once everyone is away and notifies you when somebody comes back and whether it is safe to enter (meaning mode has changed to home from away… you don’t want alarm going off all over the place when missus gets home. The messages will be sent on your Push bullet device.

PS: New to groovy. Please don’t judge. :wink:

/*
 *  Simple Pushbullet Example
 *
 *  Copyright 2015 Ron S     *

 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */
definition(
    name: "Simple Pushbullet Example",
    namespace: "rons",
    author: "Ron S",
    description: "Simple Pushbullet Example",
    category: "My Apps",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
    iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")

preferences {
    section("Family") {
        input "people", "capability.presenceSensor", multiple: true, required: true
    }
     
	section("Check these doors when Everybody is Away..."){
  		input "doors", "capability.contactSensor", title: "Which Doors?", required:false, multiple: true
 	}
    
    section( "Notifications" ) {
        input "pushbullets", "device.pushbullet", title: "Pushbullet Device(s)", multiple: true, required: false
    }
}

def installed() {
    log.debug "Installed Home Status Monitor with settings: ${settings}";
    log.debug "Current mode = ${location.mode}, people = ${people.collect{it.label + ': ' + it.currentPresence}}";
    initialize();
}

def updated() {
    log.debug "Updated with settings: ${settings}";
    log.debug "Current mode = ${location.mode}, people = ${people.collect{it.label + ': ' + it.currentPresence}}";
    unsubscribe();
    initialize();
}

def initialize() {
    log.debug( "Inializing" );   
 	subscribe(people, "presence", presenceHandler);
}

def presenceHandler(evt)
{
    if (evt.value == "not present"){
        log.debug "Check if everybody is away.";
        if (everyoneIsAway()){
            log.debug "Everybody is away. Sceheduling runIn...";
            runIn(60, "checkAwayStatus", [overwrite: false]);
        } else {
            log.debug "Somebody is home. Not sending text message or push.";
        }   
 	} else {
     	log.debug "$evt.displayName is home.";
        runIn(60, "checkHomeStatus", [overwrite: false]);
    }
}

private everyoneIsAway()
{
    def result = true;
    for (person in people) {
        if (person.currentPresence == "present") {
            log.debug person.displayName + " is present.";
            result = false;
            break;
        } 
    }
    log.debug "everyoneIsAway: $result";
    return result;
}

def checkAwayStatus(){
	def msg = "Everybody is away. Confirmed home is now in ${location.mode} mode.";
	def openDoorsWarning = "";
	def openDoors =  doors.findAll{ it -> it.currentValue("contact") == "open" };
    if (openDoors.size() > 0){
		openDoorsWarning = " Warning: these doors are still OPEN: " + openDoors;;
    } else {
		openDoorsWarning = " Confirmed All doors are CLOSED. ";
	}
	msg += openDoorsWarning;
	log.debug openDoorsWarning;
   	sendMessage(msg);
}

def checkHomeStatus(){
	def msg = "Welcome home! Confirmed home is in ${location.mode} mode and safe to enter.";
 	sendMessage (msg);
}

def sendMessage(msg){
	log.debug "send message: ${msg}"
	def title = "SmartThings: ${app.label}"
    pushbullets.each() {it ->
        it.push(title, msg)
    }
}

Nice Ron. I’ll take a look at that as well.

I am TOTALLY new to groovy and honestly have not programmed seriously in probably 15 years so I am dusting off the chops and trying to get into this a bit.

We’ll see how hard I stumble and fall LOL.

Tony

Tony, I’m pretty sure we chatted about SharpTools + Tasker in another thread, but you could definitely use it to achieve what you are looking for. Since your logic is primarily about notifications, this is something that would work well in Tasker. Behind the scenes, the subscription would trigger light-weight pushes to come to your phone and you could setup Tasker to determine which notifications you wanted to display and when.

This lets you do some other cool things like put together quick actions in your notifications that let you respond to the notification. For example, maybe you want to be able to lock the door again if it was unlocked for five minutes:

You could even have the quick-action check to make sure the open/close sensor was in the closed position or provide you a separate set of activities (like SMS the kids/roomate and tell them to close the door!)

Reference: Event: Thing State

Yeah we have Joshua, I’ll take a look at it. I am sure it can likely do what I am thinking. The only issue is that then my phone (or whatever device) is then responsible for sending notifications. I am not sure how I feel about that since if my phone or devices dies, that could be problematic. At least if it’s coming from a smartapp, I know the notifications will go out.

To be honest, this is all in my head at the moment and have not put any pen to “screen” yet. I have to figure out what I want it to even do yet. It may be that it cannot be handle via one “super” app but must be handled by multiple smaller apps…but I dunno yet. Hopefully next week, I’ll have some time to sit down and think it through.

Tony

TLDR: If pushing notification to Chrome/iOS, then a modified Pushbullet SmartApp with conditions/logic is the way to go. If you are on Android, then you can have much more powerful notifications using Tasker (even still using PushBullet).

@ffingers I completely agree that the phone should not be used an automatic logic control point (at least for most cases). In general, I think this logic should either reside in the SmartThings cloud (as it currently does) or better yet on the Hub as is expected for Hub v2. For example, if you are pushing notifications to Chrome or iOS, using Tasker obviously wouldn’t be the right solution for you.

I had interpreted your request that you wanted a single ‘SmartApp+App’ that would handle all of the different push events rather than having multiple instances with each one configured for a different device/condition. My point was SharpTools has a single supporting SmartApp in the SmartThings cloud reacting to all events you choose and silently and efficiently pushing those events out to all subscribed Android devices. With Tasker you could ‘filter’ those events on the mobile device side of things which gives you even more power with what you do with those events when you receive them.

For example, you might:

  • Simply display the notification with just the Thing name, attribute name, and attribute value
  • Require that several Things are in a certain state before displaying a notification
  • Setup special conditions/logic before displaying a notification (including conditions the phone is locally aware of)
  • Provide quick-action buttons within the notifications so you don’t even have to open your phone to react