 Okay. So today, let me do a self-introduction from an open source group of Samsung Research UK. Today, I also have my teammate, Phil. He's joining me. Phil is based in France and I'm based in the UK. So in today's talk, we're going to talk about our practice in the lab on how we bring JavaScript into Internet of Things from in-banded device to smart gateway. So start the talk. We'll just, you know, just briefly discuss why we choose JavaScript in Internet of Things. And then we go further to talk about the challenges we're facing to bring JavaScript into IoT. And first, we look at to bring JavaScript in in-banded devices. Then at this point, we're going to introduce you JavaScript, an ultra-light JavaScript engine developed in Samsung. And then we look at the two very popular IoT platforms, which actually build on top of the JavaScript. The IoT platform will provide direct JavaScript APIs to developers. So the challenges on the gateway side is a lot less, thanks to the Node.js framework. Then after we have it, we introduce you the JavaScript engine and the gateway, which actually we actually choose the Mozilla Things gateway. So we're going to put them together, show you a simple demo, see how you can make a very simple end-to-end IoT system using these two platforms. And after demo, Phil is going to introduce you the web of things technology we've been using this demo. And then he's going to go further. So he's going to show you some very exciting light demos. So he's going to show you how to control your sense, his sense actually at home, how to control it from here remotely. So why JavaScript in IoT? Well, can I ask how many of you consider yourself as JavaScript developers? Well, pretty much, I would say more than half. Yes, that's what we, that's the main reason, one of the main reason we're choosing JavaScript is popularity. So according to the StackFlow annual survey, well, for the fifth year in a row last year, 2018, for the fifth year in a row, JavaScript is a top language choice for developers. So the other thing is maturity. The language itself, and you know, like frameworks around it are maturing and productivity. Because JavaScript is open standard, language itself is very OIS and the platform independent. Also, there are big, vast third party libraries around. So what this mean? I think you probably got it. So actually, it probably very likely means that you actually take less time to bring, introduce your product, introduce your products to market. So it all sounds very good and JavaScript sounds so good. But then we have to bear in mind that JavaScript is actually scripting language. So we see it running in Vibe on the end server, back end server thanks to Node.js. But then in IoT, you know, in IoT, there are a lot, you know, heavily embedded devices. So how do you have a JavaScript running like a, with a constraint device, which has a, you know, very limited CPU memory and the resources? So yeah, this is diagram actually, so like the thing, it could be like 2KB, which is pretty minimum. Obviously, it can go high end like 1 gig. But most of them will seem like 32KB, 64KB or something like that. So we, here comes the ultra light JS engine, Jerry scripted by Samsung. So the name of Jerry actually came from Tom Jerry. So we're thinking like a, you know, very smart, fast. Yeah. So Jerry script basically focus on devices, which actually memory size from 32KB to 256KB. So, I mean, because you're thinking that you're having a JavaScript engine running it, you do need a reasonable memory size. But this, this actually, this engine is really ultra light at this moment, because the RAM says, obviously, as we said, it can probably look at the 32 to 64, this is the minimum. And then Rome may look at 200KB. Also, we actually have this binary compiled for ARM sum two, which is around 160KB. And actually, actually further reduced to 140KB at this moment. So we mentioned that initially developed from a scratch by Samsung in 2014. And in 2016, it's actually transferred to JS foundation. How many of you are aware of JS foundation? That's great. Yes. Under JS, JS foundation will have about this moment of 31 project. So all JavaScript project. So we do recommend if you're just a developer, go there and have a look. You might find something really interesting. From an IoT point of view, I would say like, no, the red is quite, it's quite a relevant good tool. So at this moment, I mean, the engine is very self-contained, it's very portable. And API is very mature. So you can have the engine run on its own. But the API from the engine is the C API. So what's next is for JavaScript developers, they want JavaScript APIs directly. So here we have, oh, yes, sorry, I haven't finished. So, yes, optimization of performance has been very top priorities. And their new features keep on going. And the community really in the last few years, it just develops so fast. Rather than, you know, not only the Samsung developers are being active, also have like a committers from Intel. So this actually means that a lot more OS and board, you know, physical hardware support. So this is a list of the hardware we can find, you can find the initial supporting code on GitHub. And the product. So this is a Fitbit, Ionic smart watcher, which actually released last year, which more significantly to JavaScript is actually using JavaScript as a platform for development. Yes, now come back to IoT platforms. There are two main platforms. One is IoTJS, which actually very, very closely coped with JavaScript because this one is also developed by Samsung. And the hardware support of SCOS is very much in line. And the main thought, the main philosophy behind IoT.js is basically do a small version of the JS. So when the team developed actually trying to make a small, make a small also backward compatible with Node.js, which means that a lot of code you're using IoTJS API developed, you can run in Node.js environment without any modification. We're assuming that the modules also, you know, you're supporting. So the other one is the Zephyr.js by Intel. This is very tailored to the vendor actually. So it's tailored on the Intel Zephyr OS. And also the physical board support is also quite a limited number. And the philosophy, as we said, also similar. We want to be portable between this embedded IoTJS platform to Node.js. So let's have a look at JavaScript on smart gateway. In our case, we use the things gateway from Mozilla project. So Mozilla actually has a things cloud, which actually basically just try to make a gateway collaborate in different geographic area work together. And we have things framework. I think later when we talk about web things APIs, you probably have a better idea. And then we have a gateway. So this is the architecture for gateway. So initially the protocol for gateway was actually based on Node.js. And later they actually introduced the concept adapter, which is a language adapter. So it's a support for Rust and other languages. So at the backend, as we mentioned earlier, it's actually based on Node.js. The gateway basically actually claims that there's some good security and authorization authentication scheme. But they have the feature basically like we do have HTTPS. So backward tunnel using PageCAD and the OAuth framework. Then for authentication, so JSON token is actually this method is used. Obviously you have other choices. So now we introduce you to Jerry script. Introduce you to Mozilla gateway. Let's put it together. I see a simple demo. So this demo I used in one of my talk last in July. But I think it's such a good simple demo actually presented pretty much covered the framework and the technology talk today. So I'll just give a quick talk on this. So on the demo, we basically have a Raspberry Pi 0 running Rustbian and no, Rustbian Jerry script, IOTJS. And then we actually have this blink T light. So it's actually an array of eight IOEDs, very bright light. It's actually a Raspberry Pi hat. So you can have on the GPL pins. So the gateway itself actually provided add-on. So basically we should detect audio input. So what we have is we basically program the blink T light as a web thing using the web thing API proposed by Mozilla IOT team. So there is some similarity with this web thing API with W3C API to have a check. And so this one we have this web thing, we program blink T as a web thing, which actually is recognized and can communicate with things gateway. So in things gateway, we actually also configure a rule. Basically what the rule is very simple, they provide this UI. So which means they actually, what you do is you can configure rules between add-ons and things. So the add-on basically is club hands add-on. So our rule is when you club hands, and then you turn the thing on off. So next one actually is a video, I'm not going to show it today because they're very exciting, let them later. So if you're interested, do go to our do-to-act, I actually upload this into YouTube. You can also check from my slide anyway. Look at, let's look at how it works. From the Raspberry Pi side, we have Raspn, Javascript, LT.js, because the blink T light is talking to GPL pins, so I need to have a GPL module built in. So this actually, I need to mention that LT.js actually provides quite a few building modules and extension modules. So building modules also quite a similarity, try to follow the line, Node.js is doing like an event file of these modules. And then we have WebSync IoT.js. This is the base code to support WebSync APIs in IoT.js environment. So this one, I think Phil is going to talk a lot more details on it. And on the top way, we actually programmed this thing. So yeah, that's it. I would like to hand it to Phil talk to you more about WebSync's API. Thanks. So here it is. So this is my smart home in the box. And this is a WebSync Modular dashboard where you have all the devices connected. So there is a couple of sensors and actuator. So here I can decide to turn on the light to change the color because there are different properties. So every thing, hey, we missed something. I didn't explain the source code. So we only have 10 minutes. So let me back to the code. I wish to make the demonstration just after. Xeron, where is your screen? I need to go back to the presentation. Sorry for the confusion. So yeah, what are WebSync's? Basically, they're HTTP server. No more complicated than that. And they're all connected to the gateway using REST API. So it's not a peer-to-peer model where we have different things talking together. Every thing is decided by the gateway. And there are different ontology, but it's quite simple. This is basically just properties describing different things. They are using JSON description, and it's following a schema, which is a specification on proposal at W3C. And you can implement it in a different language, but we are in the JavaScript room, so it's JavaScript time. So I made a fork of the actual Node.js module made to build the WebSync, but I simplified it to make it running on IoT.js, which is similar to Node.js, but with less advanced features. You have only ECMAScript, the 5.1 support, so you need to transpile and eventually adapt. A couple of features have been removed, but the basics are working the same. So that's the cool thing is that if you deploy using IoT.js on Linux and you want to deploy to microcontroller, this is actually the same code. Only the engine is changing, of course. So if you want to do IoT, you have support for all kind of input output and some connectivity feature like HTTP, HTTPS, and a couple of other modules like WebSocket, which is quite interesting for real-time. And yeah, M2TT and so on. So if you want to implement it, I tried to make it as short as possible, so maybe you will not compile, but you get the idea. So the thing is defined by a name. So here is some sensor. Then I create a server and I assign this thing to a server and then I can just open a request on my hostname and I get the description of the thing. So what we have here is a thing without any properties. So not very useful, but you can, from the gateway, you can add it by IP and then it will display a widget on your screen. So the next step is adding a property. So here is a simple one. I made a color sensor. So a color is in the web domain described as a string. So when we create the property, so here I'm in everything property. So this is not modern JavaScript, but it's quite simple because it's only two lines. So I assign a value to my property, which is the color. Here it's black. And I need to add some semantics to describe this is matching the color property model in the schema from Mozilla. And obviously it's read only value because you cannot change the sensor value. Okay. And then we should make a request to the hostname. You have the description of the property and you have a different endpoint. So let's go on. Now, so this is the same example I tried to make it smaller. So if we are creating this sensor, this property is reflecting the value of a sensor object. We can be a simulator of a real sensor. We have just an event function, which is on reading, which is updating the value by this notify exception, external update. And then from the UI, you have the matching color which is updated. So if we make the request explicitly from command nine on a different endpoint, I have a G zone describing the color. So it's no more complicated than this. I'm pretty sure you are doing more advanced JavaScript development, but you can run this on the microcontroller. So let's go now back to the demonstration. Okay. So yeah, what I explained yesterday, just before. And here are the sensors, the value, and the smartness is in this tool, which can be useful to create some logic between different elements. So for instance, I created one, let's say, oh, it's quite difficult to control the, so let's say I'm using input to my temperatures and so I'm not using unity, so I'm a bit lost. And I can decide to connect to, let's say, my light over here and say that if the property of the temperature is above the threshold, let's say, I'm sorry because I didn't, if above, let's say 10 degrees, then there is some event going. So something I can show also is that on my dashboard, I have also made something which is not real high-o-t, but I made a, what is it, a mastodon actuator. So everyone knows the difference between the sensor and the actuator. That's simple. The sensor is reading a value and the actuator is doing an action. So the one I created here is something that just sends something to the mastodon network. So I conference them and it will be updated in a couple of seconds. There it is. So let's say the use case I have with this flower is when my flower is out of water, I'm sending a notification to my neighbor that it should water my flower because when I'm speaking on conference, I could not care of it. And I also shared what I cannot show you more. Yeah, I have also some sensor here which is not connected to my home, but it's in my city. So where it is, do you see an air quality sensor? Okay, four. So this is a level of, okay, five is up. Let's go. So yeah, I'm here, you know, and I have a sensor which is measuring the air quality. So where is it? Well, it is somewhere. And anyway, the value, okay, I will find it by clicking. But if you have any questions, you can prepare them now. Okay, here it is. So here is my home under the lake. So the value is four. And I should find it again here. So you can imagine all kinds of use case of interaction between devices staying in your home and things on the internet. And everything is possible. It's flexible. So sorry, I'm out of time. If you have any questions, feel free to ask here on the outside on IRC in the Mozilla IoT channel. Thank you very much.