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.
No hardware is required to complete this guide.
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.
In your browser, navigate to the Murano Solutions tab.
To add a Product, click "NEW SOLUTION" and select "Add a Product".
In the New Solution popup:
Enter a name for the Product in the Product Name field.
Select Smart Lightbulb Example from the Choose Product starting point drop-down menu.
Once the Product has been created, navigate to the Product area by clicking on the Product that was just created.
Ensure the Product Resources are defined properly and take note of your ProductID (highlighted in the endpoint) for later use.
If you see no resources listed here, add a new dataport 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 grabbed from the Murano Product view in the steps above into the terminal and 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 Exosite. 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 Device view 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.