Getting more out of notifications

So this isn't strictly a Hubitat thing. I currently have notifications setup to go to mine and my wife's phones when the washer or dryer finishes. I have some ideas for other notifications as well.

Notifications can be useful, but I feel like there are a few things that could make them more useful. Here is a use case: The washer finishes. A notification goes to both phones. I move the laundry to the dryer and on the "washer is finished" notification, I hit a "done" button or something similar and clears the notification from my phone AND my wife's phone. That way she isn't left wondering if the laundry has been moved. Bonus points if it can send a command back to Hubitat to press a button. Also would prefer if the notification cannot be swiped away by accident.

Does anyone know of a way to do something like this?

1 Like

I have a Notification Tile driver that I use to split out notifications and display on a dashboard tile, that may work for you. I set it to be the destination of notifications of specific applications/integrations so that I can see the last 5 at a glance; i.e. you can have HSM going to a tile, and a general tile that shows everything else.

 * Notify Tile Device
 *  Licensed Virtual 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:
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WIyTHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *  Change History:
 *    Date        Who            What
 *    ----        ---            ----
 *    2021-01-06  thebearmay	 Original version 0.1.0
 *    2021-01-07  thebearmay     Fix condition causing a loss notifications if they come in rapidly
 *    2021-01-07  thebearmay     Add alternative date format
 *    2021-01-07  thebearmay     Add last5H for horizontal display
 *    2021-01-07  thebearmay     Add leading date option
 *    2021-01-22  thebearmay     Add a span tag and id to allow custom CSS on the text
import java.text.SimpleDateFormat
static String version()	{  return '1.1.0'  }

metadata {
    definition (
		name: "Notify Tile Device", 
		namespace: "thebearmay", 
		description: "Simple driver to act as a destination for notifications, and provide an attribute to display the last 5 on a tile.",
		author: "Jean P. May, Jr.",
	) {
       		capability "Notification"
	    	attribute "last5", "STRING"
            	attribute "last5H", "STRING"
            	attribute "notify1", "STRING"
            	attribute "notify2", "STRING"
            	attribute "notify3", "STRING"
            	attribute "notify4", "STRING"
            	attribute "notify5", "STRING"
		attribute "notificationText", "STRING"

		command "configure"//, [[name:"notification*", type:"STRING", description:"Notification Text"]]   

preferences {
	input("debugEnable", "bool", title: "Enable debug logging?")
    input("dfEU", "bool", title: "Use Date Format dd/MM/yyyy")
    input("leadingDate", "bool", title:"Use leading date instead of trailing")

def installed() {
	log.trace "installed()"

def updated(){
	log.trace "updated()"
	if(debugEnable) runIn(1800,logsOff)

def deviceNotification(notification){
    sendEvent(name:"notificationText", value: notification)

def updateLast5(notification){
    dateNow = new Date()
    if (dfEU)
        sdf= new SimpleDateFormat("dd/MM/yyyy HH:mm:ss")
        sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
    if (leadingDate)
        notification = sdf.format(dateNow) + " " + notification
        notification += " " + sdf.format(dateNow)
    last5 = "<span id='last5'>"+notification+"<br />"+device.currentValue("notify1")+"<br />"+device.currentValue("notify2")+"<br />"+device.currentValue("notify3")+"<br />"+device.currentValue("notify4")+"</span>"
    last5H = " ** "+last5.replaceAll("<br />"," ** ")+" ** "
    sendEvent(name:"notify5", value:device.currentValue("notify4"))
    sendEvent(name:"notify4", value:device.currentValue("notify3"))
    sendEvent(name:"notify3", value:device.currentValue("notify2"))
    sendEvent(name:"notify2", value:device.currentValue("notify1"))
    sendEvent(name:"last5", value:last5)
    sendEvent(name:"last5H", value:last5H)                                


def configure() {
    sendEvent(name:"notificationText", value:" ")
    sendEvent(name:"last5H", value:" ")
    sendEvent(name:"last5", value:" ")
    sendEvent(name:"notify1", value:" ")
    sendEvent(name:"notify2", value:" ")
    sendEvent(name:"notify3", value:" ")
    sendEvent(name:"notify4", value:" ")
    sendEvent(name:"notify5", value:" ")

void logsOff(){
1 Like

For such tasks I use the App Tasker, which is an events/trigger driven programming environment for Android.

With Tasker you can intercept clicks on notifications, and e.g. then do a http-get to reach Hubitat by using it's Maker API.

1 Like

I found this and I think I'm going to mess around with it this weekend.

Hi @thebearmay! I would like just to say THANK YOU! This driver conjugate with your app Lock History are the best alternative to the native app Lock Manager, that never worked to me!


Hi @thebearmay!

Your driver Notify Tile Device and the app Lock History aren't working anymore. Do you you intend to update them?

Are you getting an error? Haven’t looked at Lock History for a while, but willing to take a look at it if you can describe what isn’t working. Notify Tile I still use every day and haven’t seen any issues.

So the error probably is caused by the app, once I use its notifications on Notify Tile.

Lock Story just stopped to send notifications one week ago, and when I tried to access the History or the Maintain alternate names in the app it stucked with a message saying that An unexpected error has occurred trying to load the app. Check Logs for more information.

Is there an error in the log?

Nop, it is empty. It seems to be the same kind of problem that affected another app I use, Device Activity Check. When I hit the internal links the same error appear! I believe it is related to some hub update.

I’m on the road again, so it will be a couple of days before I can look at it, but I’ll take a look when I get back.

1 Like

@thebearmay, the other app I said was with an analog issue had a string that was causing the error. The solution was indicated by an user here.

I hope it be useful! By the way, is there some way to show just the last notification instead of the last five in your Notification Device Tile?

Thanks I’ll take a look at that. As for number of messages displayed try changing line 66 to

input("msgLimit", "number", title:"Number of messages from 1 to 20",defaultValue:5, range:1..20)

Edit: Same issue as thread you pointed out -embedded sections, Would have taken me a while to see that. New verision of Lock History is out on Github. Thanks.

1 Like

Who thanks again is me, @thebearmay! Changing the value indicated made the magic.

Greetings directly from Brazil!

Download the Hubitat app