A (76:31)
All right. Okay, Very cool. I have got a quick demo. Let's see if I can get the screen share working here. So. Yeah, there we go. See if I can make this all a little bit bigger. Well, that side's bigger. We'll do this one at a time, I suppose. So if you recall, we've got Grafana running and we've got a Mosquito install running and I have here where we are subscribed to Mosquito and we're just watching for everything there. And I was asking myself what would be a good MQTT source to play with and of course I went with meshtastic because you know, it's kind of. It's kind of the project that I'm invested into right now. So if you don't know, we've got meshtastic D which runs a real meshtastic instance on a native Linux machine. So go ahead and start that up. Getting that set up is not the thing that I'm necessarily going to talk about, although we are going to talk real quickly about how to set up mqtt. So there is the Mustastic command line terminal and we got to tell it host local host and then we can just say. Set the MQTT address to 127.0.0.1 local host. Of course it does stuff on the left hand side and we do that. And then we're also going to come in here and grab the next line which is to set it to enabled enabled. True. And then the other thing that we have to do is tell it to enable Bullet for channel. It is a little bit fiddly and meshtastic to get this done, but it's usually not too bad once you get. Once you know the trick, once you understand what all you have to set. So we have set MQTT to localhost, we have enabled it and then we've set the uplink and the downlink for channel zero. And in theory we may have to give it a quick reboot but in theory that should get things moving. We can do a dash dash, get MQTT to see how it's set. Enable true 127001 and of course, the username and password is just the. The default that it ships with. And nothing yet. This is a live demo. So of course there is the possibility that this isn't going to work. It's always possible. Let's see. Fourteen seconds ago, that should have. Yeah, let's try giving this a dash dash reboot. Sometimes things need a reboot for it to become live. Hold on, we'll get it. We'll get there. I know I'm crazy for doing this live. All right. MQTT connected on a private IP subscribe to. That's where it's going to go to 2e short fast. We can refresh that. Give it a second. Wait for real packets to come through. Hey, look, we've got real packets. There we go. Now, you may notice that over here in our MQTT window, these packets are just. They're gobbledygook. They're garbled. Actually what it is, they're encrypted. And this is something that you do a lot with mqtt. You will run a second command to basically translate it, picks it up off of one MQTT topic and then puts it back on another. And there is a tool that we're in the process of writing that does this for meshtastic MQTT packets. So we're gonna get this going real quick. So I've pulled it down. Git clone. I'm gonna use PIP to install the requirements. We are gonna hope that this works. It may PIP command not found. Yeah, give it a second. Literally doing this live here. So we'll see if it's going to let us do it. Yeah. All right. It went through and it installed. Now we should be able to run a Python command that will connect to the local MQTT server. This is what it looks like Python 3. And then it runs the script messtastic protobuf to JSON script. We're going to tell it regional us. That's where I'm at. The broker 127001. That's the local thing. The PSK, the AQ equals, equals. That's the default. No password. And then we have debug turned on. Let's see what it does. All right. It thinks it's connected. It says it's subscribed to Mesh us to JSON. Let's wait for another packet to come through. And we'll see what happens. The waiting is the worst part. Got one of these machines set to send a packet every 30 seconds. There we go. All right, now check this out. So we have first the encrypted packet up here, gobbledygook. And then we have in JSON a decrypted packet. This is on a second MQTT topic. All right, now do we have time? I think we have time. I think we have time to look at the next step real briefly. Let's flip over to the actual Grafana tab. And so this is basically where we were last time. We've got the MQTT connection there, but not doing anything with it. And we're on a new dashboard. We can add a visualization. So we're going to add. We're going to say use the MQTT data source. And over here under topic, we're just going to give it an asterisk for now, or excuse me, not asterisk. Pound sign. Pound sign for the moment. And in theory, here in bit, this will get a packet. Sometimes Grafana is a little slow about this anyway. But what we're going to do is we're going to go into transformations. This is how we take it from just that raw text string to something that we can actually use in Grafana. And the first one is, I think it's just, yeah, extract fields. We're just going to do extract fields. This lets us take JSON, which is one of the options, and it'll pull all of these fields out for us so that we can look at it and see what is in there. We are pulling a little bit of data you can see on the one panel. But this is just ID and timestamp and to and from a channel. Not really what we're interested in. So this will. This will get us better data. So source. It's now it's seen something and it's actually payload is what we want. Now we're getting somewhere. Because now up here in our preview, we've got not only the channel and the time and the id, we also have uptime seconds and free MEM bytes. This is the telemetry that we were looking for, that we want to actually look at. And I can add another transformation and there's all kinds of these transformations inside of Grafana. I am looking for one of the filters. Filter field by name. That's the one. So I don't want the id, I don't want the value. We can keep the timestamp. I don't need the one. Oh, we need time, we don't need timestamp, we don't need to. We don't need from. We don't need channel or sender or type. But we do want to keep these, the uptime seconds, the free mem bytes disk, free bytes to load. And in fact if you wanted to you could actually click go in even closer and say all I want is those three. Then we could say save. That's fine. Now again, so this is something with Grafana doing MQTT again we come back to no data and inside Grafana Using this DirectMQTT connector, it is completely ephemeral, meaning it doesn't save this data at all. All that it's doing is it's taking it directly off MQTT and throwing it into the browser. And so if we sit here long enough we'll get these data points. And so it's doing something really interesting here. It's actually pulling from two different machines. It's why it's going to look really weird. Really what we would want to do is go in here to edit and under transform we're going to want to add yet another transformation to. It's another filter. I believe it's filter data by values. Yes. See if I can get this going real quick. And we want this to happen further up here. Let me have to zoom out. Grafana does not super like being that far zoomed in. So we're going to include. We'll add a condition the field in this case we'll grab sender and then is equal to. And I don't even know off the top of my head which one we want to grab. You know there's a. The different sender values and we could probably pull it up real quick. Yeah, here's one. I'll grab it off of the command line terminal that we've got. We say that one. There we go. So now we are looking at fewer of these and you know, it takes some fiddling. I'm not going to get this. It took me about an hour I think on the desktop behind me to get this really dialed in the way that I wanted it. But you eventually get to a really nice bit of data that you can pull just from MQTT and you see again we're getting more data here. It looks like we're that that filtering probably needs more fine tuning. So it's probably not sender, it's probably from. That's probably what it is. So again we'll save and apply. This will probably make more sense. Grafana is like this though, until you really get good at it. You gotta, you gotta fiddle with it and try it and play with it. To take this and to really take it to the next step, if you want to make it more useful, would be instead of just doing a direct pull with that MQTT connector, you would actually, you would use a time domain database is what they call it. And that's where, you know, you take one of these things off of MQTT and you put it in a database and then you pull it out of the database to make your, your visualization rather than just going straight from MQTT onto a, a dashboard here. But that is basically how Grafana works. And hopefully I didn't try to stuff too much into each of these. It's been really cool for me to sort of step through and figure out how these things plug in together and. Yeah, maybe, maybe next week I'll fine tune this at the end of the show next week, I'll show you exactly what it can look like once, once everything is put together the right way. It's fun though. All right.