Web Thing API by Mozilla

W3C Web Thing es una nueva propuesta (en este caso por parte de Mozilla) para describer un modelo de datos común y un API para la “Web of Things”.

La Web Thing Description provee un vocabulario para describir dispositivos físicos conectados a Internet en un formato legible basado en JSON.

Por su parte la Web Thing REST API y Web Thing WebSocket API permiten que un cliente web pueda acceder a las propiedades de un dispositivo, ejecutar acciones sobre este y suscribirse a eventos que representan un cambio en su estado.

La especificación incluye:

· Web Thing Types como tipos adicionales que pueden ser definidos usando extensiones semánticas sobre JSON-LD

· Un Web Thing API Protocol Bindings para escribir bindings a la Web Thing API para otros protocolos IoT

· El documento Web of Things Integration Patterns describe patrones para integrar dispositivos con la Web Thing API.

Seguro que con un ejemplo se entiendo mucho major lo que nos ofrece esta especificación:

Donde podemos ver que el dispositivo (DigitalTwin) tiene una propiedad temperatura de tipo Number, otra humidity y otra led, así como una acción (que alguien puede ejecutar sobre el dispositivo) y un evento (que se publica cuando se desencadena) reboot. Así como links para acceder a las propiedades, acciones ,eventos,…

Siguiendo la especificación podemos ver como:

Ejecutando esta petición:

Obtengo la descripción del dispositivo concreto.

Si hago

Me devolverá el valor de la propiedad:

Si quiero cambiar el valor de una propiedad:

Si quiero lanzar una acción reboot:

También puedo obtener una lista de peticiones de acciones:

Para acceder a los eventos

Aunque a la especificación le faltan aún bastantes cosas (como la seguridad, lógica embebida en el dispositivo) a nivel de interfaces la especificación es muy sencilla y fácil de implementar versus otras soluciones más potentes (y complejas) que veremos en próximos posts.

Web Thing API by Mozilla

Plugins Sofia2: Cómo desarrollar un IoT Gateway para WebSockets en la plataforma

Blog de Sofia2 IoT Platform

Una de las características técnicas más destacables de la plataforma Sofia2 es que los protocolos físicos de comunicación soportados (TCP, MQTT, Ajax,…), y sobre los que se envían mensajes SSAP desde los KPs, no están ligados al proyecto CORE de Sofia2, sino que son creados y desplegados en forma de Plugins.

De este modo, en cada instalación de Sofia2, es posible desplegar únicamente aquellos protocolos que se van a usar, sin necesidad de añadir el resto.

Asimismo, es posible desarrollar nuevos Gateways y desplegarlos de manera sencilla sin tener que añadirlos al core de la plataforma. Basta con desarrollarlos de manera separada, compilarlos como un Jar de Java y añadirlos al directorio de Plugins para que la plataforma los arranque durante el despliegue. De manera que la plataforma tiene la versatilidad de poder ser extendida con nuevos protocolos necesarios para un proyecto concreto, sin necesidad de solicitar una ampliación…

Ver la entrada original 830 palabras más

Plugins Sofia2: Cómo desarrollar un IoT Gateway para WebSockets en la plataforma

5 IoT trends that will define 2018

(From NetworldWorld)

The Internet of Things (IoT) wasted no time spreading across the world and connecting millions of individuals. In just a few short years, billions of sensors redefined how businesses operated and how people interacted with one another, and that was only the start; one IHS forecast predicts the IoT will grow to reach a staggering 75 billion devices by 2025.

What changes will the IoT bring even sooner, in 2018? Is the phenomenon of an interconnected world a mere fad, or will the trends of the IoT continue to define us for decades to come? These five trends highlight the stunning innovations that may lurk just around the corner, and could be a taste of the world yet to come.

More IoT devices than ever

While IHS and others are predicting massive upticks in the amount of digitally-connected devices over the next decade, it’s likely we won’t need to wait very long. BI Intelligence’s report on the IoT notes that nearly $6 trillion will be spent on IoT solutions in just the next five years, for instance, meaning the rapid proliferation of IoT gadgets has already begun.

As more consumers around the globe purchase smartphones, tablets, and other gadgets which hook them into the web, the expanse of the IoT will only grow ever-greater. Low-power, short-ranged networked devices will be increasingly pushed by companies hoping to cash in on the boom in tech, and millions of more sensors embedded in our world in just a year’s time.

The forthcoming retail shakeup

One of the largest impacts the IoT could have in 2018 is the waves of change it’s bringing to retail. Consumers and business-owners alike have profited greatly off of the increase in sensors and data driven by the IoT, as it allows businesses to better market their products to prospective customers.

Increasingly, tech-savvy companies eager to use new data are investing in sensors-based analytics, which allows them to, among other things, track which areas of their stores are the most trafficked by customers. CBInsight’s report on the IoT’s impact on retail outlines the innovative ways companies are using the IoT to better track their inventory, manage losses from theft, and reach out to customers in new and exciting ways.

Forget Amazon’s coming drone-delivery systems or increased amounts of online shoppers; the boom in embedded-sensor driven retail shopping will by itself single handedly change how customers find and buy their favorite products.

Reshaping healthcare

As more and more patients turn to big data driven healthcare solutions, the IoT also stands to reshape how people access and pay for their healthcare services. An ongoing boom in wearable tech has largely been fueled by its applications to people’s healthcare, such as wearable gadgets’ abilities to monitor your heartrate or stress levels.

As hospitals and clinics face larger amounts of patients who need care, they can turn to networked gadgets which can remind patients when to take their prescriptions, when to exercise, and alerts patients when their blood pressure levels are too high.

New network security challenges

Not all of the forthcoming trends in the IoT are positive; new network security challenges will push IT experts to their limits in 2018 as hackers and other malevolent actors seek to harness the IoT for their own nefarious purposes. One cyberattack in October of 2016 already crippled large swaths of the internet after hackers effectively exploited the IoT to power their attack.

As industrial IoT continues to grow at an explosive rate, vulnerabilities in global internet-infrastructure systems will only grow worse. As more devices become connected to one another, security experts and major businesses will need to move quickly to patch holes in their defenses as malware jumps from one networked device to another.

Greater access to capital

These staggering leaps forward in tech aren’t occurring in vacuum; investors are taking notice of the IoT more so now than ever before, and are ponying up the funds needed for the IoT’s expansion. In 2018, IoT-based ventures will have greater access to startup capital and be taken more seriously in the market.

About 19% of business respondents to one Forrester survey reported using the IoT already, but a staggering 28% also reported that they planned to adopt IoT usage in their business operations in the near future. The utilities, transportation, manufacturing and mining industries are all perched to invest and benefit heavily in the IoT in coming years.

It’s never easy to accurately predict the future, and the true capabilities of the Internet of Things may not yet be realized. As consumers and corporations alike embrace the IoT’s world-changing impact on global commerce and lifestyle, however, it’s hard to imagine the IoT doing anything but growing to new and greater heights in 2018.

5 IoT trends that will define 2018

The Top 8 IoT Trends For 2018

(From Forbes)

A recent study shows about 2/3 of companies are currently utilizing IoT

An IHS survey estimates that there are 20 billion connected devices globally as of this year. Will 2018 be “The Year of IoT”? Not exactly, but the future looks promising and 2018 will show a promising trajectory.

Despite the huge gains in connectivity, the truth is 2018 will be more of a steady (rather than explosive) growth period for the IoT, full of fits and spasms, and everything that goes along with them. It will see lots of investment—lots of growth—and widespread adoption in a few major industries. But it will also see some growing pains—“fragmentation frustration,” potential data breaches, and security issues galore.

Futurum Research

So, will 2018 be an exciting year? Yes—ish. The truth is, we’re right smack in the midst of a revolution—no matter how imperfect it may initially seem. If that isn’t exciting, I don’t know what is. The following are the top eight trends we’ll see in the coming year:

1. The IoT Will Grow: In what might be the most obvious prediction of the decade, the IoT will continue to expand next year, with more and more devices coming online every single day. What isn’t so obvious about this prediction: where that growth will occur. The retail, healthcare, and industrial/supply chain industries will likely see the greatest growth. Forrester Research has predicted the IoT will become “the backbone” of customer value as it continues to grow. It is no surprise that retail is jumping aboard, hoping to harness the power of the IoT to connect with customers, grow their brands, and improve the customer journey in deeply personal ways. But industries like healthcare and supply are not far behind. They’re using the technology to connect with patients via wearable devices, and track products from factory to floor. In many ways, the full potential of the IoT is still being realized; we’ll likely see more of that in 2018.

2. It Will Also Become More Fragmented: Just as the IoT continues to grow, it will also become increasingly fragmented. As we’ve seen with the growth of as-a-Service (aaS) programs and cloud solutions, that fragmentation will create some hurdles for many companies, as they deal with compatibility issues throughout their industries. Though companies like Qualcomm are leading the push for IoT device standards and certifications, in many ways, the genie has already left the bottle. It’s now a matter of wrangling her back into place if we want to put those standards in place.

3. Which Leads to Greater Security Concerns: I’ve said it before, but fragmentation leads to system compromise. Almost every time. The more complex, the more network security challenges. Indeed, securing all these connected devices in an environment with minimal regulation will be difficult. Finding a solution to keep data safe will be a main goal in the coming year.

4. Mobile Platforms Will Make More Sense: The trend from mobile-first to mobile-only will likely continue to grow, as mobile platforms will become the de facto management system for IoT devices. Again, this isn’t shocking—but it isn’t finished yet, either. The development of the IoT is one that will happen over time as early adopters begin to refine, and late-comers jump into the mix. The coming year will continue to see many transition into mobile platform development.

5. And Marketing Efforts Will Continue: Again—perhaps a little obvious. But this coming year will be ripe with dings, bells, and whistles as customers are alerted to bargains, incentives, and other news regarding their homes and offices. An increasing number of companies will begin to use the IoT for these more personalized marketing efforts. They’ll also get closer to finding the “how much is too much” balance when it comes to marketing.

6. Companies Will be Pushed to the Edge with Data: Because of the huge influx of data being created through the IoT, it makes sense that companies will need to find a better, closer, cheaper way to process it. That’s why edge networking will be less of a trend and more of a necessity, as companies seek to cut costs and reduce network usage. Today we are seeing companies like Cisco, HPE and Dell leading the migration of compute infrastructure to the edge. Legacy industrial IoT firms like GE and ABB are also continuing to develop hardened infrastructure to handle challenging environments that are less ideal to hosting compute than traditional data centers.

7. And Need Advanced Analytics and Machines to Help Manage It: Just as the increase in data will push companies to “the edge,” it will also push them toward artificial intelligence (AI) and machine learning. Indeed, AI will also become a necessity, as the amount of data created by the IoT will simply be too large for humans to manage. These more advanced technologies will need to find their way to support the rapidly growing IoT space soon, however, in the meantime, we will see a strong growth in analytics software and tools to provide real-time data streaming for IoT devices. Analytics companies like Software Advice, SAS, SAP, and Teradata are a few of the players making noise in this arena. I also expect a series of new entrants in the IoT analytics, machine learning and AI space as this data deluge is going to require sophisticated tools to manage and extract the most valuable insights.

8. But There will be Lots of Money to be Had: Business Insider predicts business spending on IoT solutions will hit $6 trillion by 2021. It makes sense, then, that venture capitalists will continue to poor funds into the promise of IoT—underscoring its potential to improve customer experience in almost every industry.

Like I said—this won’t be a silver bullet year for the IoT. It rarely is for any new technology. But some major inroads will be created that should help build a larger and more solid foundation for the technology in the next five years. After that—it’s anyone’s guess; we may be talking about a whole new technology altogether.

The Top 8 IoT Trends For 2018

Notebooks Procesando y representando datos en un mapa Leaflet con los Notebooks Sofia2

Los Notebooks Sofia2 (basados en el proyecto open-source Apache Zeppelin) permiten a los científicos de datos crear diferentes modelos y algoritmos desde el Control Panel de la plataforma Sofia2. Desde este entorno web los Data Scientists pueden cargar datos a HDFS, procesarlos con Spark, Spark o Python, consultarlos con HIVE, visualizarlos de diferentes formas y además de todo esto manejar las ontologías Sofia2 desde este entorno.

En este ejemplo de uso de los Notebooks vamos a ver cómo traernos un fichero de un sitio externo, procesarlo con Spark y representar los datos procesados en un mapa OpenStreetMap con Leaflet.

Concretamente estamos hablando de un fichero que ofrece el servicio OpenData del gobierno francés (https://www.data.gouv.fr/fr/) y que contiene los datos de las estaciones de recarga eléctrica de Francia

https://www.data.gouv.fr/fr/datasets/fichier-consolide-des-bornes-de-recharge-pour-vehicules-electriques-irve/

El fichero tiene este aspecto:

Comenzaremos por descargar el fichero hacia el directorio home de nuestro usuario:

Lo siguiente es subir este fichero de nuestro directorio local al sistema de ficheros HDFS de nuestro cluster Hadoop

Una vez en HDFS ya puedo manejar los datos con Spark, en este caso para procesar el CSV usaré la librería com.databricks.spark-csv. Para cargarla en el classpath de Spark lo más sencillo es hacer esto:

Y de esta forma tan sencilla puedo convertir el CSV almacenado en HDFS (load(“/examples/IRVE-201510.csv”)) a un DataFrame (df) y de ahí a una tabla persistente (df.write.saveAsTable)

Y una vez tengo la tabla ya puedo consultar los datos de esta de forma muy sencilla:

Además de representarlos en diferentes formatos:

Finalmente haremos la consulta que queremos representar en el mapa:

Tras esto voy a convertir los datos de la consulta a JSON para poder representarlos fácilmente, para esto usaré la librería Gson.

Haré la consulta, mapeando las columnas de los datos obtenidos a los nombres que quiero usar en el JSON:

Los datos tienen esta pinta:

Y ya solo me queda hacer el HTML+JS para pintar mi mapa, en Zeppelin para incrustar un HTML basta con empezar el párrafo con:

Mi HTML tiene este aspecto:

En él podemos ver que estamos usando Thunderforest como Layer (y un apikey que debéis generar en http://www.thunderforest.com/docs/apikeys/ para evitar la marca de agua).

El código que maneja mi JSON con las estaciones es este:

Que genera un botón Show me the map que al pulsar muestra el mapa con un marker para cada estación:

Además de ver la representación en el propio Notebook si en las opciones del párrafo selecciono Link this paragrah:

Esto me genera un URL en la que veo el mapa:

https://sofia2.com/console/notebook/#/notebook/2D1Y4DKY7/paragraph/20160519-175034_779917343?asIframe

y puedo ir pinchando sobre los diferentes markers:

Notebooks Procesando y representando datos en un mapa Leaflet con los Notebooks Sofia2