Lightbulb Quickstart

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.

Requirements

Hardware Setup

We'll use the Python Simulator in this guide. If you want to try out your own hardware, check out the Supported Hardware support article, or go through our ESP8266 Tutorial.

Software Setup

To complete this guide, you must first download and install Python 2.7.9 or greater from the Python website.

Getting Started

Create a Product in Murano

In this section, you will create and configure a new Product in Murano through the Exchange.

  1. In your browser, navigate to the Murano Solutions tab.

  2. Navigate to the Murano Exhange tab: image alt text

    1. Find the "Connected Lightbulb Quickstart".

      image alt text

    2. Click on "Add Product" in the upper right-hand portion of the browser.

    3. Click on "Create Product".

    4. Give the product a name and click "ADD".

      image alt text

  3. Once the Product has been created, navigate to the Product area by clicking on the Product that was just created.

    image alt text

  4. Ensure the Product Resources are defined properly and take note of your ProductID (highlighted in the endpoint) for later use.

    image alt text

    • 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

image alt text

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.

  1. 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
    
    cd murano_python_device_simulator_example
    
  2. Run the device simulator by entering the command below into the terminal window. Press Enter.

    python murano_device_simulator.py
    

    If successful, the script will ask you to enter your Product ID.

    image alt text

  3. Paste the Product ID you grabbed from the Murano Product view in the steps above into the terminal and press Enter.

    image alt text

  4. 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.

    image alt text

  5. 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.

    image alt text

  6. Click on the device to see its Resources and ensure data is showing up on the platform.

    image alt text

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.

  1. From the Device view for the desired device, click the ACTIONS button and select "View dashboard".

    image alt text

  2. Click "ADD PANE" to house the widgets you will create.

    image alt text

  3. In the pane that appears, click the plus sign "+" to add a widget.

    image alt text

  4. 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".

    image alt text

  5. Turn the light on and off for the simulated device using the toggle switch on your dashboard.

    image alt text

  6. Switch to the terminal (while the simulator is running), and you will see the simulator indicates that it has received the state changes.

    image alt text

Congratulations—you just remotely turned a simulated device sensor on and off.

UP NEXT: CREATE AN APPLICATION >>