1
00:00:00,690 --> 00:00:07,140
Let's have a look at a more comprehensive example now that involves a 22 workflow that you're seeing

2
00:00:07,140 --> 00:00:13,380
here on the floor that you're seeing here, it's disabled at the moment, but I want to publish the

3
00:00:13,620 --> 00:00:20,070
sensor readings to the broker and then get them from the broadcast, subscribe to the program and update

4
00:00:20,340 --> 00:00:24,340
a dashboard or two dashboard widgets with the data we get.

5
00:00:24,750 --> 00:00:32,220
So the first thing I'll do is to enable the flow that these two example flow.

6
00:00:32,460 --> 00:00:38,240
And I'm going to start see around here to set up my publisher.

7
00:00:39,330 --> 00:00:47,160
What I want to do is I want to publish the humidity and Timika values when the DHT 22 generates those

8
00:00:47,160 --> 00:00:47,760
values.

9
00:00:48,180 --> 00:00:51,240
So I'm going to use a complete.

10
00:00:52,250 --> 00:01:00,500
No, so that when this operation here is completed, this note triggers and then it will trigger the

11
00:01:00,500 --> 00:01:03,540
publication of the values for humidity and temperature.

12
00:01:03,800 --> 00:01:04,440
So bear with me.

13
00:01:04,440 --> 00:01:05,410
You'll see what I mean.

14
00:01:05,830 --> 00:01:13,670
I was doing some experimentation a bit earlier and discovered that the DHT 22 note does not emit completion

15
00:01:13,670 --> 00:01:14,260
messages.

16
00:01:14,690 --> 00:01:20,780
So my complete note will not be able to know when this particular note is done is finished.

17
00:01:21,230 --> 00:01:23,630
So I had to use one of these other notes in the function.

18
00:01:23,630 --> 00:01:24,740
Note does work.

19
00:01:24,770 --> 00:01:26,150
So here's what we do.

20
00:01:26,270 --> 00:01:27,110
We go inside.

21
00:01:27,110 --> 00:01:34,760
The complete note will say that I want the complete note to start when the function note up here is

22
00:01:34,910 --> 00:01:35,570
finished.

23
00:01:38,100 --> 00:01:46,740
And I can see that it's selected and I can go ahead and set up its other properties or this only one,

24
00:01:46,770 --> 00:01:53,050
the name property, I give it a name, start when he keeps the history.

25
00:01:53,070 --> 00:01:59,380
Twenty two has new values or something like that will do.

26
00:02:00,120 --> 00:02:03,150
Now what I want to do is to publish

27
00:02:05,580 --> 00:02:06,550
two values.

28
00:02:06,570 --> 00:02:11,970
One is going to be the temperature and the other one is going to be the humidity.

29
00:02:11,980 --> 00:02:14,700
So I'm going to configure those to first.

30
00:02:15,300 --> 00:02:17,100
For the first one is going to be the temperature.

31
00:02:17,100 --> 00:02:22,520
I'm just going to copy some work that I've already done to avoid typos and speed things up a little.

32
00:02:22,890 --> 00:02:24,350
And this is going to be the topic.

33
00:02:24,360 --> 00:02:26,400
So diggity 20 to temperature.

34
00:02:26,670 --> 00:02:34,380
And I want to this to happen using the and quiddity Broca that is on the same Raspberry Pi note read.

35
00:02:37,210 --> 00:02:39,530
For is just leave it a zero.

36
00:02:39,700 --> 00:02:42,910
So that's one, let's do the other immediately out.

37
00:02:46,010 --> 00:02:55,310
The second one is about the humidity, so I give it a name, it's going to publish to this topic and

38
00:02:55,310 --> 00:02:59,390
again, I'm using the client and cure is zero.

39
00:03:00,590 --> 00:03:08,780
Now, the thing is that the 22 actually, I should look at this function here because remember that

40
00:03:08,930 --> 00:03:17,030
the message from this function on completion, which is this will go into into this note, the complete

41
00:03:17,030 --> 00:03:23,770
note, and then it will pass out to whatever note happens to follow.

42
00:03:24,200 --> 00:03:30,350
The problem here is that the immediately out nodes can only grab whatever you've put in the message

43
00:03:30,350 --> 00:03:35,720
payload and then the message payload here contains just this.

44
00:03:35,720 --> 00:03:42,560
Whatever is coming from the age of 22, which if you remember back in the lecture, we looked at the

45
00:03:42,950 --> 00:03:47,650
22 example, the message contains the humidity and the payload.

46
00:03:47,660 --> 00:03:54,400
So unfortunately, I can't grab those individual components from the liquidity.

47
00:03:54,470 --> 00:03:57,140
Eric notes that don't give me this capability.

48
00:03:57,140 --> 00:04:03,650
So I will need to use another function in order to split the two pieces of information into individual

49
00:04:03,650 --> 00:04:04,940
message payloads.

50
00:04:05,600 --> 00:04:06,430
So let's do that.

51
00:04:06,440 --> 00:04:10,310
I'm going to delete those connections and go for a function.

52
00:04:11,680 --> 00:04:22,690
Note and pass the message from the complete note to the function node now inside the function node in

53
00:04:22,690 --> 00:04:22,930
it.

54
00:04:23,530 --> 00:04:24,760
First, I'm going to give it a name.

55
00:04:25,750 --> 00:04:27,290
This is published Temperature and Humidity.

56
00:04:28,180 --> 00:04:34,090
Now for the JavaScript in here, this is all that we need to do.

57
00:04:34,480 --> 00:04:38,200
I've got a an array inside the array.

58
00:04:38,200 --> 00:04:45,520
I've got two very simple chasten documents and each one contains a payload and then the appropriate

59
00:04:45,520 --> 00:04:47,460
payload message.

60
00:04:47,470 --> 00:04:54,190
The payload coming from DHV 22 contains the temperature and then message that humidity contains the

61
00:04:54,190 --> 00:04:54,910
humidity.

62
00:04:55,300 --> 00:04:58,910
And I need to increase my output to two for this function node.

63
00:04:59,290 --> 00:05:05,250
So this is going to go into the top output and this one into the bottom output.

64
00:05:06,430 --> 00:05:06,910
Right.

65
00:05:06,910 --> 00:05:13,840
And now I can do the connections to this one and there is the other.

66
00:05:15,100 --> 00:05:17,030
And that should be enough.

67
00:05:17,050 --> 00:05:24,250
Now, what I'll do to test, because I don't have anything to subscribe to these two topics at the moment

68
00:05:24,250 --> 00:05:24,880
in this flow.

69
00:05:24,890 --> 00:05:25,620
Do that later.

70
00:05:26,080 --> 00:05:36,040
But to test it, I'm going to use my existing and quiddity client in my box so I will delete.

71
00:05:37,440 --> 00:05:44,190
These two don't need them to clean up the available space that I have and I'm going to add two subscribers,

72
00:05:45,030 --> 00:05:48,780
the first subscriber is for the temperature.

73
00:05:50,900 --> 00:05:51,680
Copy that.

74
00:05:52,370 --> 00:05:54,070
Let's make a little bit of space here.

75
00:05:55,230 --> 00:06:04,770
All right, little space, and this is a subscriber to this topic, and let's do one more for the community.

76
00:06:06,120 --> 00:06:09,150
Subscribe to this topic.

77
00:06:09,510 --> 00:06:10,080
All right.

78
00:06:14,460 --> 00:06:15,550
So I started work.

79
00:06:19,550 --> 00:06:21,290
Let's deploy.

80
00:06:22,940 --> 00:06:31,390
That aside, and for this to work and to trigger the DHT 20 to the trigger, and there are.

81
00:06:33,060 --> 00:06:36,180
The message is coming through temperature and humidity.

82
00:06:51,100 --> 00:06:57,260
All right, now let's move on to the next lecture where I'll show you how to use the N.

83
00:06:57,630 --> 00:07:06,430
T in notes to grab the information that we just published to the two topics and initially print them

84
00:07:06,430 --> 00:07:08,040
out to a debugged.

85
00:07:08,050 --> 00:07:14,440
We need to make sure that either work or to a debug note, make sure that the work and then we use dashboard

86
00:07:14,440 --> 00:07:14,950
widgets.
