Currently Viewing Posts Tagged Node Red

How to Autoplay Roku with Home Assistant and Node Red

This post will show you how to use home automation to autoplay shows on a Roku throughout the night. On a variety of apps (i.e., Hulu, Netflix, Amazon) you can only stream a limited number of episodes before the app checks if “you’re still watching”.

You can copy this flow from the following gist.

How the script works is basically it detects the current state of the Roku. If the state is “playing” and transitions to “on or paused” then a command is issued to resume playing.

I found that apps behave differently from each other. For example in Hulu, pressing “play” when “paused” usually resumes playing. In Netflix, however, the “select” command will resume playing.

How to Link Remote Repositories to Node Red Projects

adding ssh key in node red

Following the Node Red Project Guide allows you to backup your flows in git projects. This is a great feature for adding revision control to your projects. In this article, I will expand on the project guide and show you how to set up link your projects to a remote repository.

Remote Repositories

First, this article assumes that you have an account on a git revision control system (i.e., github or gitlab). Next, it assumes you know how to create projects and add SSH keys to your account profile.

Start by creating an empty project in your git revision control system. Next locate the ssh url for your newly created project.

Now, in the Node Red, select the Hamburger icon on the upper right and then select Project->Project Settings. Once again select the Project tab.

Click on the “add remote” button and add the ssh url for your project. Confirm that the url now appears in the Git remotes list.

Generating SSH Keys

The next step is to generate a SSH keys and adding the public key to your git revision control system account.

Once again, in Node Red, select the hamburger icon and then select the “Settings” menu item. Then, select the “Git config” tab.

Now let’s click on “add key”.

Give your key a friendly name and then click Generate key and a public key will be generated.

Copy the public key and then add it to your git revision control system account. Make sure to keep it secret. Don’t worry about me, I only generated this key as an example :).

Pushing Changes to Your Remote Repository

One area I find lacking in the user interface is the ability to Push or Pull changes from a remote repository. Currently the only available is to manually push or pull from the command line.

Projects are stored in your Node Red configuration directory under the ./project folder.

Open a terminal and navigate to the directory. Issue the following command to link the local git project to the remote repository and upload the project.

git push --set-upstream origin master

This should push all the changes from the local project to the remote repository.

Going forward you can utilize the Node Red user interface to commit changes to the local repository. However when you want to push or pull changes from the remote repository, you will need to use the command line.


This post showed you how to set up a remote repository and push / pull project changes. It would be great if the developers could add this feature directly to the Node Red user interface. If you’re in agreement, let the developers know.

How to Use Android Actionable Notifications for Home Assistant: Listening for Events

Right now selecting an action does nothing. Let’s change that.

If you hadn’t noticed, selecting an action causes the notification to disappear. Behind the scenes, an event transmits to Home Assistant with action information. Listening to the event is the first step in doing something with it.

In Home Assistant, select the “Events” tab from “Developers Tools”. Scroll all the way to the bottom of the page and locate the “Listen to events” pane.

In the “Event to subscribe to” enter “mobile_app_notification_action” to listen to events from the Android application. Finally, click “Start Listening”. Send the example notification to your phone and select an action to see the corresponding event.

In the example above, the “action” key indicates the selected action.

In my updated “Node Red” example, I added an “events: all” node.

I configured the node as follows:

I have a “debug node” on the output of the “events: all” node, with this I can see the event in the debug panel.

The “payload.event.action” key indicates which action was. In my next post, we’ll take it to the next level and start controlling things around the house.

How to Use Android Actionable Notifications for Home Assistant: Getting Started

Sample Notification

I’m always looking for ways to make my Smart Home experience more interactive. I recently came across “Actionable Notifications“. In this post, I will show you how to use them to interact with “Home Assistant” from your Android devices.

Android Actionable Notifications

An actionable notification is an interactive “Push Notification”. For instance, Using Home Assistant, you can create custom notifications with “buttons” that can be selected on you smart device to interact with your home.

Now, I found very little information on how to set up actionable notifications for Android devices and I’m hoping the information helps you out.

Make sure that you’ve installed the Home Assistant Companion App from the Google Play Store and and have connected it to Home Assistant.

Using Home Assistant

In the Home Assistant web interface, select the “Services” tab under “Developer Tools”. Enter “notify.mobile_app_” and select the service corresponding to your android device. In the image below, the device name is “sm_g973u”.

Paste the “yaml” snippet below into the “Service Data” field, and then click on the “Call Service Button”.

message: This is a test message
  - action: action_1
    title: Action 1
  - action: action_2
    title: Action 2
  - action: action_3
    title: Action 3

If everything went well, the notification should appear on your device. If you don’t see the actions, try expanding the notification.

Using Node Red

We’ll start by setting up the following sequence in Node Red using a “Call Service” node.

Next, configure the “Call Service” node.

The most important configurations are the “Domain”, “Service” and data field.

Populate the “Data” field as follows:

    "message": "This is a test message",
    "data": {
        "actions": [
                "action": "action_1",
                "title": "Action 1"
                "action": "action_2",
                "title": "Action 2"
                "action": "action_3",
                "title": "Action 3"

This is the same information as before, but now formatted in JSON.

Deploy and trigger the sequence to trigger an “Actionable Notification”.

Next Up

Leave a comment and let me know what you think. Part 2 of this series will show you how to something happen once an action is selected.