What if you could use JavaScript to control stuff in your home like lightning, garage doors, HVAC, TVs and audio systems? Although the most popular products and solutions like the Apple AirPlay, Google Chromecast and Nest Termostat rely on proprietary protocols, there are plenty of devices that support the UPnP standard, which should allow cross-vendor compatibility.
The W3C Device APIs Working Group released a draft of a JavaScript API for Network Service Discovery aiming those devices. Opera already released an experimental build that implements the proposed API which hopefully it would be soon supported by Firefox and Blink.
In this talk, we will know more about UPnP/DLNA and explore some of the possibilities to integrate them with our current technology stack. We will run some demos through experimental browsers and we will learn how to use Node.js and a Raspberry Pi to build a low-cost UPnP gateway to bridge the gaps for the current browsers and empower the audience to come up with their own crazy applications.
JavaScript powering the dream of the connected home
1. JAVASCRIPT POWERING THE DREAM OF
THE CONNECTED HOME
Rodrigo Fernandez
HTML5 Developer Conference
May 2014
2. ABOUT ME
• From Brazil
• BSEE
• Currently with @WalmartLabs, Carlsbad, CA
– Business Tools and Services
• Previously with PacketVideo (NTT Docomo)
– DRM
– UPnP/DLNA
– BEAM
6. SOME USE CASES
• Browse for media from a mobile device and
play it on any TV
• Play music and open blinds at 7 AM
• Close the garage door if cell phone location is
more than 300 feet away from home
• Turn off the HVAC if two or more windows are
open longer than 5 minutes
• Control lighting and surveillance remotely
8. PROPRIETARY SOLUTIONS
• Amazon Fire
• Apple AirPlay
• Belkin WeMo
• Google Chromecast
• Nest
• Phillips Hue
• Sonus
• Roku
• Z-Wave
9. UPNP
• It is a set of protocols that permits networked
devices to seamlessly discover each other's
and interoperate
• Started by Microsoft in late 1900s
• UPnP Forum formed in Oct. 1999
• Established as ISO/IEC standard in Dec. 2008
• Popular on printers, network routers, STBs,
game consoles, smart TVs, etc
10. UPNP DEVICE CATEGORIES
• Audio/Video
– Media Server
– Media Renderer
• Device Management
– Manageable Device
• Home Automation
– Solar Protection Blind
– Digital Security Camera
– HVAC
– Lighting Controls
• Networking
– Internet Gateway
– WLAN Access Point
• Printer
– Printer Enhanced
– Printer Basic
• Remote Access
– RA Client
– RA Server
– RA Discovery Agent
• Remoting
– Remote UI Client
– Remote UI Server
• Scanner
– Scanner
• Sensor Management
– Sensor Management
• Telephony
– Telephony
12. DLNA
• Series of guidelines for sharing digital media
on top of UPnP
• Established by Sony in Jun. 2003
• More restrictive than UPnP
– Containers (file formats)
– CODECs
• 3 Billion certified devices on the market
13. DIAL (DISCOVERY AND LAUNCH)
• Protocol that targets 2nd screen experiences
• Published by Netflix and YouTube in Dec. 2012
• Relies on UPnP and HTTP
– DIAL Service Discovery
– DIAL REST Service (XML/JSON)
• Supported by:
– Amazon Fire TV
– Google Chromecast
– Roku
– TiVo
26. BEWARE OF CORS
• Setting a custom header in a XHR request
triggers preflight
• Preflight consists in an OPTIONS request sent
by the browser before sending the actual
request in order to determine if it is safe to
continue
• Guess how many devices handle OPTIONS?
• Use a proxy to prevent issues
28. BEYOND NSD
• W3C
– Device APIs WG: http://bit.ly/1ih3sgf
– Web and TV IG: http://bit.ly/1ih3x3B
– 2° Screen Presentation CG: http://bit.ly/1ih3BAe
– Web of Things (WoT): http://bit.ly/1ih3Efo
• UPnP+
– Protocol bridging
• UPnP Cloud
– Devices connect to a cloud server using XMPP
• webinos
– Built with OSS and leverages web technologies
– Focus on TV, automotive, health and home automation
Home automation is the residential extension of building automation. It is automation of the home, housework or household activity. Home automation may include centralized control of lighting, HVAC (heating, ventilation and air conditioning), appliances, security locks of gates and doors and other systems, to provide improved convenience, comfort, energy efficiency and security. Home automation for the elderly and disabled can provide increased quality of life for persons who might otherwise require caregivers or institutional care.
The popularity of home automation has been increasing greatly in recent years due to much higher affordability and simplicity through smartphone and tablet connectivity. The concept of the "Internet of Things" has tied in closely with the popularization of home automation.
Home automation is the residential extension of building automation. It is automation of the home, housework or household activity. Home automation may include centralized control of lighting, HVAC (heating, ventilation and air conditioning), appliances, security locks of gates and doors and other systems, to provide improved convenience, comfort, energy efficiency and security. Home automation for the elderly and disabled can provide increased quality of life for persons who might otherwise require caregivers or institutional care.
The popularity of home automation has been increasing greatly in recent years due to much higher affordability and simplicity through smartphone and tablet connectivity. The concept of the "Internet of Things" has tied in closely with the popularization of home automation.
Home automation is the residential extension of building automation. It is automation of the home, housework or household activity. Home automation may include centralized control of lighting, HVAC (heating, ventilation and air conditioning), appliances, security locks of gates and doors and other systems, to provide improved convenience, comfort, energy efficiency and security. Home automation for the elderly and disabled can provide increased quality of life for persons who might otherwise require caregivers or institutional care.
The popularity of home automation has been increasing greatly in recent years due to much higher affordability and simplicity through smartphone and tablet connectivity. The concept of the "Internet of Things" has tied in closely with the popularization of home automation.
The UPnP architecture allows device-to-device networking of consumer electronics, mobile devices, personal computers, and networked home appliances. It is a distributed, open architecture protocol based on established standards such as the Internet Protocol Suite (TCP/IP), HTTP, XML, and SOAP. UPnP control points (CPs) are devices which use UPnP protocols to control UPnP controlled devices (CDs).[1]
The UPnP architecture supports zero configuration networking. A UPnP compatible device from any vendor can dynamically join a network, obtain an IP address, announce its name, advertise or convey its capabilities upon request, and learn about the presence and capabilities of other devices. Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) servers are optional and are only used if they are available on the network. Devices can disconnect from the network automatically without leaving state information.
Digital Living Network Alliance
addressing advertise architecture control description device DIAL discovery DLNA DNS eventing GENA HTML HTTP HTTPMU HTTPU IP multicast presentation protocol SDK services SOAP SSDP TCP UDP unicast UPnP URL XML Zeroconf
/Users/roliv14/Music/iTunes/iTunes Media/Music/Compilations/The Very Best of Soft Cell/02 Tainted Love (7_ Single).m4a
/Users/roliv14/Movies/big_buck_bunny_480p_stereo.avi
ARM Cortex-M3 @ 180 MHz
32MB RAM
32MB Flash
WiFi
GPIO
Micro USB or battery power
/Users/roliv14/Music/iTunes/iTunes Media/Music/Compilations/The Very Best of Soft Cell/02 Tainted Love (7_ Single).m4a
/Users/roliv14/Movies/big_buck_bunny_480p_stereo.avi