1
00:00:00,180 --> 00:00:08,810
In the previous lecture, we implemented a new feature in the new Drechsler, which involves this threshold

2
00:00:08,850 --> 00:00:14,990
setting budget, which allow us to manually set the threshold above which would like the pump to begin,

3
00:00:15,690 --> 00:00:24,630
and that involved adding a bunch of nodes, including one that sends the set value for the threshold

4
00:00:24,840 --> 00:00:27,570
to the ESB 32 via this topic right here.

5
00:00:28,230 --> 00:00:36,540
So what we are going to do in this lecture is to make the necessary changes to the inability to sketch,

6
00:00:36,780 --> 00:00:38,380
which is now version three.

7
00:00:38,400 --> 00:00:47,280
This is a version that we are working on right now so that it can acquire this number from the topic

8
00:00:47,580 --> 00:00:53,430
and use it internally to decide when to send an update to the market Kitty.

9
00:00:53,730 --> 00:00:55,200
And therefore to the flow.

10
00:00:55,710 --> 00:01:00,390
So I've already implemented the changes here and I'm going to walk you through them.

11
00:01:01,020 --> 00:01:03,780
First of all, there's a new line here.

12
00:01:04,530 --> 00:01:12,180
We've got a new variable that holds the soil humidity threshold, which, as you can see, points to

13
00:01:12,360 --> 00:01:17,550
this topic, which is a topic that we are sending data from the floor.

14
00:01:17,560 --> 00:01:26,010
We send in the value for the threshold from the slow next year, the on connection established function

15
00:01:26,010 --> 00:01:30,090
of a new callback set for the threshold.

16
00:01:30,100 --> 00:01:39,360
So when the get soil humidity threshold topic has an update, then this function will fire and set the

17
00:01:39,360 --> 00:01:42,680
threshold to a local variable, which is.

18
00:01:46,440 --> 00:01:52,440
This variable here, which I've said I've got a present here to four hundred like its default value,

19
00:01:53,700 --> 00:01:58,560
so let's have a look at the callback function called set threshold.

20
00:02:01,520 --> 00:02:08,720
So here it is, Threshold will receive a string, which is the value coming from the topic, then will

21
00:02:08,720 --> 00:02:16,420
convert that string into an A. and story in the global community threshold.

22
00:02:16,970 --> 00:02:17,930
And that's about it.

23
00:02:17,960 --> 00:02:21,350
Now, the interesting thing happens right here in the report.

24
00:02:21,350 --> 00:02:29,120
So your community function in the previous version of this scourge, we only had this condition for

25
00:02:29,120 --> 00:02:36,980
the sketch to send an update or to publish the the new humidity from the sensor to the soil humidity

26
00:02:36,980 --> 00:02:37,490
topic.

27
00:02:37,940 --> 00:02:41,630
But now I'm also adding this condition.

28
00:02:41,660 --> 00:02:44,420
So this an and I'm also sending this condition here.

29
00:02:44,510 --> 00:02:51,350
So the reporting will take place also when the current humidity is larger than the soil humidity threshold,

30
00:02:51,560 --> 00:02:53,790
regardless of the range.

31
00:02:54,350 --> 00:03:00,320
So I thought this is important because this is going to allow us to to deal with said dry soil without

32
00:03:00,320 --> 00:03:05,110
having to worry about how much change there is between measurements.

33
00:03:05,150 --> 00:03:11,990
So as long as the current soil humidity as it was last measured is over the humidity threshold, then

34
00:03:11,990 --> 00:03:18,140
we'll send this information to the flow so that it can decide whether we need to pump more water into

35
00:03:18,140 --> 00:03:18,690
the soil.

36
00:03:19,100 --> 00:03:24,410
So that's about it with the modification to the sketch to give us the version three of the terrorism

37
00:03:24,410 --> 00:03:24,910
control.

38
00:03:25,430 --> 00:03:27,680
So that's one more lecture in this section.

39
00:03:27,680 --> 00:03:34,490
That's a next one where we'll do a quick test and demonstration of what we have so far to review and

40
00:03:34,490 --> 00:03:37,430
then do a preview of what we're going to do in the next section.
