This flow sends MQTT notifications to and from a device according to a configurable time.
This flow allows you to define a “wake up” time. When the time you configured is reached, it
broadcasts an alert to a device and enables receiving messages from that device.
- mqtt out
- mqtt in
Create a CloudMQTT instance account (MQTT broker) using the following URL:http://www.cloudmqtt.com/plans.html
Download the MQTT client application from the Play store: MQTT client (MyMQTT).
Configure the MyMQTT client application with the relevant instance account details that you created in CloudMQTT above.
Configure the MQTT node in the Flow Studio with the relevant instance account details as a not-hosted server.
- inject node – Sets the time that the ‘TimeToWakeUp’ message is to be broadcast.
- function node – Saves the ‘TimeToWakeUp’ parameter as a global variable.
- function node – Ascertains that the ‘TimeToWakeUp’ has been reached (by confirming that ‘CurrentTime’ = ‘TimeToWakeUp’ ).
- switch node – When ‘TimeToWakeUp’ has been reached a message is sent to the device; until the ‘TimeToWakeUp’ has been reached, notification is sent to the debug node.
- mqtt out node – Configures the MQTT client that triggers the MQTT broker to send the ‘TimeToWakeUp’ message.
- mqtt in node – Configures the MQTT client that connects to the MQTT broker to enable it to receive any message from the device.
- debug node – Displays the msg.payload output.
This flow uses the following links:
MQTT broker: http://www.cloudmqtt.com/plans.html
MyMQTT device client: https://play.google.com/store/apps/details?id=at.tripwire.mqtt.client