YWireless Mobile Guide

Control your garage door from your mobile device with Renesas YWireless and Medium One

In this tutorial, you’ll find out how to operate your garage door from your mobile device using the YWireless RX111 board and Medium One’s IOT Controller mobile app.

These instructions will assume you have a MediumOne Sandbox account and a RX111 Cloud Connectivity kit (available here!), and have followed our video instructions or text instructions to set up your RX111 board and smart-garage-door.cfg file.

Follow along with our video guide, or scroll down to find text instructions. The text instructions also contain an additional section that explains how to modify the Diagnostics workflow to allow you to trigger a diagnostic report email from your mobile.

Step 1. Find your API key and Password

Plug your YWireless RX111 into your computer, navigate to it in your file directory, and open your smart-garage-door.cfg file.

From your configuration file, you will need the line beginning with “pw-hash”. This line contains your project API key and user password. It should look something like this:

pw-hash: ZZN4SO5UE2RW6IUQCNPPU5BQGM4DQZDFMNTDQ0000000DAJXU/Tx234st

Your project API key is the first part, before the slash, e.g. ZZN4SO5UE2RW6IUQCNPPU5BQGM4DQZDFMNTDQ0000000DAJXU

Your user password is the second part, after the slash, e.g. Tx234st

Email this API key and password to your mobile phone so you can copy and paste in the next step.

Step 2: Create Mobile App profile

Download Medium One’s IOT Controller app from the App Store or Google Play. Open IOT Controller, and click on new to edit the blank profile.

IOTblankprofile

Change new to YWirelessGarage (or any other name that you like), and enter your project/user info as follows:

API key: enter your project API key from above (e.g.

ZZN4SO5….000DAJXU)

API login : enter “smartmeter” (the username for the basic user that comes with the GarageDoorDemo workflow)

API password: enter your user password from above, e.g. Tx234st

json key: enter “garage_door”

json value: enter “close”

When you are finished, it should look like this:

GarageDoorwithEvent_small

Hit Save to save this profile, and then hit Send to send the event to Medium One. You should see “1” under Response if it was sent successfully.

Step 3. Create New Workflow

Log into your Medium One Sandbox account. Since garage_door is a new tag, we need to activate it so we can use it in our new workflow.

ConfigDataStreamsFrom Sandbox, go to Config > Data Streams , and click on Edit under Raw events.

 

 

Find the garage_door event, and click on the checkbox to activate.

ActivateTag_small

Now let’s set up the workflow. Go to Workflow Studio and click on Create. Open Tags & Triggers in the sidebar and select the garage_door tag. Click and drag garage_door to the canvas.

GarageDoorWorkflowRaw

Now open Modules from the sidebar and select the Base Python module. Click and drag to the canvas.

GarageDoorWorkflowPython

Click and drag to connect the input / output nodes between the two modules.
Now we need to edit the code in the Base Python module. Double-click on the Base Python module to open. Copy the 3 lines of code below, preserving the spaces, and paste into the Script box (replace the existing code).

import MQTT
if IONode.get_input("in1")["event_data"]["value"] == "close":
    MQTT.publish_event_to_client("rx111", '{"garage_event": "close"}')

When you are done, it should look like this:

BasePythonCode

Now, open the Revisions menu in the sidebar and click on the check icon on the revision at the top.

ActivateRevision

Your workflow is now activated!

Step 4. Give it a try! Send Garage Door Close event

Now you are ready to send the event from your mobile. Click on the SW2 switch on your RX111 to simulate opening the garage door (will turn on SW3 LED light). Go to IOT Controller app and send the same garage_door event again. The script will publish the garage_door:close event to the RX111, and you should see the SW3 light turn off.

Finished!

That’s how easy it is to control your garage door from your phone with Medium One!

Optional: Send Diagnostics

We can easily modify the existing Diagnostics workflow to trigger the diagnostics report email from mobile.

Go back to the IOT Controller mobile app and click on the “+” button on the top right to add a new profile.

Open the new profile, and edit as follows:
DiagnosticsProfile

API key: same as for Garage profile

API login: same as for Garage profile

API password: same as for Garage profile

json key: from_phone

json value: get_diagnostics

Hit Save to save this profile, then hit Send to send the event to Medium One.

 

 

 

 

Now we’ll activate the tag in Sandbox just as before. In Sandbox go to Config > Data Stream, find from_phone in Edit under Raw Events , and click the checkbox to activate the tag.

Now go to your Diagnostics workflow. Open the Tags & Triggers menu, and select from_phone. Click and drag onto the canvas. Open the Base Python module, and click on Add New Input. There are already 7 input nodes here, so this step adds an 8th input node, called “in8” by default.

Click and drag to connect the from_phone output node to in8 on the Base Python module.

The from_phone tag is set as a trigger for this workflow automatically, so we are all set!

Hit Send again in IOT Controller to send the from_phone : get_diagnostics event again, and you’ll receive an email in your inbox with the Diagnostics Report.

DiagnosticsEmail

Comments are closed, but trackbacks and pingbacks are open.