CityScripts: a social tool for SmartSantander experimenters
CityScripts: a social tool for SmartSantander experimenters
The CityScripts prototype is aimed at experimenting with sensors and actuators in the city of Santander composing mash-ups integrating sensor data with social networks and other online data sources.
An important aspect of this project is the provision of a personal workspace in which each user can compose public data from city sensors with personal data from his/her own personal devices and services including social profiles bringing a social dimension in the IoT paradigm.
Let us to make a brief overview of the Cityscripts workspace and describe the steps to create a simple example using the data delivered by the real sensors placed in the Santander city.
The CityScripts Workspace
Main workspace sections are:
1 - Friends: a list of friends (at the moment limited to our twitter followings). Selecting a friend, it is possible to discover his/her shared things/services.
2- Sensors/Actuators palette: it shows the available Sensors/Actuators (things and services) that can be registered in the user workspace. In particular, two sensor categories have been realized ad-hoc for SmartSantander:
Geographic Selection: enables the creation of a collection of sensors in a given region
Abstract Region: enables the selection of sensors in a region and computes a single value for the whole region (i.e. the average temperature in a city).
3 - Added/Bookmarked Sensors: a list of added (using the palette) or bookmarked (from a friend profile page) Sensors in the workspace. They represent ready-to-use things. Each Sensor can be then connected to an Actuator in the workspace.
4 - Added/Bookmarked Actuators: a list of added (using the palette) or bookmarked (from a friend profile page) Actuators in the workspace. They represent ready-to-use things. Each Actuator can be then used in building a connection with a Sensor in the workspace.
5 - Connections list. A connection always involves a Sensor as data source and an Actuator as the data recipient. A connection can be configured and customized by filters and mappings.
We are going to implement the following scenariol: a restaurant manager publishes the number of free parks close to her restaurant on its Facebook page.
To do that, we need: an Abstract Region sensor instance that resume the data of sensors placed close to Calle Hernan Cortes in Santander , a Facebook Actuator for posting on free parks on Facebook page, and a connection.
Step One: adding an Abstract Region Sensor
We are going to to create an Abstract Region Sensor able to get the number of free park provided by the sensors placed in the area of Calle Hernan Cortes in Santander.
1. Select the Abstract Region Sensor icon on the palette.
2. Let us name this sensor as “ParkCalleCortes”. Click on the “Abstract Region” sensor icon and fill the form using “ParkCalleCortes” as name, selecting the “Park slot availability for “sensor type”, check “Free” for the operations, drag the area you like to monitor on the map. Finally, choose the kind of policy you prefer.
3. “ParkCalleCortes” has been added to your workspace and it starts soon to collect data. As you can see, the list item reports the name of the thing, it's description, the owner and the selected policy.
4. If you click in the added Sensor name, under the Sensor list in the workspace, you will able to browse the particular thing details page. The data table on the bottom side of the thing page contains the current last 50 collected data items.
Step Two: adding a Facebook Actuator
Creating a Facebook Actuator, each time it received a data value, it is published on user’s wall.
1. Click over the Facebook icon in the Actuators section of the palette. You will be redirected to the Facebook authorization web site.
2. If you are not logged in at the present time, it will request to do it.
3. On the that Facebook pages related on Cityscripts app, you should authorize the app to post on your wall.
4. When the authorization process finishes, you are redirected to the Paraimpu workspace.
Step Three: creating and configuring their Connection
It is the time to connect the Abstract Region Sensor to the Facebook Actuator and configure it in order to post a message under the following condition: publish the number of free parks when it is greater then 1.
1. Place the mouse over the “ParkCalleCortes " in the Sensors list and click on the icon. The dialog with the list of all available Actuators opens.
2. Select the Facebook Actuator and press the "Connect" button. The requested connection is created and you can find it under the Connection list in the workspace.
3. Now we are going to configure the created connection: put the mouse over the created connection and click the "Configure" button.
4. The Connection details page shows some info about the particular connection:
5. Set the filter in order to evaluate only the values you like. In our case is:
6. Add a new mapping by clicking on the "Add mapping" button. The data value coming from the Sensor is represented in an expression by its name “ParkCalleCortes ” (like a variable).
7. On the leftmost text box, write the following mapping condition:
ParkCalleCortes.operations.free > 1
8. On the other text box on the right, write the following message:
Now <%ParkCalleCortes.operations.free%> park slots are available.
10. Now the last step: activate the connection. You can do in 2 ways.
- by clicking on the connection details page
- on the workspace page, move the cursor on the related connection box and click on the activate icon
In this post we described the actions to create a Sensor, an “social” Actuator like Facebook is and their Connection in the CityScripts workspace in order to satisfy the simple scenario. On the Facebook timeline, the messages appears like next image.
With few changes it can be applied on other situations that could use temperature or sound sensors and post tweet.