Using the Postman to fetch data from a Swagger Site

We’re using The Things Network to get data from our PAX (passenger) counters. We have Things Network application that receives Lora messages from our counters and we’ve added a data storage integration to hold the data from the counters. We’re not doing much with the data at the moment, but today I thought I’d try and get it out of the Things Network data store sot that I could play with it.

I was thinking that I might have to write a little application to make the request that fetches the data but it turns out that it is actually very easy to use The Postman to fetch the data for me. The Postman is a program that posts web requests and gets the result back for you. It’s great for testing and also for performing quick web requests when you can’t be bothered to write a program to do it. Which is what I’m doing.

If you ever need to do this too it’s actually quite easy. Just open up the integration from your application on the Things Network as shown above. Press the Authorize button in the top right and copy the application key from the application into the dialog that appears so that you can authenticate requests to the Swagger api. Then find the query that you want to run. Iin this case it is the query one you can see on the screenshot above.

Now scroll down to reveal more of the query settings. I’ve set the parameter to get the last 7 days of data. The Things Network only hold the data for 7 days, so this will fetch all of the data. If you hit the “Try it out” button the query runs and you will see the data appear in the browser. That’s fine, but it is very hard to do much with the data in a web page like this.

To use Postman you just have to copy some of the elements from the sample curl query generated by the web page into a new Postman GET behaviour. As you can see below I’ve set the url for the GET request to the Request URL above and added two header values to the request. These give the output format and the authorisation key.

When you click the Send button the request is sent and you can then save the response in a file. You can save the query for later use. Postman and swagger are a couple of technologies that it is worth learning a bit about.

Super secure wallet

A while back I went into a clothes shop and bought something that fitted me perfectly. It was a wallet. It was half price, but since my old wallet had reached the point where my money might start escaping of its own accord, I thought it was a bargain.

It was sold as super secure because it uses special material to stop radio signals getting at the cards inside it. The idea is to stop sneaky people tapping into your bank balance by the use of portable contact-less card readers.

It works too. Last week I was trying to open en electronic lock and it didn’t work. I usually just wave my wallet at the door and it opens, but with the card in my super secure new wallet this failed to work.

I’m now pondering on whether super security is worth a loss of convenience….

Stupid Train Tickets

Every now and then I do something that I (but probably nobody else) think is rather clever. Like using both cores of an ESP32 so that a display keeps running when the WiFi is used to updated it.

And every now and then I do something that everybody thinks is rather stupid. Like last week. A while back I subscribed to an alert to tell me about the release of cheap train tickets. I wanted to get a day trip to London which would cost less than a flight abroad.

So today when I woke up and checked my phone I was pleased to see an alert that I could order some tickets at a massive discount. Mindful of the fact that lots of other people had received this message and there would only be a few seats as these prices I booked my trip and paid for it in double quick time. Clever me.

However, any feeling of smugness evaporated when I discovered that rather than buying day returns from Hull to London I had in fact booked day returns from London to Hull. Idiot me. I put my mistake down to the early hour and undue haste. The tickets are non refundable, and must be used with an, ahem, senior railcard, However, if you are old, live in London and have a desire to spend a day in Hull then it is just possible that I could sort you out.

iPod Classic Blast from the Past

I got out my old iPod Classic today. It still works, and it is still only half full.

And it is the only way that I can listen to some of my music. For example, take the album “Futurenow” from Go West. Good stuff. I bought it ages ago.

Unfortunately I didn’t actually “buy” it though. I got it from Apple iTunes, loaded a copy onto my iPod and got on with my life.

And then, for some reason, the licencing arrangements seem to have changed. Although Apple Music thinks I’ve got the album it presently only provides access to two tracks. Very annoying.

I can probably do a music match thing to add the missing music to my collection, but to do that I need to have the original files. And they are presently on my iPod and nowhere else. Very annoying. I’ve been looking at sneaky software that can pull the music files off an iPod, but so far I’ve not found anything that is guaranteed to work. Oh well.

Fixing browser problems after Windows 10 Upgrade

I finally got the latest Windows 10 feature update on my PC today. I like it. The improvements to the downloads folder are worth the price of admission alone. You now get to see your more recent downloads (the one that you actually care about) instantly, rather than having to wait for the folder contents to laboriously update.

The only problem for me was that the upgrade broke my browser, which started complaining about network problems. I did a bit of searching and in the end I fixed this by turning off the “Automatically detect settings” option in the Proxy configuration above, which you can find in the Network Settings for your machine.

Top Five Finish in the Humber Care Tech Challenge

This was our work area. Keith is posing with a rather nice multimeter. We had the camera in the middle of the table and cupboard (full of sweets), kettle (borrowed jug) and sink (we had everything but the kitchen sink it turned out). The tracking could tell which of the locations you were standing at, and also when you were moving. You can see a horrible, but mercifully short, video of it mostly working here. When the outline flashes white it means that the person has been detected at a location.

Once we had something working it was time to make a presentation in the event that we made “top five” and had to present to the finalist judges. We put together a quick bit of PowerPoint and then dropped it onto my elderly (but still working fine) Surface Pro 3 ready for use.

Turns out we were picked first to present, which was great fun. We didn’t win though, which is not surprising when we saw what the other four teams had been doing. Some lovely presentations, some great ideas and huge chunks of enthusiasm. The winner has a fantastic solution to the issue of “sunsetting”. The great thing about the solution is that the path to deployment is well established and so I’m really looking forward to seeing it go out there. If you’re interested in my horrible code and presentation you can find them on GitHub here. I’m going to have a go at replicating the behaviour using an ESP32 camera.

I’ve put some pictures on Flickr here. They include the all important “firework” shot of the winners getting their richly deserved prize:

Huge thanks to the team for organising another excellent event.

Day 1 of the Humber Care Tech Challenge

..the tech challenge spaceship is landing…

The Humber Care Tech challenge is becoming a highlight of the year for me. I hope they have one next year. The idea is simple enough: Take a problem faced by healthcare professionals and then turn a bunch of techy folks loose to make things better. This year the theme is patients with Alzheimer and related conditions.

The scope of the problem was nicely illustrated by the range of ideas that have emerged. There are 14 teams here today working away and all of them are working on different aspects of the condition, from creating apps to help carers, to helping with shopping, to building reminiscence systems.

Keith and I are working on a system that tries to track the user performing simple processes. The one we’ve chosen is making a cup of tea. We’ve boiled this down (see what I did there?) to movement between a number of fixed kitchen locations (kettle, sink, cupboard etc) and our application will profile the activity in terms of movement between those locations. Once we have observed sufficient repeats of the activity we can detect changes and also detect when someone is having a bad day.

We are starting with my awesome OpenMV camera with a view to migrating to the ultra-cheap ESP32 Webcams and maybe even a thermal camera.

The Open MV environment is wonderful. I’ve not done much image processing before and this is a perfect way to get started. You write the code in Python and then push it into the camera which then runs it. The library is comprehensive and very easy to use. And it runs really quickly.

I’m trying to keep the algorithm silly simple so that it can be made to run on very constrained devices. Essentially I’m using the camera as a glorified PIR sensor. I’m not very proud of the code that I’ve written, but I’m rather proud of the fact that it seems to work.

Bolt Mystery Solved

Yesterday I went to a wedding and found a bolt in my trouser pocket. Very strange. Today I remembered why. The last time I wore my suit was at a Humber Care Tech Challenge communications event near the Humber Bridge. Because it was supposed to be posh the suit came out. Then, on the way back I stopped off to buy some bolts for holding air quality sensors to lamp posts. The one in my pocket was the pattern that I took along to make sure that I get ones that match.

M5Stack and M5Stick

I’ve had a soft spot for the m5stack devices ever since I found them on AliExpress a while ago. They are really well packaged ESP32 based devices with high standards of production and design and a wealth of different add-ons and configurations. I’m on their mailing list and every week they seem to put out something interesting, whether it is a butterfly launcher or a fingerprint sensor. Their prices are at pocket money level for the most part and you can program their devices using Arduino C++, Python or a rather neat system called UIFlow which is block based but actually ends up being Python code.

This is the M5STack unit playing a game of scissors, paper, rock. It’s called an M5Stack because the base unit is 5cm in size. The stack bit is there because units and interfaces can be stacked together.

The M5Stack bit is the unit at the top with the LCD panel and three buttons. This unit is fitted into an M5Stack Faces unit which provides exchangeable face plates. The one shown is the keyboard, but there is also a calculator keyboard and a Gameboy faceplate too which comes into its own when you load up the NES emulator and play some games.

This is the M5Stick. It is even smaller than the stack and has a tiny colour LCD screen (which is presently showing Flappy Bird in play. It has fewer interfaces (although I’ve managed to connect an environmental sensor to it) and just one proper button to press.

Up until now if you wanted some M5Stack goodness you had to buy them from AliExpress, wait for them to arrive and sometimes pay import duty and VAT and sometimes not.

But this week I received an email from Cool Components telling me that they were now stocking M5 products. They are a bit more expensive than buying the devices directly from China, but they do arrive next day and you don’t get any nasty surprises with the price.

If you’re looking for a pleasing device with a lot of flexibility you should take a look at these.