HomeHome AutomationTurning Join and NodeRED into a RSS notification system

Turning Join and NodeRED into a RSS notification system

Who needs RSS readers when you have Join and NodeRED

Join 2.0 has been released. Ther are few extra things we can do with it now. One of which is sending URL in Join notifications. I figured it would be nice to showcase this to you guys, and João came up with a neat idea. You can turn NodeRED and Join node into a pretty awesome RSS notification system. If you are obsessed with news and updates from various sites, you can get your RSS updates without any RSS apps installed on your phone or a computer.  Here is how!

RSS notification system

The setup is pretty simple. Each time a new post has been posted, we are going to issue a Join message with a title, icon, link and a brief description of the post. This should take only a few clicks.

But first things first, if you don’t have the Join node – check this tutorial out. If you do, and you feel comfortable with NodeRED – you have to install one more node:

sudo npm install node-red-node-feedparser

Or use the Palette Manager. If you just starting with NodeRED – check my tutorial for beginners first.

Now that we have everything ready – let’s start the flow:

The feedparse node will ask you for the URL of the website you want to get the new posts from. In this example I’m using AndroidPolice, they post often enough to get this tested quick:

https://www.androidpolice.com/feed/

I want the Join messages to look nice, so I’m going to create the title and assign the icon for each notification. I could embed this into the function code, but I know for sure I will be adding multiple sources, so using the change node is much more forward-thinking:

To set the Join title & icon we need to assign the following values:

msg.title = Android Police
msg.icon  = https://lh4.googleusercontent.com/-2lq9WcxRgB0/AAAAAAAAAAI/AAAAAAAAETw/Yk2jY1eiZss/photo.jpg

Next, I’m using a function node to process the information from the feed node:

The Function Node code
if(!msg.title){
    node.error("Must provide a notification title");
    return;
}

if(!msg.article){ 
    node.error("No article received");
    return;
}
var article = msg.article;
if(!article.date){ 
    node.error("Article has no date. Can't check.");
    return;
}

var globalName = msg.title.replace(" ","_").toLowerCase() + "RssDate";

var date = Date.parse(msg.article.date);
var lastAp = global.get(globalName) || 0;

if(date<lastAp) return;

global.set(globalName,date)
msg.date = date;

msg.push = {
    "title":msg.title,
    "text":article.title,
    "url": msg.topic,
    "icon":msg.icon
};
return msg;

In short, there are three if statement to handle the potential errors. Then I process the outcome from the feedparser to receive the URL and description of the article.

These values are saved JSON object:

{ "title":msg.title, "text":article.title, "url": msg.topic, "icon":msg.icon }

and send as the msg.push to Join node. At the time of the writing, Join node has not been updated with the detailed description but here are the values that Join can receive:

Join API fields you can use
  • deviceId – The device ID or group ID (must use API Key for groups) of the device you want to send the message to. It is mandatory that you either set this or the deviceIds parameter. Possible groups are
    • group.all
    • group.android
    • group.windows10
    • group.phone
    • group.tablet
    • group.pc
  • deviceIds – a comma separated list of device IDs you want to send the push to. It is mandatory that you either set this or the deviceId parameter
  • deviceNames – a comma separated list of device names you want to send the push to. It can be parcial names. For example, if you set deviceNames to  Nexus,PC it’ll send it to devices called Nexus 5, Nexus 6, Home PC and Work PC if you have devices named that way. Must be used with the API key to work!
  • text – usually used as a Tasker or EventGhost command. Can also be used with URLs and Files to add a description for those elements
  • url – A URL you want to open on the device. If a notification is created with this push, this will make clicking the notification open this URL.
  • clipboard – some text you want to set on the receiving device’s clipboard. If the device is an Android device and the Join accessibility service is enabled the text will be pasted right away in the app that’s currently opened.
  • file – a publicly accessible URL of a file. You can also send the url of a file on your personal Google Drive
  • smsnumber – phone number to send an SMS to. If you want to set an SMS you need to set this and the smstext values
  • smstext – some text to send in an SMS. If you want to set an SMS you need to set this and the smsnumber values
  • smscontactname – Alternatively to the smsnumber you can specify this and Join will send the SMS to the first number that matches the name
  • mmssubject – Subject for the message. This will make the sent message be an MMS instead of an SMS
  • mmsfile – File attached to the message. Must be a local (to the phone) file or a publicly accessible URL.  This will make the sent message be an MMS instead of an SMS
  • mmsurgent – Set to 1 if this is an urgent MMS. This will make the sent message be an MMS instead of an SMS
  • callnumber– phone number to call
  • wallpaper – a publicly accessible URL of an image file. Will set the wallpaper on the receiving device
  • lockWallpaper – a publicly accessible URL of an image file. Will set the lockscreen wallpaper on the receiving device if the device has Android 7 or above
  • find – set to true to make your device ring loudly
  • mediaVolumeringVolume or alarmVolume – set the corresponding volumes on your device
  • interruptionFilter – Set to
    • 1 to allow all interruptions
    • to allow only priority interrupions (like priority notifications or calls)
    • 3 to not allow any interruptions
    • to only allow alarm related interruptions
  • say – Say some text out loud.
  • language – The language to use for the say text
  • app – App name of the app you want to open on the remote device
  • appPackage – Package name of the app you want to open on the remote device. You can check the package name for an app by going to its Google Play page and checking the end of the URL. Example: for YouTube this is the URL (https://play.google.com/store/apps/details?id=com.google.android.youtube) and this is the package name (com.google.android.youtube)

Notification Fields

These fields are meant for notifications created using the Join API.

  • title – If used, will always create a notification on the receiving device with this as the title and text as the notification’s text
  • icon – If a notification is created on the receiving device and this is set, then it’ll be used as the notification’s icon. If this image has transparency, it’ll also be used as the status bar icon is smallicon is not set. It’ll also be used to tint the notification with its dominating color
  • smallicon – If a notification is created on the receiving device and this is set, then it’ll be used as the notification’s status bar icon
  • priority – control how your notification is displayed: lower priority notifications are usually displayed lower in the notification list. Values from -2 (lowest priority) to 2 (highest priority). Default is 2.
  • vibration – if the notification is received on an Android device, the vibration pattern in this field will change the way the device vibrates with it. You can easily create a pattern by going here and generating the pattern in the Vibration Pattern field
  • dismissOnTouch – set to true to make the notification go away when you touch it
  • image – publicly available URL for an image to show up in the notification
  • group – unique ID to group your notifications with
  • sound – publicly available URL for a sound to play with the notification
  • actions – Set notification buttons with customized behaviour. More info here.

The RSS notification system will push new updates every 5 min, and deliver it to a Join device of your choice.

Adding multiple sources to RSS notification system

Instead of complicating the script in the node function, I used the change node to set the source related properties. I can simply duplicate the source and the change node enable additional sources without modifying the script.

It’s a very easy way of adding the sources. My advice is to store all the icons for your Join messages as shared pictures on a Gdrive. If the public link to the icon changes, you won’t have to update the RSS notification system.

But please, let me sleep!

To keep the notifications quiet during the night hours, you could use a bigtimer node and the flow enable/disable routine.

Install the bigtimer node using npm:

node-red-contrib-bigtimer

set the duration (ie 10am – 5pm) and link the 1st output to a change node. This node will set the flow.rss value as msg.payload received from the bigtimer (set to false/true as ON/ OFF Msg.

During the quiet times, I will override the Join push notification’s priority to the lowest. This way, the phone won’t make annoying sounds at night, and I won’t miss any of the RSS updates. I can do so by setting the msg.push.priority value to -2 (scale is from -2,-1,0,1,2) as the default value is 2. Outside of my scheduled hours, the notification priority will return to the default value (2).

To decide which route the new RSS topic should go, I will use a switch node in the flow.rss mode. The node will have a string (not an integer – see bigtimer output) 1 and 0 output, this way I can control what direction the RSS push is going.

Conclusion

As you can see, in this fun way you can replace the RSS app on your phone, and still get notifications from your favourite sources. The set up takes less than 5 min and you could use it to display the feed to other devices too (smart mirrors, custom displays etc). Hope you learned the new ways of pushing information using Join node.

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

Smart Ideas with

Automate your space in with these ecosystems and integrate it with other automation services

client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image

Learn NodeRED

NodeRED for beginners: 1. Why do you need a NodeRED server?

0
To server or not to server? That's a very silly question!

Best Automation Projects

Tuya SDK for beginners: Intro to Tuya Cloud API

0
Working with Tuya Cloud API. A guide to Cloud automation for beginners, get started with REST!

NEST your old thermostat under $5

0
Nest-ing up your older thermostat under $5

Nora – Google Assistant in NodeRED

0
Integrate Google Assistant with NodeRED thanks to Nora - NodeRED home automation

DIY Smart Washing Machine – for about 15 bucks!

0
Learn how to add washing machine notifications to your Google Home on the cheap

Sonoff Zigbee Bridge – review

0
Sonoff line up will soon include Sonoff Zigbee Bridge and more Zigbee sensors - here is the first look

Smart Home

Remotes aren’t done with us yet: SwitchBot Remote

0
If you hate having 20 remotes hidden in your sofa, or your parents despise talking to Alexa to turn the lights on - SwitchBot Universal Remote is here to deal with all this!

We’ve seen this before: SwitchBot K10+ PRO

0
This is an odd one. Building on the success of SwitchBot K10+ they released SwitchBot K10+ PRO - but is the experience actually better?

Is this the smart panel we have waited for?

0
ITEAD has released a new smart panel: Sonoff NSPanel Pro 120 - have they learned the lesson from the terrible launch of the original Pro? Let's see what's new.

Aqara FP1E detects motionless humans

0
This isn't exactly a new device, it's an interaction of the original Aqara presence sensor. Aqara FP1E brings Matter, ZigBee and new triggers to your smart home

SwitchBot S10: cleaning re-imagined!

0
SwitchBot S10 promises unattended vacuuming and mopping so you can focus on things you love and care for. Does it deliver?