Display push notifications on your phone

By | March 9, 2020

This article shows how you can easily receive push notifications from your smartphone using the HoneyPi Android app and ThingSpeak. You can configure which ThingSpeak channels and fields you want to receive notifications for and under what conditions. This allows you to react quickly when you receive a notification that the hive’s weight is higher or lower than certain values, for example.

Note: To receive push notifications with the HoneyPi Android app, you need at least App version 1.1.

Set up push notifications

To get push notifications on your phone, the following steps are necessary:

Step 1: Log in with your ThingSpeak account: https://thingspeak.com/login

Step 2: Click Apps > ThingHTTP > New ThingHTTP. The following fields should be configured:

Neuen “ThingHTTP” erstellen
  • Name: Enter any name
  • URL: https://honey-pi.de/backend/push.php
  • Method: POST
  • Content Type: application/x-www-form-urlencoded
  • Body: The request body, which must consist of the following three parts. The three parameter parts are linked with &-characters, as is usual for URLs:
    1. channel: Channel ID for which the notification is to be sent. The variable %channel_id% can also be used here, which automatically inserts the ID of the channel for which this ThingHTTP entry is used. For more information about the variables, see here.
    2. title: Title of your push notification on the smartphone. If only “title=” is specified, i.e. an empty title, then “HoneyPi” is used as the title.
    3. body: Text of your push notification on the smartphone, e.g. “channel=%%channel_id%%&title=Temperature low &body=In the hive with channel-ID %%channel_id%% it is too cold with %%trigger%% degrees celsius. Time stamp: %%datetime%%”.
      • Here variables were used again. For example, the triggering measured value (%%trigger%%), the channel ID (%%channel_id%%) or the time (%%datetime%%) can be given dynamically.

Finally save the ThingHTTP entry via the “Save ThingHTTP” button.

Step 3: Click Apps > React > New React. The following fields should be configured:

  • React Name: Enter any name
  • Condition Type: Numeric
  • Test Frequency: Check the measured values while writing or every 10, 30 or 60 minutes. It is better to select every 10, 30 or 60 minutes, as the push notifications also appear every minute on the smartphone at a measurement interval of one minute, for example.
  • Condition:
    • If channel: Select the desired channel for whose field the notification is to be sent.
    • field: Select the ThingSpeak field for which the notification should be sent.
    • Selection of the condition, e.g. is less than or equal to
    • Measured value from which the condition is to take effect
  • Action: Select ThingHTTP
    • then perform ThingHTTP: Selecting ThingHTTP created in step 2
  • Options: As a rule, “Run action each time condition is met” can be selected here if the notification is to be sent every time the measured value corresponds to the condition.

Finally save the React with the “Save React” button.

Neuen “React” erstellen

Step 4: Enable notifications in the HoneyPi-Android app: Simply click on the Notifications icon and on the next page enable/disable the channels for which you want to receive notifications.

Benachrichtigungen öffnen
Benachrichtigungen öffnen
Benachrichtigungen konfigurieren
Benachrichtigungen konfigurieren

If everything is configured correctly, the push notifications on your phone should look like the picture below:

Benachrichtigung auf dem Smartphone
Benachrichtigung auf dem Smartphone

Reuse ThingHTTP

As described above you have to create a ThingHTTP and a React on your smartphone to get a notification. You have to create a React for each desired notification (= ThingSpeak-Field), because it has to be selected there.

But you can reuse a ThingHTTP for as many fields as you like, because the same ThingHTTP can be selected in as many reactions as you like. For example, you can create a ThingHTTP for too low a temperature and a ThingHTTP for too high a temperature. These two ThingHTTPs can now be used in several channels for temperature monitoring.

Translated 19.10.2019 by JK

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *