HomeTaskerIntegrating NodeRED and Tasker

Integrating NodeRED and Tasker

Make Home Automation great again!

NodeRED is easy and powerful. Currently, I’m running the NodeRED server on my RaspberryPi Zero connected to the router directly. It handles my light setup, but what I have been missing for a while is a way to make the NodeRED talk to Tasker. Finally, I found a great way how to integrate NodeRED and Tasker. If you have a Raspberry Pi you can start your NodeRED server in moments. It’s a fantastic and versatile tool with great support.

NodeRED and Tasker integration

This is not a NodeRED tutorial so I would expect you to have minimal knowledge of it. It’s very easy to start with and I was shocked how long I have ignored NodeRED in my automating efforts.

The write-up is still useful, however, there is an even better way of interacting with Tasker and NodeRED using Join Node and Join app – please see a detailed tutorial.

I shared recently a setup where I would text my work friend Helen, who sits near AC control unit, each time the temperature near my desk drops below 20°C. I’m not a horrible person, I sit directly underneath the AC unit. The profile would then continue to annoy Helen every minute until the temperature is over 20°C again.
The whole process was automated in NodeRED and Tasker sent an SMS message only when prompted. Temperature readouts were submitted by an ESP32 with DHT11 temp sensor hooked up to it.
Here is how to make your mobile (and Tasker) work with NodeRED.

NodeRED to Tasker

You can send an AutoRemote message to your mobile from a web browser via a link. This link is a web request that contains a message and usually looks like this:

https://autoremotejoaomgcd.appspot.com/sendmessage?key=YOUR_KEY&message=THIS%20IS%20THE%20MESSAGE

Note that spaces in between the messages are encoded with %20. This means we can send the message to Tasker simply by a web request. Fortunately, NodeRED comes with a node HTTP REQUEST – we and use HTTP POST to pass the message and the argument. The argument (also called payload) is encased in {{{….}}} and placed at the end of the URL.

https://autoremotejoaomgcd.appspot.com/sendmessage?key=YOUR_KEY&message={{{payload}}}
HTTP REQUEST output node

In the example, I’m using an input node to insert a msg.payload with a click of a button, but you can link this with any other node that passes the message as payload.

Tasker to NodeRED

While we can’t simply reverse the process, but can use the HTTP POST action in Tasker to return the message. Local IP (or a DNS) specified with a default port 1880 is our server configuration. The POST request should contain a topic – which is a path (/test) where the request will be sent to. The attributes are formatted in a similar fashion to a JSON file where we pass a set of keys=values.

HTTP POST Tasker action

The HTTP REQUEST input node has to have the same topic specified in the node config menu. In addition to this, an HTTP RESPONSE node needs to be linked preventing our Tasker HTTP POST action from timing out. It will notify Tasker that our message has been successfully received.

HTTP REQUEST input node

Conclusion

As you can see the message flow is nearly instant, which allows the setup to be used for switches. NodeRED and Tasker will become my interface of choice when trying to get a Raspberry Pi to have a conversation with the Android device.

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

New to Tasker?

Tasker Quick Start – Getting started with Tasker

0
From newb to not so newbie in 10 min

Best Tasker Projects

How to use Raspberry PI as WOL (wake on lan) server

0
While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

7 awesome Bluetooth keyboard shortcuts for Android

0
7 unique Android shortcuts that you can add to any Bluetooth keyboard.

Smart overnight charging with Tasker

0
Still keeping your phone plugged in overnight? Try smarter overnight charging with this profile

One thing that Join app can’t do and how to fix it with Tasker

0
It's not possible to share the clipboard automatically between join accounts registered to 2 different emails. But you can fix this with tasker.

Charge Test – Tasker charger performance tool

0
Turning Tasker into productive tool for monitoring chargers

Essential Guides

Tasker: Seconds into DD:HH:MM:SS (dynamic)

0
It's time to.... ok it's a pun, but I will show you how to master time and convert seconds to DD:HH:MM:SS dynamically

4 ways to organise Tasker projects

0
Keep your Tasker tidy!

A better way to store Tasker credentials

0
The more clever way of managing credentials

Annoyed with dozens of AutoApps populating your app drawer? Here is a fix!

0
Clear your app drawer from the clutter in seconds

Putting AutoTools pie chart to a good use – SSID logger

0
Who wants a piece of the pie (chart)?