Define the Models

As you are going to have multiple Things defined with the same schema, the first step will be to define a Model inside AnythingDB for each of the devices. Models are templates to store a default Thing schema to ease the process of adding new Things quickly.

The three following Models need to be created:
  • Traffic Light
  • Traffic Sound Sensor
  • Parking Sensor
  1. Under AnythingDB > Models, choose to add a New Model.
  2. Complete the information for the Properties, Actions and Events as defined below (or disable them if the Thing doesn’t have any).
  3. Name the first Model TrafficLight and click Create
    1. In the panel on the right that appears, enter Thing Title as Traffic Light.
    2. Click the plus sign next to Properties and create a Property named State with type String.
    3. Create a second Property named Geo_Location and choose type object. Click Create.
      A + symbol appears next to the property name.
    4. Click on the + symbol to add Latitude and Longitude as attributes with type number.
      Figure 1.


    5. Create a third Property named Power Consumption with type number.
    6. Add an Action called TurnOnOff and choose Input Type Object.
    7. Add an Event called BurnOut and choose Event Data Type Object.
    8. Click Save.
  4. Name the second Model TrafficSoundSensor and click Create.
    1. In the panel on the right that appears, enter Thing Title as Traffic Sound Sensor.
    2. Click the plus sign next to Properties and create a Property named State with type String.
    3. Create a second Property named Geo_Location and choose type object. Clicking Create.
      A + symbol appears next to the property name.
    4. Click on the + symbol to add Latitude and Longitude as attributes with type number.
    5. Add an Action called TurnOnOff and choose Input Type Object.
    6. Click Save.
  5. Name the third Model ParkingSensor and click Create.
    1. In the panel on the right that appears, enter Thing Title as Parking Sensor.
    2. Click the plus sign next to Properties and create a Property named Presence with type Boolean.
    3. Click Save.
    Note: Multiple versions of a Model can be implemented, to enable you to easily update schemas while defining your project. You can include a version title and version description to keep track of the changes.