1
00:00:00,270 --> 00:00:06,090
In this lecture, we are going to implement the necessary functionality in the note read flow so that

2
00:00:06,090 --> 00:00:11,000
we can get the which it is necessary to calibrate the pump a threshold.

3
00:00:11,490 --> 00:00:14,610
And I've already created the new components of the flow.

4
00:00:14,640 --> 00:00:20,720
You are updated version through the integration for and it's this part of the flow here.

5
00:00:20,730 --> 00:00:23,280
This is the new part of the flow.

6
00:00:23,670 --> 00:00:26,520
But what I'll do is I'm going to delete.

7
00:00:27,590 --> 00:00:35,480
The flow, our vision for and then continue from Vision three, just make sure that there are no missing

8
00:00:35,480 --> 00:00:37,970
bits and pieces in the way that I implement it.

9
00:00:38,240 --> 00:00:46,420
So I'm going to start first by exporting vision through which the current flow situation for version

10
00:00:46,430 --> 00:00:47,150
three of the flow.

11
00:00:47,870 --> 00:00:52,010
Copy that to the clipboard and go back into the burger menu.

12
00:00:52,010 --> 00:00:56,820
Choose import, paste the chasten file.

13
00:00:56,960 --> 00:00:59,300
Select new flow and import.

14
00:01:00,970 --> 00:01:06,770
Right now, I'm going to do a rename as soon as the notification gets out of the way, rename this into

15
00:01:06,830 --> 00:01:07,660
a version for.

16
00:01:10,460 --> 00:01:12,640
Right, and enable it.

17
00:01:13,320 --> 00:01:15,380
Click, click on the enable button.

18
00:01:16,070 --> 00:01:20,360
All right, so I want to add the new part of this movie down here.

19
00:01:20,360 --> 00:01:21,710
We can call it a Lou.

20
00:01:22,120 --> 00:01:23,750
I'm going to make a little bit of room.

21
00:01:25,160 --> 00:01:34,940
They did down there and of course, the first thing that I'm going to add is this the numerical import

22
00:01:34,940 --> 00:01:38,570
widget, this note here, this implements the widget.

23
00:01:39,560 --> 00:01:46,170
And in it, what I want to do is to set the range of values that this widget would allow us to select.

24
00:01:46,190 --> 00:01:54,050
So because we are talking about analog input, that is Timbits in a number of bits, we've got a range

25
00:01:54,050 --> 00:01:55,970
of zero to one thousand and twenty three.

26
00:01:56,360 --> 00:01:59,450
And it's going to be tedious to change your values.

27
00:01:59,570 --> 00:02:01,570
If you want, I'll make it 10.

28
00:02:02,320 --> 00:02:04,310
I'm going to give it an appropriate name.

29
00:02:04,340 --> 00:02:12,110
Let's call this threshold and call the name of the node as well.

30
00:02:12,110 --> 00:02:13,150
Pump Threshold's.

31
00:02:13,190 --> 00:02:15,920
That's the label that will appear in the dashboard.

32
00:02:16,750 --> 00:02:20,540
Also going to set up tooltip think this is useful.

33
00:02:20,960 --> 00:02:34,170
I say that this sets a row limit, the value of which is turned on.

34
00:02:34,190 --> 00:02:36,500
So lets you hover your mouse over the widget.

35
00:02:36,500 --> 00:02:44,530
You'll see this message for information for the user and the position of this node widget.

36
00:02:44,540 --> 00:02:46,460
I'm going to put it into a new group.

37
00:02:49,310 --> 00:02:53,180
Which belongs in the terrorism tab, and I will call this group.

38
00:02:56,530 --> 00:03:02,430
The threshold should be a bit more specific to set the threshold.

39
00:03:09,160 --> 00:03:11,200
OK, with six is enough.

40
00:03:12,340 --> 00:03:19,300
All right, so let's make let's give this a width of six and the rest is all good.

41
00:03:19,490 --> 00:03:24,800
So I'm going to click on Done and there's this note.

42
00:03:24,820 --> 00:03:27,370
This first note implemented.

43
00:03:28,150 --> 00:03:32,170
Then what I want to do is whatever the user selects.

44
00:03:32,230 --> 00:03:41,290
This has to go into a flow variable because we will need to take that into account in our pump operation

45
00:03:41,290 --> 00:03:46,370
function when the function is making a decision here of whether to start the pump or not.

46
00:03:46,400 --> 00:03:48,670
So at the moment, this is a fixed five hundred.

47
00:03:48,940 --> 00:03:55,810
But once we have the ability to set arbitrary threshold instead of 500, we will need to use the actual

48
00:03:55,960 --> 00:03:57,400
threshold that the user has said.

49
00:03:57,400 --> 00:04:00,030
So we'll replace that with a flow variable.

50
00:04:00,310 --> 00:04:06,310
And while I'm here, I'm just going to set it right now or change make the necessary change right now.

51
00:04:06,550 --> 00:04:20,080
And what I want to do is to get a flow, get the value stored in flow variable with name, soil humidity

52
00:04:21,460 --> 00:04:22,300
threshold.

53
00:04:24,410 --> 00:04:31,630
OK, like this, so no fixed value or get the life soil humidity threshold from this low.

54
00:04:32,220 --> 00:04:33,240
OK, this is good.

55
00:04:33,830 --> 00:04:41,030
Close the dialogue and let's continue now with another function.

56
00:04:41,630 --> 00:04:46,630
We to put a new function here so that we can actually set the threshold.

57
00:04:46,640 --> 00:04:50,420
So I'm going to go in here.

58
00:04:51,470 --> 00:04:52,880
I'm just going to copy the code.

59
00:04:52,970 --> 00:04:54,840
So don't type it and make typos.

60
00:04:55,100 --> 00:05:01,370
This is going to be the flow set function, which sets the flow variable.

61
00:05:01,460 --> 00:05:07,130
So you're committed to a threshold with whatever value has been passed to the function node from the

62
00:05:07,130 --> 00:05:10,700
pump threshold, numerical input node.

63
00:05:11,180 --> 00:05:14,670
And we don't really care too much about what is return to serve.

64
00:05:15,650 --> 00:05:16,910
I'm just going to return message.

65
00:05:16,910 --> 00:05:22,880
But just to be good actually with this and consistent, I'm just going to return the message paillard

66
00:05:23,420 --> 00:05:29,240
actually I'm going to return the whole message this fine so that we can set something useful after this

67
00:05:29,240 --> 00:05:32,480
note, such as a debug node for the name.

68
00:05:34,030 --> 00:05:35,790
Can you call these things cept.

69
00:05:37,740 --> 00:05:40,260
Humidity know.

70
00:05:41,440 --> 00:05:43,360
Humidity threshold, to be more specific

71
00:05:47,370 --> 00:05:48,020
like this.

72
00:05:49,640 --> 00:05:56,840
And click, OK, now, the next thing that I want to do here is to use an empty outmoded.

73
00:06:00,140 --> 00:06:08,870
This one here, so that any value that the user sets for the threshold is sent to the ISP 32 controller

74
00:06:09,290 --> 00:06:11,080
via the security broker.

75
00:06:11,750 --> 00:06:20,030
The next thing that I want to do here is to use it and get it out nood so that when the user changes

76
00:06:20,030 --> 00:06:29,360
the threshold in the red dashboard, this information is sent to the speaker to via the broker, so

77
00:06:29,360 --> 00:06:37,820
that the sketch running on the ESB 32 can take this arbitrary value into account when it sends an update

78
00:06:37,820 --> 00:06:38,680
to the flow.

79
00:06:39,050 --> 00:06:44,940
And I'm going to show you the necessary change that we need to make in the USA to sketch in the next

80
00:06:44,940 --> 00:06:48,090
election so that it can read this number and use it.

81
00:06:48,620 --> 00:06:55,580
So for now, I'm going to configure the integrity out node and give it a name first.

82
00:06:57,430 --> 00:07:03,960
And now we are going to create a new topic, the liquidity broker, which is going to beat this.

83
00:07:03,970 --> 00:07:12,220
So the soil humidity threshold, as usual, let's go for quality of service zero and click on Turn Connect

84
00:07:12,220 --> 00:07:13,170
these two together.

85
00:07:13,190 --> 00:07:21,220
And we could also welcome here here to put in a new debug node so that we can see.

86
00:07:22,860 --> 00:07:26,330
I said, I'm tired of you.

87
00:07:30,080 --> 00:07:34,700
It should be concise, the current humidity.

88
00:07:40,810 --> 00:07:41,620
Threshold.

89
00:07:43,350 --> 00:07:52,730
Right back in here in the threshold node, I think just make sure that everything is correct here.

90
00:07:52,760 --> 00:07:54,280
Yup, everything looks good.

91
00:07:54,740 --> 00:07:57,250
Now I can publish this flow.

92
00:07:58,630 --> 00:08:00,290
And check it out here.

93
00:08:00,550 --> 00:08:06,370
Here's a new group, you can see that here's a widget that allows me to change and set the threshold.

94
00:08:07,030 --> 00:08:11,810
But the problem here is that it starts at zero.

95
00:08:11,830 --> 00:08:20,530
So obviously now for me to set this widget to five hundred, I have to keep clicking on the up arrow

96
00:08:20,770 --> 00:08:23,200
and just not a very good user interface.

97
00:08:23,500 --> 00:08:26,290
And I'm just going to refresh and can feed staes.

98
00:08:26,290 --> 00:08:32,440
But if I restart the whole note read service, this is going to go back to zero and I'm going to retain

99
00:08:32,440 --> 00:08:33,090
its value.

100
00:08:33,430 --> 00:08:37,720
So before I actually marked these modifications as complete, there's one more thing that I need to

101
00:08:37,720 --> 00:08:46,770
do, and that is to use and inject node to inject a initial value into the threshold node.

102
00:08:47,320 --> 00:08:53,770
So let's go inside here inside the inject to give it a name first.

103
00:08:54,250 --> 00:09:02,200
Let's say set the default threshold and this is going to be a number.

104
00:09:03,220 --> 00:09:07,800
And let's start with five hundred our values, a reasonable first number.

105
00:09:08,170 --> 00:09:13,690
And then because I want this to actually happen without me having to click on this button to enable

106
00:09:13,690 --> 00:09:20,980
it just connected to right now I have to actually triggered by clicking on this button here, but I

107
00:09:20,980 --> 00:09:29,350
want this number to be injected into the threshold node pretty much as soon as I deploy or I start this

108
00:09:29,350 --> 00:09:29,890
flow.

109
00:09:30,280 --> 00:09:35,770
So I'm going to go down here and click on inject once after, let's say, zero point four.

110
00:09:35,770 --> 00:09:38,410
Make it one second just to begin with.

111
00:09:38,680 --> 00:09:39,570
And that's it.

112
00:09:39,580 --> 00:09:43,240
We only need to inject it once and then we have done with this.

113
00:09:43,960 --> 00:09:50,350
So check this out if I'm going to make this a little bit more delay to demonstrate how this works or

114
00:09:50,350 --> 00:09:52,340
make that five seconds.

115
00:09:52,870 --> 00:09:57,970
So what I'll do is I'm going to deploy this flow and have a look at what happens to this number right

116
00:09:57,970 --> 00:10:00,120
here about five seconds later.

117
00:10:00,730 --> 00:10:04,360
So deploy and see.

118
00:10:07,420 --> 00:10:07,990
There you go.

119
00:10:08,410 --> 00:10:13,370
So now it's set automatically to a much better value of five hundred.

120
00:10:14,050 --> 00:10:15,250
All right, so this works.

121
00:10:15,250 --> 00:10:24,350
So I will change this with five point one seconds after we deploy the flow.

122
00:10:24,910 --> 00:10:27,550
This value will be reset.

123
00:10:28,990 --> 00:10:31,210
OK, so that's about it.

124
00:10:31,210 --> 00:10:36,340
With the modifications necessary in the flow itself to give us the widget.

125
00:10:36,940 --> 00:10:45,250
One last thing I'll do here is actually change the positioning of the groups so that.

126
00:10:47,520 --> 00:10:54,340
The threshold set books is closer to the left side are the way I see it, is for the user interface

127
00:10:54,340 --> 00:10:58,870
components that require input or offer input options to the user.

128
00:10:58,870 --> 00:11:02,920
Go to the left and then the rest of the readings go into the right side.

129
00:11:03,340 --> 00:11:09,450
So let's move this say up here and redeploy, OK?

130
00:11:09,530 --> 00:11:11,980
And it's better the flow works now.

131
00:11:11,980 --> 00:11:13,150
We can actually test it.

132
00:11:13,180 --> 00:11:15,000
I'll turn on the power supply.

133
00:11:18,190 --> 00:11:20,200
And let's set.

134
00:11:21,710 --> 00:11:26,660
The threshold to say six hundred and.

135
00:11:28,220 --> 00:11:29,300
Try to increase.

136
00:11:30,350 --> 00:11:31,040
The humidity.

137
00:11:37,710 --> 00:11:38,830
And it works.

138
00:11:39,770 --> 00:11:42,350
For turn it down a little, said to.

139
00:11:46,160 --> 00:11:48,080
Five seventy.

140
00:11:50,170 --> 00:11:54,250
We need to actually trigger the function by changing the name.

141
00:11:54,910 --> 00:12:02,050
She did not pick it up automatically, that just because on the flow, the value is said to below the

142
00:12:02,050 --> 00:12:02,990
needle value.

143
00:12:03,010 --> 00:12:09,520
So the threshold value is below the needle value unless I trigger the function to work this function

144
00:12:09,520 --> 00:12:14,270
to work, which only happens after it gets input from the security broker.

145
00:12:14,500 --> 00:12:18,940
We are not going to get any decisions about the pump state.

146
00:12:20,170 --> 00:12:21,730
So this is a normal operation.

147
00:12:22,000 --> 00:12:27,410
OK, so it works, but I still love the game.

148
00:12:27,430 --> 00:12:34,810
But I also want to make a small change in the history theory to sketch so that this new threshold value

149
00:12:35,050 --> 00:12:42,880
is taken into account by the EPA to show that it does not sent any updates to the flow which would trigger

150
00:12:42,880 --> 00:12:51,820
the function here unless the soil humidity threshold from the sensor is above the threshold.
