“Dinner time!!” button using Amazon Dash

Hey all! It's dinner time!

The AmazonDash buttons have a very niche use. I have 10 of them at home, and I’m yet to order anything from Amazon using buttons. All caused by how easy is to link the buttons to NodeRED and use it for anything you want. After reading some questions, I decided to revisit the Doorbell project and put a little spin on it. I’m going to create “Dinner time!!” button using Amazon Dash.

Whether you want a WiFi Doorbell or a “Dinner is ready” button in the kitchen, the working principle remains the same. Once the button is pressed, a notification is issued to a device (or devices). You will know that someone is at the door, or that the dinner is ready and you should stop whatever fun thing you have been working on and head back to have some food.

I’m going to use Join app, and Join Node to deliver notifications to the Android devices (sorry Apple fans, but sucks to be you this time!). If you don’t have the Join app – it’s awesome! Be sure to check how to add AmazonDash to NodeRED before you continue.

To get the Join Node ready – follow this setup guide!

NodeRED setup

If you just want a barebone notification – all you need to do is to connect the Amazon Dash and limiter node to the fully configured Join Node. I said I will put a little twist on it. I want the button to announce the correct meal times. So the notifications will be as follows:

  • 7 am – 11 pm: breakfast time
  • 12 – 4 pm: lunch time
  • 5 pm 10 pm:  dinner time

Obviously, feel free to change these times or the number of meals. You should be able to do it on your own once you complete this tutorial.

To get the formatted time in NodeRED, we need to convert the UNIX time in seconds into something easy to recognise. Turns out, there is a node for that! Install the node moment:

cd ~/.node-red
sudo npm install node-red-contrib-moment

And we will have all the tools we need for this tutorial. Thanks to this node I will be able to receive the time (hours) which I’m going to use to select the correct message and icon formatting.

To get the access to hours, I have to set the moment node to deliver object output. I’m going to save it as msg.time.

Based on this property (msg.time.hour) switch node will direct the outcome to one of the three possible outputs. Each output has a change node setting the msg.meal and msg.url as follows

  1. 7-12 Breakfast (msg.meal = breakfast| msg.url = url_to_breakfasticon)
  2. 12-17 Lunch (msg.meal = Lunch | msg.url = url_to_lunchicon)
  3. 17-22 Dinner (msg.meal = Dinner| msg.url = url_to_dinnericon)

Then, a function node will put that information together and send it using a Join node to selected devices. If you want to send the Join to devices that do not belong to your account, you will need to send the deviceId instead of the names.

var url = msg.url;
msg.title = "Kitchen Alert!"
msg.text = "Time for a " + msg.meal;
msg.devices = "Pixel,Desktop";
msg.icon = url;
return msg;

Additionally, you can add a Google Notify node to announce the call for the meal over the Google Home. To do this, just pass the msg.text as a payload(see the video):

var x = msg.text;
msg.payload = x;
return msg;

And send over it to your Google Home. You can learn more about NodeRED and Google Home Notifications here.

If you have Join added as your Chrome browser, you will be able to receive the messages on computers too.

Conclusion

As you can see, the same setup can be used for any scenario where you want a button to issue a notification  to an Android device. This includes doorbells , panic alarms and more. Additionally, you could check if the device is present on the local network before sending out the request, as the messages would reach devices that are not currently home. There is very little sense in calling someone for a dinner if they are miles away right?

Support NotEnoughTech
A lot of time and effort goes into keeping NotEnoughTech alive! If my work helped you out, consider buying me a coffee or check out exclusive rewards available to Patreon supporters.
SHARE