Hubitat Notifications to something other than my Phone

I use Webcore for most of my automation and use the Push Command to send a lot of custom Notifications to my phone.

I am looking for a way to get these notifications into Node-Red (directly or via MQTT) so that I can publish them via an Iframe on my main control tablet in the kitchen.

The Hubitat Nodes don't seem to do this and I can't see any other way of doing it.

Is there a way! If so can someone please point me in the right direction?

Thanks

Pushover

One way is to create a virtual notification device that stores the notification to an attribute and add that device to Maker-API and Node-Red. I use this one to display notifications to a tile, but it could be used with Node-Red:

https://raw.githubusercontent.com/thebearmay/hubitat/main/notifyTile.groovy

Edit: BTW it does also generate a Last5 attribute which is HTML.

1 Like

You could try and write the notifications out to a file on the HE hub and have the IFRAME read them in? There's a few hops to go through in writing the text, but it can be done. Only thing I would not be sure about would be how to have the iframe refresh regularly.

Thanks Guys.

Pushover - Looked at this but, I can't see any way to get the raw data out. Although it would get it as far as a PC

I sort of use the virtual switch now. But, a lot of my pistons use variables so for instance if a piston detects a low battery the push message includes the device with a low battery. Trying to do this with virtual switches seems impossible.

Write notifications to the file then reading the file. I could probably make this work if I had a clue how! Is there any tutorial or info I can reference to see how to do this? (Be gentle with me).

It's funny I can get variables and modes out of the hub as text but not the notifications. I feel it should be very simple. Maybe this could be added to the feature request list, or is it far more difficult than I imagine!

Thanks

Here's the post where Bruce describes how to use variables in RM 4 to represent a file stored locally on the HE hub:

Here's the post where I briefly talk about how I was able to get a device attribute stored in a local file. Don't worry too much about the trigger I used, that can be whatever you need.

Depending on your circumstances, you may not need the two step process I describe. If the message is one you can include in the definition of the rule, then you may only need to type it in when setting the "file" variable in the rule action.

See how you go and sing out if you need a hand.

Simon

2 Likes

Oh, and here is some sample scripting I put in my HTML file to read in the data. Note this relies on the data being in a JSON format. The code reads in image file names and adds them into a DIV element in the body, with different CSS styles depending on the image type.

<script>

	$(document).ready(function () {
		
			$.ajax({
			  dataType: "json",
			  url: "imageCycle.json",
			  success: function (data) { 
				
				// Find the DIV element that will contain the images
				var divContainer = document.getElementById("picLayer");

				$.each( data, function( key, val ) {
				
					var img = document.createElement("img");      // IMAGE
					if (key.includes("background")) { img.className = key;      }
					if (key.includes("image")) 	 { img.className = "images"; }
					
					img.src = val;
					divContainer.appendChild(img);
				});

			  }
			}).fail(function(jqXHR, textStatus, errorThrown) {
			  console.error(jqXHR, textStatus, errorThrown);
			  console.error(jqXHR.responseJSON);
			});	
		
		});

	</script>
1 Like

Thanks, I will try and digest all of this over coffee tomorrow morning.

Just a thought.

How easy would it be to add this as a read-only string in the API! Along side "Mode"

I bet a lot of people would find that very useful!

1 Like

@thebearmay, Just been playing with your notifyTile Driver as it looked to be exactly what I need.

However, It's not behaving as I expected.

If I send a notification directly from the driver it goes to Node-Red and my Mobile Device.
If I send a notification directly from Hubitat RM it goes to Node-Red and my Mobile Device.

If I send a notification from Webcore it only goes to my Mobile Device. (it doesn't show in the driver panel or Node Red at all).

Am I missing something?
Is this the correct behavior!
Is there a way to correct it as 95% of my notifications come from Webcore

Thanks

Fixed it!

Its me not setting the device as a message option in Webcore. Bit slow today!

Under webCoRE Settings you need to add it as a pushMessage Device:

1 Like

Got it all working.

I thought I would give a final update. Maybe it will inspire other people.

  • Using @thebearmay excellent driver to access the notifications.
  • WebCore generates the push notification and sends them to my phone and the notification driver.
  • Using Hubitat API to suck the notifications (notificationText) into Node-Red
  • A Node-Red flow then sends the notifications to InfluxDB on my Pi4b running Node-Red, InfluxDB, Grafana.
  • I then created a new Grafana Logs Panel on my Kitchen Dashboard alongside all the other graphs and Actiontiles Iframes.

Seems to work very well (will Display approx the last 10 Notifications) and I am very happy with it.
The only issue is it takes a couple of minutes to update. (I could speed it up using more resources but it's not a problem for me but maybe for someone else)

Notification test

2 Likes