Thing part 2
Transcript
English (Auto-generated)
OK. Um So this is the code that is being uploaded into the Raber Pi. What this code does is that it retrieves the data that is sent from the youtube and then we upload it onto the Things Spot platform. So this code is supposed to be run on the ra very P after the you know, it is connected to the Raspberry Pi and that we've already locked on into things for platform. So here we have the libraries that we are, we will need to import. We have made use of the serial library here to initialize our serial connection between the Geno and the Raspberry Pi. So over here we have uh extract data function where we deconstruct the data that we have received um from the no because they are split um by the comments, we use the line split to split them and then we restructure them into this data dictionary format. So from here on we have um make use of the code being um from the IOT lab book. So here we have our things board host, which is the things board URL as well as our access token. Um What this part of the code does is that it connects our things brought through MQQT. So um it begins by defining the server host address here as well as the SS token for authentication, which we will use over here. And then we also have a few callback functions um on publish, which confirms a successful message, publication. And then we also have the on messages which locks incoming messages. And we also have the on connect callback function which prints the connection result code. So we use um MQQT client object and um we will use this script to connect to sys spot and then register the callback and then subscribe to a topic to receive the remote procedure, call commands. And then at the end, we here have a loop so that we can handle incoming and outgoing messages asynchronously. So here is our try um in this tri section, we have extracted the data from our genome and then we have um published it into our things board um using JSON format. Yes. Um And then here real quick is just our things for dashboard. So this bottom line chart, it's just a line chart um that shows the temperature and humidity um for each time stamp. So you can see it in a chart fashion. Um And then this is a more of a data data section where you can see the humidity and temperature for for each time stamp. And then you can also see watering status here. Um And so as earlier, as I mentioned earlier, um when the watering status is one that means that the, the motor is on and then when the water is watering status is zero, that would mean that the motor is off. So that is our things board dashboard.