In this quickstart, you will use a Python script to simulate a connected lightbulb. You will then use the UI to experience the ability to remotely turn the lightbulb on and off.
To complete this guide, you must first download and install Python 2.7.9 or greater from the Python website.
Create a Product in Murano
In this section, you will create and configure a new Product in Murano through the Exchange.
In your browser, navigate to the Murano SOLUTIONS tab.
Navigate to the Murano EXCHANGE:
Find the Connected Lightbulb Quickstart.
Click Add Product in the upper right-hand portion of the browser.
Click Create Product.
Give the product a name and click ADD.
Once the Product has been created, navigate to the Product area by clicking the Product that was just created.
Ensure the Product Resources are defined properly and copy the Product ID to your clipboard for later use by clicking the ID button located near the top left of the screen.
If you see no resources listed here, add a new resource for each as specified below (units are optional). Only the state resource needs to have the checkbox selected that will allow it to be modified from the cloud.
Note: Optionally, you can restrict these resources to specific Possible Values.
* Alias: temperature, Data format: Number * Alias: humidity, Data format: Number * Alias: uptime, Data format: Number * Alias: state, Data format: Number
Run the Python Device Simulator
In this section, you will use the Python device simulator to activate the new device you created and start simulating data.
Open your OS terminal and clone the Python simulator repo by entering the commands below into the terminal window. Press Enter.
git clone https://github.com/exosite/murano_python_device_simulator_example.git -b 2.0
Run the device simulator by entering the command below into the terminal window. Press Enter.
If successful, the script will ask you to enter your Product ID.
Paste the Product ID you copied from the Murano Product view in the steps above into the terminal. Press Enter.
Press Enter again to use the default device identity (000001). This matches the identity format for devices that you configured earlier, so it will activate correctly.
NOTE: If you have already added 000001 and simulated the device before, you may need to enter a new device (e.g., 000002). This will create and activate a new device and simulate data for it.
If the Python Simulator is running correctly, the script should show the device has been activated and whether the lightbulb is on or off.
Back in the Murano UI, make sure the device has been created and shows a green checkmark denoting it has been activated. This can be verified from the Devices tab.
Click on the device to see its Resources and ensure data is showing up on the platform.
You now have a simulated device pumping data into Murano. Keep the simulator running throughout the remainder of this guide.
Create a Dashboard in Murano
In this section, you will create a dashboard to view the data from the connected lightbulb and turn it on and off remotely.
From the Devices tab for the desired device, click the ACTIONS button and select "View dashboard".
Click + ADD PANE to house the widgets you will create.
In the pane that appears, click the plus sign "+" to add a widget.
In the widget popup that appears, select "Toggle Switch" from the TYPE drop-down menu and complete the remaining fields (TITLE: "Off / On"; VALUE: "resources["state"]"; ON VALUE: "On"; OFF VALUE: "Off"). Click SAVE.
Turn the light on and off for the simulated device using the toggle switch on your dashboard.
Switch to the terminal (while the simulator is running), and you will see the simulator indicates that it has received the state changes.
Congratulations, you just remotely turned a simulated device sensor on and off!