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
- Under AnythingDB > Models, choose to add a New Model.
- Complete the information for the Properties, Actions and Events as defined below (or disable them if the Thing doesn’t have any).
-
Name the first Model TrafficLight and click
Create
- In the panel on the right that appears, enter Thing Title as Traffic Light.
- Click the plus sign next to Properties and create a Property named State with type String.
-
Create a second Property named Geo Location and
choose type object. Click
Create.
A + symbol appears next to the property name.
-
Click on the + symbol to add Latitude and Longitude as attributes with
type number.
Figure 1. - Create a third Property named Power Consumption with type number.
- Add an Action called Turn On/Off and choose Input Type Object.
- Add an Event called Burn Out and choose Event Data Type Object.
- Click Save.
-
Name the second Model TrafficSoundSensor and click
Create.
- In the panel on the right that appears, enter Thing Title as Traffic Sound Sensor.
-
Click the plus sign next to Properties and create a Property named
State with type
String.
-
Create a second Property named Geo Location and
choose type object. Clicking
Create.
A + symbol appears next to the property name.
- Click on the + symbol to add Latitude and Longitude as attributes with type number.
- Add an Action called Turn On/Off and choose Input Type Object.
- Click Save.
-
Name the third Model ParkingSensor and click
Create.
- In the panel on the right that appears, enter Thing Title as Parking Sensor.
- Click the plus sign next to Properties and create a Property named Presence with type Boolean.
- 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.