Cloudflare TV

Kassian's IoT Hour

Presented by Kassian Rosner Wren
Originally aired on 

Let's dig into how you can use Serverless to supercharge your IoT projects! We'll walk through setting up a remote sensor and LED with Cloudflare Workers, Workers KV, and a Raspberry Pi.

English
Tutorials

Transcript (Beta)

Good afternoon everyone or morning or evening depending on where you are. I'm Kassian and welcome to the IoT Hour.

So lately we've been working on getting our 3Pi system to subscribe to events and respond to events so that we can send temperature data and all sorts of stuff across it and so today we're going to continue on that route and also probably work on some workers that will provide us with an IoT dashboard for it.

So let's get started. Share my screen.

And what we've got is Okay come on.

There we go. So I was looking at some time early stuff but we're not going to be working with that today.

What we were working on is IoT Hour.

Put all that together.

Now we need to ssh into pies.

You might need to be rebooted because my Internet went down earlier so I'm actually going to do that now.

This one.

This one. Reboot.

Okay.

Two.

Three.

Okay now we're sshed in.

Let's go into I think I have these mixed up.

Yes okay I did that one mixed up.

This one needs to be IoT push child. Okay now we can go over to our browser.

Okay that's working.

We're set up here. Okay and they're all getting their messages which is great.

Running so I need to make sure it lights up red right there.

Okay so the lights are out. Now let's take a look at what we've got code wise.

First let's look at the push child.

Let's try it over here.

Okay.

So this isn't the other.

Oh right this won't work.

Because I forgot the pi. Oh great.

Why can I not remember to save my life today? Okay. Okay.

Real easy this time. Okay.

I see we're working on IoT push sensor.

That's right.

Okay good it is getting the data.

Awesome. Good.

All right. Awesome. Awesome. Awesome. Okay so what we want to do now is we want to build a dashboard that runs off the parent.

So this one.

So we're going to create a folder under pi code called local dashboard.

Okay.

Okay.

So what we're going to do is we're going to close this and we're going to say forever.

Okay. Okay.

Okay. Okay.

Okay.

Okay.

Okay. Okay.

Okay. Okay.

What we're doing is we're running into a problem where this global is not people that's not going to click click either.

Um, there we go. Okay. Okay.

There we go.

Okay. So forever is running the server now so it's it's getting messages and listening to them.

And so what we want to do is create a local dashboard that can leverage this.

And so we're going to. Yes. Going to.

So. Okay. Okay.

Okay.

Here.

Here. Here. Here. Here. Okay.

Okay. Okay.

Let's.

Let's. Some. Libraries here.

He's a shortcut to kill me today.

Okay. Okay. Okay. Guys realize Okay.

Okay.

Okay.

Okay. Okay. And lastly, We're going to make some graphics.

Graphics. Graphics. Yes.

Okay.

Okay.

Okay.

Creating a react app.

Okay.

Okay.

Okay.

Okay.

Okay. Okay. Okay.

Okay.

Okay.

That's okay.

Okay.

Okay. Okay.

Okay. Okay.

Soon what we'll do is we'll look at some smart Wi Fi light bulbs and see about adding those into our little Set up.

I've got two here in my lamp and Okay.

Okay, cool.

We're all set up. Okay, fantastic.

Awesome.

Okay, so we've now got our Local dashboard here and then Yes. Again, No.

Save it.

Dashboard. Thank you. Thank you.

Thank you.

Thank you. Okay, so it's getting the changes that we're making.

Awesome. Awesome. All right. Okay.

Okay. Okay. Okay. Hmm.

Hmm. Hmm. Hmm. Hmm.

Okay.

Okay. Thanks for building a dashboard. I think a good place to start.

This is kind of start designing the dashboard. So let's get started.

Please drop here. Okay. Okay. Okay.

Okay.

Okay.

Okay.

Okay. Okay.

Okay. Okay. Okay.

Okay, so we've got an out bar. No, it doesn't. We shouldn't be in a container.

So let's go here. There we go.

Okay.

Okay.

Okay.

Okay.

Okay.

Okay.

Okay.

Okay. Okay.

Okay.

Okay.

Oh, right.

There we go.

Okay. All right, so now we've got our nav bar, we can get started on our rest of our stuff.

First, actually, what I want to do is I'm going to close this. Okay.

Push that up to GitHub.

Just so it's there. That way, if you're interested in seeing what we're doing.

So let's keep working.

Okay. Okay. So what we can do with this first is we can create some graphs to do the temperature data we can.

Before that, let's just get a square that will determine the latest temperature that was sent.

In order to do that, we need to have it save the last temperature that was sent.

So what we're going to do is we're going to go back to parent.

So if.

Okay. So first let's look at what the API might look like for an IoT that sends sensor data.

Right now it's just sending a number. But what we should do is change that to a type and a value object.

So first let's leave this blank for now. Let's go into first, we're going to want to go into IoT push sensor.

Okay. So we're actually going to want to send an object.

Okay. All right. Okay. Okay.

Okay.

Okay.

Okay. Okay.

Okay.

And then.

There we go. Make sure this is set up right, it is.

Now we're going to know. Yes. Now it's sending objects.

Yes. Yes. Yes. Yes. Yes. Yes.

Yes.

Okay. Oh.

Interesting.

Only string dates and buffers are accepted.

All right, so we have to. Okay. Okay.

Okay.

Okay.

We seem to be erroring out this time. Okay, cool.

We're getting the temperature data from the sensor. Awesome. So now we go back to our code editor.

And parents. Parents and. Okay. Properly.

Yes.

Okay, we're getting back the right information. Awesome. Now. There we go. Okay.

Okay.

Okay. Okay.

Okay.

Okay. Okay.

Okay. Awesome.

Thank you. Let's see what we get.

Okay.

Okay. Okay.

Okay. Okay. Awesome.

So. Cool. Okay. Let's see if we have that here.

Okay. Awesome. Awesome.

Okay.

Okay.

Okay. Okay. Okay. Okay.

Okay.

Okay.

Cool.

We're gonna do is make sure this works.

Yes. Okay. Okay.

Okay.

Okay. Okay.

Okay.

Okay.

Okay.

Okay. Okay. Okay.

Okay.

That's getting through.

That's getting through.

That's getting through. Okay. Let's do this.

Let's do this. Let's do this.

Let's do this.

Okay.

Five minutes remaining. All right. Well, here's what we're going to do for the next few.

We're going to continue saving.

Information to the database. And hopefully we'll be able to get information out of the database.

And then we'll start building our. IoT dashboard based on that data.

And what I'll do is I'll move the. I'll find my ITC temperature sensor again. And I will move the residue applies to different parts of the house.

And we'll start collecting temperature data off of them.

And. Other data. And we'll add, we'll add some switches and buttons.

To the dashboard that allow us to manipulate LEDs and things like that.

And then we'll set up a worker so that we can do this from like a web hook.

Clicking. If this than that. Or GitHub action or anything like that.

So that's the plan. To. Move forward. I'm going to write up. The plans. IOT hour.

Start writing. I don't see one. Okay. Okay.

Okay.

Okay.

Okay. Okay. We're making progress here. Okay. Yeah.

All right, cool. So this is what we've got. Hopefully you have a great day and I hope you enjoy the rest of public TV programming and I'll be back this time next week.

So I hope you have a wonderful day.

And I will see you soon. Okay.

Bye.