FiWare

FIWARE In Mexico: A Reality

 Developers, events, FIWARE Mundus  Comments Off on FIWARE In Mexico: A Reality
Oct 172017
 
The FIWARE Community is getting more and more global everyday, but it is worth mentioning that Mexico is a pioneering region in the expansion of the initiative. Jose Gonzalez, from FIWARE Mundus, has recently visited the country to cooperate with FIWARE Mexico and SmartSDK in the reinforcement of FIWARE as a reference platform in the Mexican ecosystem.
  • Within the scope of the Research and Education Working Group coordinated by CUDI in the project FIWARE Mexico, a workshop was organized in the City of Guadalajara as part of the ANUIES-TIC event. This one-day activity helped to introduce FIWARE to several CIOs from Mexican universities and research centres, highlighting the benefits the open platform brings to experimentation, education and entrepreneurship. The workshop was complemented with a practical session on the use of the Orion Context Broker.
  • As part of the 2nd International Conference on Smart Data and Smart Cities hosted in the City of Puebla, Tecnologico de Monterrey organized a workshop aimed at developers, integrators and hardware and software vendors interested in generating innovative solutions using FIWARE. Upon completion of the training, participants were able to understand the potential of the FIWARE platform and gain theoretical and practical skills to develop cloud computing and Internet applications.
FIWARE Mexico addresses the challenge of enhancing FIWARE-driven collaboration between Europe and Mexico, based on the adoption, deployment and improvement of FIWARE in Mexico. This will be used as a framework to open up new horizons for future cooperation in the ICT domain. The process will cultivate the conditions to support the FIWARE activities in Mexico, help it to go beyond the FIWARE Lab, and generate an effective bootstrap of a cohesive and growing innovation FIWARE-driven ecosystem.
 
SmartSDK is a FIWARE initiative that provides ready-to-use bundles for the creation of Smart Services. All components adopted are based on FIWARE and add-ons are contributed to the FIWARE Community as Open Source. SmartSDK provides a set of reusable and cloud-native architecture patterns to simplify the development of Smart Services.
 
Guest post by Jose Gonzalez (Interinnov / FIWARE Mundus)
 
 

Introducing The First FIWARE Tech Summit Speakers!

 Developers, events, FIWARE Foundation, SmartAgri, SmartCities, Uncategorized  Comments Off on Introducing The First FIWARE Tech Summit Speakers!
Oct 132017
 

Our upcoming FIWARE Tech Summit is set to take place on the 28th and the 29th of November in Málaga, Spain, and believe us when we say, this is one event this year you won’t want to miss!

The event is for YOU and about YOU, and we look forward to welcoming the most talented developers and up-and-coming startups (Yes, you included!) to showcase their products and to learn how to implement FIWARE Technology!

But wait, there’s more! We’re currently getting a hold of some of the coolest speakers out there. We’re talking Peter Hopwood, our fantastic Master of Ceremony, and Johann Romefort, a Munich-based Tech Evangelist, who will also be a judge at our exciting startup competition for a fast track to be a part of the IMPACT Growth Accelerator!

BUT WAIT, there’s STILL more! Corporate stars, such as Christian Lindener, the CEO of Telefónica’s accelerator Wayra Germany, will be leading the corporate panel on why huge corporates are interested in doing business with start-ups. Bottom line: There's lots to look forward to!

Told you, you won’t want to miss this! Get your tickets NOW!

Reimagining the City as Platform: How VM9 Are Reimagining What Cities Can Do

 Blog, Developers, IoT, myFIWAREstory, SmartCities, Success Story  Comments Off on Reimagining the City as Platform: How VM9 Are Reimagining What Cities Can Do
Jul 282016
 
logo

FIWARE is helping power a major new city initiative that is helping one Brazilian city embark on an ambitious city-as-platform approach. The Brazilian startup VM9 is creating a smart cities platform that has already been adopted by the Brazilian city of Nova Friburgo, in Rio de Janeiro.

VM9 are currently working with Nova Friburgo to establish a digital interface for citizens to connect with the local municipality and to carry out tasks like checking and providing feedback on planning legislation, creating their own maps, or making a public service request.

Citizen Portal: Meio Ambiente Digital

“The Municipal Secretary of Environment and Sustainable Urban Development (“Secretaria do Meio Ambiente”) is the organ of municipal government in Nova Friburgo responsible for a great number of activities related to territorial management, including licensing and civil constructions monitoring, supervision of environment preservation areas, and urban planning”, explains Marcos Marconi, Founder and IT coordinator at VM9.

meioambientedigital

The Municipal Secretary of Environment and Sustainable Urban Development uses the VM9 Smart Cities Platform to provide better services to citizens and improve internal productivity through the portal Meio Ambiente Digital.

Marconi says the current project for the digital portal has been divided into two phases. He explains:

The first objectives are: 

  • To construct a robust municipal geospatial database to be publish for citizens and provide internal support for technicians of the Secretary during approval process of licensing and others, and 
  • To simplify and improve the services offered for citizens from digital workflows of public requests and enhance internal management.

The second phase will start in 2017 and will be used to monitor air and water quality, environmental conditions, etc and to publish information to citizens through a variety of communication channels.

Marconi says that as a pilot project, Meio Ambiente Digital is already receiving much interest and praise.

Government and City as a Platform

In 2013, media publisher and tech visionary Tim O’Reilly wrote a key paper on “Government as a Platform”. This seminal text summarised the many global initiatives that demonstrate an emerging new approach to how government services are created and delivered. Instead of citizens being receivers of government services — with their main input being to vote every election cycle — O’Reilly envisions a new approach to government where “Internet technologies will allow us to rebuild the kind of participatory government”. O’Reilly describes the concept of Government as a Platform:

There is a new compact on the horizon: information produced by and on behalf of citizens is the lifeblood of the economy and the nation; government has a responsibility to treat that information as a national asset. Citizens are connected like never before and have the skill sets and passion to solve problems affecting them locally as well as nationally. Government information and services can be provided to citizens where and when they need them. Citizens are empowered to spark the innovation that will result in an improved approach to governance. In this model, government is a convener and an enabler rather than the first mover of civic action.

O’Reilly’s paper has encouraged the then-fledgling civic tech movement to evolve even further, and while we are still at the start of this journey, there are now many tech startups (like VM9) around the world focused on helping government engage with citizens and help citizens co-create government services and participatory mechanisms.

These ideas of government-as-a-platform are also being thought of in terms of the “City as a Platform”. In many ways, cities may be faster at being able to take up the challenge of evolving into platforms. Government institutions can be huge monoliths that must meet the diverse needs of a geographically dispersed population. Cities, on the other hand, are where we live, work, and play every day and are at a much more human scale of participation. We all want a say over the areas we live in, how accessible is our transport and walkability, our access to resources like schools, supermarkets, and childcare, our local air and water quality, our safety, and our free movement and leisure opportunities. 

A recent research report by David Bollier for the Aspen Institute says that implementing the vision of cities as platforms is underway, but, again, still in its initial stage:

Historically, cities have been governed through nineteenth and twentieth-century ideas of civic organization and social norms. Much revolves around representative governance and centrally directed bureaucracies overseen by experts using strict, formal rules of procedure. Conceiving of cities as platforms represents a significant shift in how cities might function. An open platform honours self-organized, bottom-up participation in the style of open source software, for example. It regards rigid and complex rule-sets and non-transparency as irksome impediments.

VM9 as a City Platform Hub

Startups like VM9 are leveraging FIWARE to help cities implement this new platform model.

To make the ambitious project achievable, the VM9 team has divided its scope into 5 interconnected project areas, with each also able to operate as independent services.

VM9Marconi lists these five areas as:

1. Internet of Things (IoT)

This module — called FI-Guardian“is totally based on FIWARE GEs”, says Marconi. “It is being developed in partnership with the Federal University of Uberlândia (UFU) with a grant provided by National Council of Scientific and Technological Development (CNPq) under the Human Resources in Strategic Areas (RHAE) initiative. The FIWARE components are deployed in the FIWARE Lab infrastructure hosted by UFU”.

Marconi shares an early iteration of how the IoT Module makes use of FIWARE to create an IoT module for use by the city and its partners:

FI-GUARDIAN.jpg

2. Web Geographic Information System (WebGIS)  

 

“Here we have a WebGIS module which manages a GeoSpatial Database to deliver interfaces to citizens as interactive maps, geospatial searches, and geoinformation publishing”, Marconi explains. In this way it can be used completely independently, but Marconi also says as part of the platform it is integrated with the business process management project to “create a powerful Territorial Intelligence System which helps analysts and technicians to conclude analyses about processes related to urban planning and city growth".

3. Business Process Management (BPM)

This is at the core of the first phase of Meio Ambiente Digital and is an excellent real world example of what city-as-a-platform can mean in practice. “It lets citizens make administrative requirements for the government, monitor the progress of processes, printing payslips, make online payments, and fulfil desired requirements. This could include building approvals, obtaining environmental licenses, any procedures that need administrative interaction between governments and citizens. It is based on an smart motor of logical workflow controls, dynamic and configurable forms, notifications panels, permission rules, and level of authorities. With this module, institutions can become more efficient and, at the same time, deliver comfort and simplicity to citizens and customers”, says Marconi. 

4. Electronic Content Management (ECM)

This delivers an advanced system to create interrelationship between contents (photos, videos, sites and documents in general) and geographic data, in order to structure rich computerized geographical information databases to be published to citizens or used for technical teams, in order to qualifies digital workflows”.

5. Digital Communication Management (DCM)

This area will connect the IoT module — for example, for measuring air and water quality and environmental conditions — with communication channels that share the information in an accessible format to citizens and business.

In stage one, the focus is on the WebGIS (project 2), automated workflows for citizen engagement with planning and service requests (project 3) and content management that supports these areas (project 4). 

Marconi says modules 2, 3, and 4 are all now working and available to citizens, having been deployed on April 18th this year.

In early 2017, VM9 will focus on the IoT (project 1) as document communication (project 5).

FIWARE generic enablers, such as the GIS Data Provider GE, are being used to power the current work in stage one to enable citizens to create their own maps through the Meio Ambiente platform. “We also have the strong intention to use Kurento GE in the project related to Digital Communication Management”, says Marconi.

A true smart city platform solution goes beyond efficiency of public service delivery to look at local economic development opportunities, and Marconi is excited about the work that VM9 has planned in this regard:

"Combos IOT is the next challenge for VM9. These will be pre-built packages of hardware and software, integrated with the VM9 Platform and focused on specific needs of the market, such as: environmental monitoring, health, urban mobility, etc. The objective is to simplify and accelerate the IoT adoption for our customers, through the delivery of complete solutions (plug-and-play) for specific IoT vertical markets".

VM9Team

The VM9 team is now racing to complete all module work by March 2017.

FIWARE and NGSIv2: towards harmonized APIs and data models for real-time context data

 Blog, Developers  Comments Off on FIWARE and NGSIv2: towards harmonized APIs and data models for real-time context data
Mar 172016
 
Businessman Checking Data

FIWARE is enabling a new generation of smarter applications which exploit large scale, real-time ‘context information’. Particularly, the NGSI version 2 API is aimed at making developer’s life easier, by providing simpler but powerful RESTful interfaces. Markedly, the combination of NGSI version 2 and harmonized data models enables the creation of portability at the data layer. As a result, a myriad of end-user applications can seamlessly work and interoperate in different scenarios, namely smart cities.

During 2015, GSMA, FIWARE (represented by Telefónica I+D) and Korea Telecom have been working on a project called ‘IoT Big Data Ecosystem’ (IoTBDE). One of the most interesting results of the IoTBDE project is a set of harmonized data models exposed through NGSI version 2. These harmonized data models have been instantiated in different datasets, which encompass actual data coming from different and original sources (cities, public organisms).  

Additionally, the referred datasets have been used by real world showcases, demoed with great success at MWC 2016, The datasets have engaged remarkably well, both with cities (Porto, Santander, Seville, Antwerp) and with accelerated SMEs. In fact, such pilot datasets are a proof of a concept with a view to developing further standardization, particularly in the context of the Open and Agile Smart Cities (OASC) initiative.

The work already done has been focusing on the following data models and accompanying datasets:

  • Point of interest (entity type PointOfInterest). It models different points of interest such as public parking lots, weather or air quality stations, and others. The pilot dataset includes data both from cities and from public organisms.

  • Weather

    • forecast (entity type WeatherForecast). It models a weather forecast, including all the expected values for the different variables (temperature, humidity, wind speed, maximum, minimum, etc.). In the pilot datasets, the weather forecasts come from public state meteorology agencies, from Spain (AEMET) and Portugal (IPMA).
    • observed (entity type WeatherObserved). It represents weather observations offered by the automated weather stations owned by AEMET.
    • ​alarms (entity type WeatherAlarm). They correspond to weather alarms provided by the European Meteoalarm service.
       
  • Ambient observed (entity type AmbientObserved). This entity type corresponds to the observations of the air quality in a city. The pilot dataset offers real time pollution data from the city of Madrid. Also, the data from Santander and Porto is currently following the same data model.

  • Parking (StreetParking or ParkingLot). Smart parking data models capture information that is needed to optimize car mobility in cities. The pilot dataset includes data from Santander. The cities of Seville, Antwerp and Porto are currently offering their data following the same data model.

Practical examples of using the NGSIv2 API, implementation details and additional information, are all provided at the Github repository of the project.

The IoTBDE project has enabled the experimentation, and validated the suitability of the FIWARE-NGSIv2 (APIs plus harmonized data models) as a universal mechanism for sharing context data of different nature. Further work, which will be conducted together with GSMA, other telco operators and with the whole FIWARE Community, will involve the refinement and improvement of NGSI version 2 by including linked data features (JSON-LD), and the commencement of a more formal standardization work around data models.

Last but not least, we encourage entrepreneurs, developers and researchers to contribute to this exciting work and to continue experimenting and building nice stuff with FIWARE and its open APIs!

Jose Manuel Cantera Fonseca. Technological Expert (Telefónica I+D)

 

 

New FIWARE Open Call for FIWARE Lab Nodes Support

 Developers  Comments Off on New FIWARE Open Call for FIWARE Lab Nodes Support
Oct 072015
 
mapa Open Call

IMPORTANT NOTICE: DEADLINE EXTENDED TO NOVEMBER, 16th at 17h00 CET

Following the success of other FIWARE Open Calls, FI-Core, which helps to fund the FIWARE PPP initiative, has put aside a portion of the budget in order to fund new beneficiaries that will join the association after the project starts. These beneficiaries are selected through a competitive Open Call for those providing FIWARE Lab nodes support.

The goals of the Open Call include (1) the expansion of the FIWARE Lab Association with new nodes to provide improved facilities and services, (2) the reinforcement of the support team with addition resources for first level helpdesk, (3) the promotion of FIWARE instances with credible business plans, (4) the sustainability of FIWARE experimentation and (5) the incorporation of FIWARE players who will stay active beyond FI-Core.

Participants are expected to propose a concrete plan that enables them to achieve these goals during the given time-frame. The successful beneficiaries will be invited to refine and implement the final plan with the project coordinator and the other collaborators.

The selected beneficiaries will be assigned a maximum budget of 1.625.000 € to execute their plan between November 2015 and December 2016. Depending on the support level offered, the maximum EC contribution for individual proposals is from 250.000 € to 325.000 €. Proposals that show long term commitment with the sustainability of the FIWARE technologies will be favoured, even if the activity is limited to the mentioned period of time.

The FIWARE Lab Open Call addresses those who can demonstrate experience and references in implementation of similar plans. We mainly target those who can prove their experience with OpenStack and showing a degree of involvement in developer and user communities will be an advantage.

This announcement will also be broadcasted via Twitter, Facebook & LinkedIn. In depth information, Call details and some helpful directions to prepare your proposal can be found HERE.

Contact e-mail: fiware-opencall-help@lists.fiware.org

OAuth2-based authorization and authentication in Cosmos WebHDFS at FIWARE Lab

 Developers  Comments Off on OAuth2-based authorization and authentication in Cosmos WebHDFS at FIWARE Lab
Jul 182015
 
FIWARE

APIs in FIWARE should be RESTful APIs. And RESTful APIs in FIWARE should be protected with OAuth2”. This sentence, which is true for most of the enablers in FIWARE, did not completly applied for Cosmos BigData. Until now.

OAuth2 is the evolution of the OAuth protocol, an open standard for authorization. Using OAuth, client applications can access in a secure way certain server resources on behalf of the resource owner, and the best, without sharing their credentials with the service. This works because of a trusted authorization service in charge of emitting some pieces of security information: the access tokens. Once requested, the access token is attached to the service request so that the server may ask the authorization service for the validity of the user requesting the access (authentication) and the availability of the resource itself for this user (authorization).

FIWARE implements the above concept through the Identity Manager GE (Keyrock implementation) and the Access Control (AuthZForce implementation); these two enablers together conform the OAuth2-based authorization service in FIWARE:

  • Access tokens are requested to the Identity Manager, which is asked by the final service for authentication purposes once the tokens are received. Please observe by asking this the service not only discover who is the real FIWARE user behind the request, but the service has full certainty the user is who he/she says to be.
  • At the same time, the Identity Manager relies on the Access Control for authorization purposes. The access token gives, in addition to the real identity of the user, his/her roles according to the requested resource. The Access Control owns a list of policies regarding who is allowed to access all the resources based on the user roles.

And how does this affects to Cosmos BigData? HDFS (big) data can be accessed through the native WebHDFS RESTful API. This API was not protected with FIWARE authentication/authorization mechanisms but with Hadoop ones. This leaded Cosmos to be one of the few remaining “rebel” enablers avoiding homogeneity in the access to FIWARE APIs.

So, what’s next? Let’s learn with an example!

How can I request an access token? Do the following request to the Cosmos Token Generator in FIWARE Lab (cosmos.lab.fiware.org:13000):

$ curl -X POST "https://cosmos.lab.fiware.org/cosmos-auth/v1/token" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=password&username=frb@tid.es&password=xxxxxxxx

{"access_token": "qjHPUcnW6leYAqr3Xw34DWLQlja0Ix", "token_type": "Bearer", "expires_in": 3600, "refresh_token": “V2Wlk7aFCnElKlW9BOmRzGhBtqgR2z"}

As you can see, your FIWARE Lab credentials are required in the payload, in the form of a password-based grant type (this will be the only time you have to give them).

Once the access token is got (in the example above, it is qjHPUcnW6leYAqr3Xw34DWLQlja0Ix), simply add it to the same WebHDFS request you were performing in the past. The token is added by using the X-Auth-Token header:

$ curl -X GET "http://cosmos.lab.fiware.org:14000/webhdfs/v1/user/frb/path/to/the/data?op=liststatus&user.name=frb" -H "X-Auth-Token: qjHPUcnW6leYAqr3Xw34DWLQlja0Ix”

{"FileStatuses":{"FileStatus":[…]}}

Now, if you try the above request with a random token the server will return the token is not valid; that's because you have not authenticated properly:

$ curl -X GET "http://cosmos.lab.fiware.org:14000/webhdfs/v1/user/frb/path/tp/the/data?op=liststatus&user.name=frb" -H "X-Auth-Token: randomtoken93487345”

User token not authorized

The same way, if using a valid token but trying to access another HDFS userspace, you will get the same answer; that's because you are not authorized to access any HDFS userspace but the one owned by you:

$ curl -X GET "http://cosmos.lab.fiware.org:14000/webhdfs/v1/user/fgalan/path/tp/the/data?op=liststatus&user.name=fgalan" -H "X-Auth-Token: qjHPUcnW6leYAqr3Xw34DWLQlja0Ix"

User token not authorized

Once this point is reached, you may say “OK, but I’m not using WebHDFS at all”. Are you sure? Because, if you are using Cygnus, the tool to build Orion context data archives, then you are using WebHDFS. This is because WebHDFS is the RESTful API used to persist the data in a HDFS backend such as Cosmos. Sadly, any Cygnus version had support for OAuth2… until now. Cygnus 0.8.2 is freshly available and supports OAUth2 through this parameter:

<your_cygnus_agent_name>.sinks.<your_sink_name>.oauth2_token = <your_token>

The token is got from cosmos.lab.fiware.org:13000 as seen before. And upgrading to Cygnus 0.8.2 is as easy as doing:

$ (sudo) yum clean all # just to clean the yum cache

$ (sudo) yum list cygnus# this will show you 0.82 is available

$ (sudo) sudo rpm -e -vv –allmatches –nodeps –noscripts –notriggers cygnus # this is needed if you have installed a version < 0.8.0

$ (sudo) yum install cygnus# this installs 0.8.2

Any doubt? Any question you may have, do not hesitate to contact us through stackoverflow.com or fiware-lab-help@lists.fiware.org. More details can be obtained from these two stack overflow questions:

http://stackoverflow.com/questions/31187977/oauth2-access-to-cosmos-webhdfs-in-fiware-lab

http://stackoverflow.com/questions/31310111/oauth2-in-cygnus

 

What makes a Smart App?

 Developers  Comments Off on What makes a Smart App?
Jul 012015
 
Smart Applications

The following post is a collaboration by Benedikt Herudek, consultant at Accenture. We would like to thank him for his collaboration and willingness to participate.

FIWARE applications are all about creating smart services and that requires being aware of the context. As one might expect, FIWARE doesn’t have a patent on that idea but hooks in to a wider trend in digitalization and IoT: nowadays, we have so much and so much potentially useful data available via the Internet and sensors that we could benefit from separate units of software to handle it, which are referred to as Context Brokers. Following Gartner’s Context Brokers for Smarter Business Decisions, published on the 21st of January 2015:

The underlying concept of a context broker is to have a separate software facility that gathers, prepares and serves context data so that a decision maker —a person or an application system— can have the benefit of this data without having to do all of the work of obtaining and managing the context data as part of the application itself. It is essentially a design pattern for sourcing context data more efficiently and effectively, offloading work from the decision-making application. A widely used Context Broker coming as an apache license is mosquitto.

FIWARE uses that concept (described to some extent in this blog post) and adopts it mainly (for the moment) for Smart Cities and Internet of Things. FIWARE applications are therefore supposed to be smart, in the sense of context aware applications. One could say, FIWARE does mainly two things with this idea. First, it tries to establish a standard protocol accepted all over Europe and thereby scales a market. Second, FIWARE does context management in a smart way. FIWARE context management is modelled along the design of the SNMP simple network management protocol reusing a standard called ‘NGSI’. The original NGSI standard has been created by the OMA standardization organization. However, this original definition is “abstract” and not directly usable, thus FIWARE has bound it to a “concrete” API definition based on RESTful design principles.

In that design, there is a context of so-called 'Entities'; i.e. relevant things to your application. 'Values' are the attributes of these entities, which change over time. A context could represent the reality in your own house or in a large city with entities like, for example, shops or buses.

The FIWARE Context Broker will allow your application to be unaware about how these context values are rendered: for instance, the temperature in a street could be rendered because users placed it on Twitter or rather because the city council decides to add sensors to buses. The FIWARE Orion Context Broker should hide this for you. The context model is extendable, so one can add features such as a value to rate certain buildings. FIWARE is built on REST (stateless) APIs, which are easy to use for developers. Payloads will use JSON or XML. If you need to know what the status of an entity is, you only need to read the value of an entity. If you want to trigger an action and the device allows so, all you need to do is changing the value of an attribute. You can do this with simple PUT and GET calls. The Context Broker connects to IoT agents, which connects to the devices.

Find here a visualization of the Orion Conext Broker from a 3rd party, not supported by FIWARE itself.

 

The Orion Context Broker shields you as a developer of Smart City applications from a complex setup of an agent – brokerage architecture. Compare it to the (business activity) monitoring solution of a production system for a large client. The Technical Architecture Team will have to deploy agents monitoring the systems, which will connect to the main system; for example, a console where you can see the status of an order or the memory consumption of a system. The infrastructure needs to be setup and maintained by a team of experts. As an end user, you don’t mind about how it works as long as your central instance allows you to interact with the deployed agents and the connected systems. In the world of Smart Cities and FIWARE, cities subscribing to the FIWARE standard would deliver the setup for you and you, as a developer, only connect to the front end, the Orion Context Broker.

The Orion Context Broker runs on top of the IoT Broker. This is a module introduced to handle the complexity of a large setup with 1000s of Devices and IoT agents connecting to them. Imagine you have an application with sensors in agriculture over large patches of lands over an entire country. Or maybe you have a city with many sensors and complex requests like, e.g.: 'Give me all cars in the street, their location and whatever else you know!'. Here, you might get several thousands of responses back. In that case, you will need a unit which handles and aggregates data for you and a unit to discover sensors in the street. A rule of thumb apparently says: with more than 1000 sensors, you should add an IoT broker to your application.

The IoT Broker will connect to the IoT agents in the field and manage them. The IoT Agents are pieces of software connecting to sensors from devices in the field. They translate IoT protocols like CoAP or MQTT into the Open Mobile Alliance NGSI standard that FIWARE will use. A showcase was done in Santander, Spain as the Context Broker and the IoT standard is developed by Telefonica research center.

From 'aware' to 'Smart'

Once you have all this data in your application, you will use other enablers to do smart things. FIWARE delivers a suite of generic enablers, which allow you to implement different functionalities.

FIWARE is also framed in the Open Data movement. This Open Data movement is pioneered by the (co-)founder of the world wide web Tim Berner Lee and connected to terms like semantic web, linked data, which has as one of its goals to make the web machine readable, where current HTML pages are targeted at human users to consume.

FIWARE uses the open-source Open Data framework ckan to offer a platform and marketplace for Open Data. Thanks to it, free data can be published, enforcing terms & conditions and using data with a fee. The scenarios here are either cities publishing data for free or companies publishing enriched data for a fee. Ckan datastore delivers search & discover functionalities to find published information.

One way of enriching data is to build FIWARE mashups on top of your dataset and visualize them this way. Such data mashups can be sold to newspapers to embed the information revealed in their online presence.

If gathering sensor data from the Internet of Things is a core concept, a Big Data analytics cannot be far. FIWARE hence offers a generic enabler to analyze Big Data. FIWARE uses hadoop under the FIWARE codename cosmos as it's a big data platform. Apache Hadoop's MapReduce and HDFS components were inspired by Google papers on their MapReduce and Google File System.

A typical use case of Big Data analytics would be that sensor data flows in via the Orion Context Broker to a FIWARE instance; for example, temperatures in the field. The Orion Context Broker itself only holds the last value of an entity. To have the historical view on temperature, one will connect the Orion Context Broker via a FIWARE component called Cygnus with hadoop, where the data will be stored and can be analyzed.  Cygnus uses the subscription/notification feature of the Context Broker, detailing which entities one wants to be notified when an update occurs on any of those entities attributes. Cygnus is based on apache flume and will allow to persist data from the Context Broker not only to hadoop but also mysql or ckan. Licenses are currently open-source, at some point these components might be feedback to the apache foundation to the hadoop ecosystem.

Telefonica delivers other add ons to hadoop called 'Tidoop' intended to allow using generic non HDFS data located at CKAN or Mango DB.

FIWARE offers Mashup technologies to create parts of front ends. This Mashup technology is useful for dashboards and maps, which are useful to be embedded, for example, in webpages to blend in a real time data camera from an open-source. A 'Widget' is a building block to build a 'Mashup'. Widgets are connected to each other via 'Wires'. Backends can be accessed directly by widgets via so-called operators. After you build such a mashup and have created a useful visualization, the mashup can be published back to the FIWARE catalogue to reuse and to sell it on the internal store. FIWARE also offers 3D and Augmented Reality visualization frameworks based on HTML5, WebGL, XML3D and XLOW.

FIWARE integrates the Kurento Mediaserver in its platform. Kurento is based on WebRTC, which is a World Wide Web Consortium standard with open-source delivered from Google.  It allows, for example, to create browser communication easily. You should be able to create something like Skype easily. Kurento is implementing this standard. Kurento is an open-source platform making it possible to create a rich WebRTC and multimedia applications. For example, you will use so-called media elements, which are used for example to record videostreams. One will need one video to receive and one media element to record the stream and one will need to connect them properly. Kurento also allows to integrate augmented reality elements in videostreams and can thereby be useful for a Smart City context, e.g. by adding virtual objects like arrows to walk through a street. Thanks to these technologies, it is also possible to detect building of large groups in a city, this could be useful, for example, to direct police to large crowds assembling during concerts or sport events. Kurento is closely integrated with the OpenCV libraries, mainly aimed at real-time computer vision and is used for interactive art, to mines inspection, stitching maps on the web or through advanced robotics and backed by Intel.

As an open platform, you can use any GUI framework like javascript or php frameworks as a base and use the described generic enabler for user interaction.

IoT Tutorial – Orion Context Broker & Arduino

 Developers  Comments Off on IoT Tutorial – Orion Context Broker & Arduino
Jun 102015
 
Orion Context Broker

By Telefónica  R&D Chile.

This tutorial will be divided into parts for easier reading and practical purposes.

1. Introduction to the technologies used

2. Hardware configuration

3. Arduino, software and communications

4. Orion Context Broker (FIWARE)

5. Action from a remote web

The idea of ​​this tutorial is to learn some theoretical concepts and quickly apply them in practice. Possibly, when you finish this tutorial, you will have imagined hundreds of alternatives based on the original concept to create a sensor-based solution connected to the Internet (basic principle of the Internet of Things).

Come on, let's get started!

Introduction to the technologies used

Before we start, it’s important to briefly review and understand some key concepts. If you are familiar with these concepts, you can proceed directly to the next section.

First of all, the Internet of Things corresponds to the third great wave in computer technology. The first wave was the development of computers in the 60s, then the use and exploitation of the Internet, with mass penetration starting in the eighties, and now the IoT. But what is the Internet of things?

To answer the question above, we must understand the concept of 'connected things' whereby electronic devices can send and receive information via the Internet. Examples including home thermostats, smart cars, entry controls and a thousand other devices. But the reader might be wondering why these devices should be connected to the Internet.

Primarily because the data obtained from these devices can later be combined with other data to obtain more advanced functionalities. Imagine you set your smartphone alarm to wake you up in the morning. It's winter so there is not much light when you wake up. At the sound of the alarm, soft lighting is activated, the toaster starts to warm your bread and the coffee begins to heat up. This may be a rather elementary example, but it helps us to understand that the more information we have and can interrelate, the more devices we can actually create to help improve our quality of life.

One interesting point to discuss is the use of standards. For the specific case we will review later in Orion Context Broker section, an adaptation based on the OMA (Open Mobile Alliance) NGSI (Next Generation Service Interface) specification is used. In simple terms, this means that the HTTP requests or actions to be used are those that are currently employed by browsers such as GET, POST, DELETE and PUT to interact with the Context Broker.

We have reached the end of part one of this tutorial, so let’s get started with the practical information.

Hardware configuration

This is now the practical part of tutorial, so let’s get started!

The components we will be using are:

• An Arduino Board (there are many alternatives, but a version with WiFi is essential)

• A breadboard

• LEDs

• Connecting cables

• A router or a cellular device that can deliver WiFi (tethering)

As a brief introduction to Arduino, it should be highlighted that this hardware is based on an Open-Source specification that, using a board with a microcontroller, allows interaction with numerous devices such as sensors, lights, switches, etc.

Arduino has its own interface development using the C ++ language and integrates a number of libraries to facilitate the 1implementation of prototypes. This does not mean that Arduino cannot be used in industrial or high-demand environments. However, in these scenarios cost issues usually lead to the use of ad-hoc components.

When observing the structure, you can recognize some digital pins on the top and analogue pins at the bottom. Also, at the bottom, is the row of connectors to power a testing board or breadboard. The board also must have a connector to an electrical outlet and a USB mini connector, among other components, depending on the version of the board and if you use add-on 'shields' or not.

If we connect a LED to the board we can do so directly, connecting the LED to digital pin 13 and the GND as seen here. Although it should be noted that the digital pin 13 comes with a resistor, so it would be unnecessary in the image below. (In other pins resistors must be installed) .

 

2

Lastly, the same result can be obtained using a breadboard. This is a good idea if you want to add more LEDs or sensors to our Arduino board so you can add more functionalities. Remember that on a breadboard power runs horizontally in the outer points and vertically in the inner points. So the result is:

 

3

Take note: Specifically, the Intel Edison Arduino board requires 2 Micro USB cables and a power connection.

Hard to understand? I hope not. This concludes part two of our tutorial.

Arduino, software and communications

In this tutorial we will learn how to program the Arduino board so as to turn the LED we installed in part two on and off. Then, we’ll use an internet connection with the board’s WIFI.

As a prerequisite, we must have already configured the Arduino software as per our operating system. Also, we must keep the board’s USB connected to our computer to load the program to our board. Look here to see how to install the (Intel Edison) software.

You must select the version of the software that corresponds to your operating system.

Once the software is configured and installed we open our IDE and start the coding.

This is an example of the Arduino IDE.  This is specifically the IDE for Intel sets, although the concepts are the same.

 

4

In the second row menu (where the check icon is), you’ll find the commands to compile and upload our developments to the board.

Looking at the code, we have two functions. One is setup, where variables are normally initialized and the loop where the operations are executed as required.

In the File menu we have the option Examples – 01 Basic – Blink. This will display a new window with the code needed to test our LED:

/*

Blink

Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.

*/

// Pin 13 has an LED connected on most Arduino boards.

// give it a name:

int led = 13;

 

// the setup routine runs once when you press reset:

void setup() {

// initialize the digital pin as an output.

pinMode(led, OUTPUT);

}

 

// the loop routine runs over and over again forever:

void loop() {

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)

delay(1000); // wait for a second

digitalWrite(led, LOW); // turn the LED off by making the voltage LOW

delay(1000); // wait for a second

}

The example that Arduino generates is quite simple. In line 10 a variable is set with the corresponding pin number on the board. Afterwards, the pin with the variable 'led' as an output is initialized. And, in the loop, the LED is turned on and off separated by a delay of one second. Before loading the code to the board, the IDE must be configured so it knows which board and what port we’re using:

Select Tools> Board> Intel Edison

Select Tools> Port> dev / ttyACM0

Now, if the board is properly plugged into the USB port, we can 'Upload' the code to the board (Ctrl + U) and we should see our LED turning on and off every second. Amazing! Right?

Now to use the WIFI, we need to work a little harder. Luckily, in the Arduino examples, we have a WIFI section with different alternatives when using networking solutions. Among them are Telnet servers and clients, Web servers and clients and even a Twitter client.

TIP: In our case, for purposes of simplicity, we can use a Web client since we will subsequently send requests to the Orion Context Broker using the HTTP protocol. Note that there are better solutions, but for educational purposes we’ll try to minimize the code as much as possible.

#include <SPI.h>

#include <WiFi.h>

   /**************************/

  /*  Setup configuration              */

/************************/

char ssid[] = "YourWifiSSID";                     //  Name of the network

char pass[] = "WifiPassword";                       // Network password

char server[] = "130.206.80.47";                    // ORION IP address -> Create in /lab/

int status = WL_IDLE_STATUS;   // we predefine the status as On but not connected

int led = 13;                                     // We initialize a variable to assign the pin number to which the led will be connected

/**

* Arduino Setup configuration

* (Execute only once)

**/

void setup() {

  // Inititialization of the Arduino serial port

  Serial.begin(9600);

  while (!Serial) {

    ; // wait for serial port to connect. Needed for Leonardo only

  }

  // Verify that the board has a WiFi shield

  if (WiFi.status() == WL_NO_SHIELD) {

    Serial.println("Wifi shield is not available");

    // Do not continue with setup, or in other words, stay here forever

    while(true);

  }

The complete code is available in:

https://bitbucket.org/tidchile/ecosystem/src/

FIWARE and Orion Context Broker

As discussed earlier in this tutorial, the Orion Context Broker is a service that based on the OMA NGSI 9/10 standard and can handle sending and receiving contextual information. What does this mean? Primarily, to handle a large number of messages from entities and manage updates, queries, and also handle data subscriptions from the entities. Remember that according to the NGSI 9 and 10 standards, we handle entities as an abstraction of the physical nodes or devices used in IoT solutions.

In the example above, we made an update request to an entity already created. But first let's review how to work with Orion. A simple way to test the OCB service is to create an account in https://account.lab.fiware.org/ and create a virtual machine with Orion preconfigured in the Cloud section. Alternatively, access Orion’s GitHub site and download a virtual machine to run in our local environment

Another useful tool is a REST client, but we can use cURL if it seems simpler. RESTClient is a client for Firefox that is fairly easy to use.

The configuration aspects of the OCB are outside the scope of this tutorial, as it would require too much detail. Regarding the FIWARE Lab, it is important to note that FIWARE provides virtual machines in the Cloud for free to test FIWARE compontents. You only need to create an account to access the services. Only a quick caveat. As of today (19-03-2015) and temporarily, Spain has no resources available, but there are other regions where VMs can be created. 

When we have the necessary tools, the most basic way to interact with the OCB is:

1. Create an entity:

To do this you must take into consideration several factors.  Firstly, the call is sent as an HTTP POST request, for example, http://myhost.com:1026/v1/updateContext. By this we mean that we are occupying version 1 of the API with the updateContext operation.

We also have to define several variables in the header of the request:

Accept: application/json

Content-Type: application/json

X-Auth-Token: [TOKEN AUTHENTICATION]

Regarding the token generation, the simplest way is to use python script created by Carlos Ralli on GitHub. A FIWARE account and running the 'get_token.py' script is required.

After setting the header of the request, configure the 'body' of the request using the following JSON code:

{

  "contextElements":[

    {

      "type":"LED",

      "isPattern":"false",

      "id":"LED001",

      "attributes":[

        {

          "name":"switch",

          "type":"bool",

          "value":"false"

        }

      ]

    }

  ],

  "updateAction":"APPEND"

}

Here is the structure of a "context Elements" which is a group of entities with certain attributes such as "type", "isPattern" and "id". "type" refers to a defined type and allows searching for entities by a particular type. "id" is an attribute that must be unique for each entity to execute searches based on this ID. "IsPattern" will be explained later in point No. 2.

You can also add a number of attributes to the entity in the "attributes" property, where each attribute is defined by  "name", "type" and  "value". Finally, "updateAction" defines whether we will perform an "APPEND" or and "UPDATE".

If all went well, we will receive a 200 OK response from the server and it will give us the details of the entity created:

{

  "contextResponses" : [

    {

      "contextElement" : {

        "type" : "LED",

        "isPattern" : "false",

        "id" : "LED001",

        "attributes" : [

          {

            "name" : "switch",

            "type" : "bool",

            "value" : ""

          }

        ]

      },

      "statusCode" : {

        "code" : "200",

        "reasonPhrase" : "OK"

      }

    }

  ]

}

2. Consult an entity:

To consult an entity, the standard operation is 'queryContext' which would be http://myhost.com:1026/v1/queryContext . We also apply the headers described in point No. 1 and use POST.

The JSON used in the body of the request would be as follows:

{

  "entities":[

    {

      "type":"LED",

      "isPattern":"false",

      "id":"LED001"

    }

  ]

}

This is where you can use "isPattern" in "true" and work either the "type" field or "id" field with regular expressions if we want to execute a slightly more complex search. In the example above we are only looking for the same entity created through the "id".

There is also a simpler way to do the same query using the following request: GET http://myhost.com:1026/v1/contextEntities/LED001 where LED001 is the "id" of the entity to search for.

3. Update an entity:

This is identical to point No. 1 but changing the "updateAction" attribute from "APPEND" to "UPDATE".

Finally, integrating all that we reviewed, we will be able to generate an action from a simple Web page that can be deployed on a remote server and actually prove that the application’s LED is activated remotely using the OCB.

To do this we will use the LED001 recently created, by setting the 'switch' attribute from true to false and vice versa to check the action.

Our web would look like this:

 

5

For this, the html code, css and js are shared in:

https://bitbucket.org/tidchile/ecosystem/src/