Less noise, more data. Get the biggest data report on software developer careers in South Africa.

Dev Report mobile

Programmable Banking Community: Jörg's Smart Home Device Extension

26 November 2020, by Ben Blaine

Every week, we run a meetup for the Investec Programmable Banking community. Developers demo cool projects they've been working on and everyone has the chance to ask questions. If you've been wondering where programmable banking is at, here's your sneak peek!

In this demo, Jörg Wunderlich shares the “quick and dirty” experiment he tried to get his Investec account to interact with physical devices, including a smart home using HomeBridge, Node.js, MQTT and HomeKit.

Click here to download Jörg’s presentation slide deck.

Repo and installation instructions coming soon!

Transcript of the demo

Jörg [00:01]

Cool, it's something that I call Investec @ Home. I was in the process of working on a smart home solution for my home, and I thought, I've got all these different puzzle pieces lying around so let's see if I can repackage that, make some use of it and, get my bank account to talk to it somehow.

Jörg [00:31]

It started as a really quick fun project built to tie a few things together. What I did is I've got a little system, using HomeBridge, NodeJS scripts on MQTT as the messaging between the components and then HomeKit that is the iOS app that allows you to control the active devices. From an architecture perspective, that's pretty much the picture, and best describes what the architecture is like. It is a bunch of independent pieces put together with a little bit of electricity in it, and then it's just doing a few things.

Jörg [01:16]

There's nothing elegant about this, it's just a quick and dirty hack, but the components, as I said, it's HomeBridge, which is a virtual bridge. It is an open-source tool that allows you to pretend to have physical devices. It acts as an abstraction layer between the different components so you can build just about any device control that can talk to your Apple with the HomeKit environment.

Jörg [01:51]

I'm using an MQTT broker in the cloud called Shiftr.io and I'll show you a little bit what that looks like. That's the central communication between the different pieces, and then I wrote a little NodeJS script that doesn't need many dependencies that become the glue between Investec and my MQTT environment. The last bit that you need is a working iOs or MacOs device. That's pretty much the basics.

Jörg [02:27]

How does it work? HomeBridge is running in a Docker container on my machine. In a real environment, you would want that probably on a Raspberry Pi, but it's just something to play around with, and it acts as a bridge between a HomeKit and any non-native computer devices.

Jörg [02:47]

I've got a small NodeJS script that acts as the authoriser. I fire off-web requests from Investec to that little NodeJS script, and that becomes the glue between Investec and my smart home devices. Then HomeBridge authorises the script, they both subscribe to g.t broker in the cloud, they emit messages, and they subscribe to certain messages, and that's how they communicate. That is what I've done on HomeKit.

Jörg [03:21]

I've registered my Investec card as a virtual door lock, and that allows me to lock and unlock the door of my Investec card with Siri – and just about everything in the HomeKit stack.

Jörg [03:38]

Cool. How it works is the Investec card can be unlocked or locked through the HomeKit. I can tell Siri to do that. Now, hopefully, I can show you that in the demo in a few seconds and it could be any other device that could do the same.

Jörg [03:57]

You could have a Raspberry Pi script that locks the card or unlocks it for you. It could be a real button – it could be just about any device that is capable of speaking MQTT. HomeBridge sends a message to the MQTT broker, and we've got that little NodeJS script that subscribes to those messages, and it would then update its state internally.

Jörg [04:23]

After the card has been locked, it sends a confirmation back to the broker, which then notifies HomeKit. That's it in a nutshell.

Jörg [04:34]

What that looks like is this. Let me fire up a little script. One second. Okay. That's my little Node script running in the background. Again, there is nothing that is moving that script it's started in the command line.

Jörg [04:52]

Then I've got my little HomeKit environment here so I can lock the card and we go back to our programmable banking. If I simulate a transaction now, then it should fail. Let's see. Yeah. You can see the actions failed, but if I unlock that card quickly – just one second – “Siri unlock my Investec card”, and if we try to run it again now, we should see that it's unlocked. Yes, there you go.

Jörg [05:36]

One thing to have a look at – which is quite nice to see – is this MQTT broker in the cloud. What I can show you quickly is, these are messages that are being sent between the different parts of the system. If I lock the card again, now you can see, our messages are running down this communication channel and reaching the Investec device.

Jörg [06:01]

That's pretty much a quick demo. The idea was to get something up and running within 20 minutes or half an hour. What can you do with this or where can you go from here?

Jörg [06:21]

This particular thing is a HomeKit on implementation, but it could be anything, it could be Google Home, Alexa, it could be MQTT if you replace that HomeBridge with something else, for example, a home assistant or open hub, and nothing stops you from implementing different accessories.

Jörg [06:38]

I've used the door lock to be able to lock and unlock my door, but you could use sensors to, for example, read an account balance or read your spending in a specific category and the nice thing is you could tie it into seasonal automation.

Jörg [06:53]

I could tell my Investec card to be locked at night when I'm at home – it's things like that and obviously, what you're trying to do, eventually, is perhaps break out into the real world and try to control physical devices.

Jörg [07:07]

This is actually where the whole idea started originally – which was before the APIs were available. The idea for me was actually to open it a little Lego cookie jar on payday as soon as my salary comes in but yeah, unfortunately, I'm not quite there yet. That's probably something that I'll do another day when I get bored.

Jörg [07:31]

The idea was to show you something different. It's not as a scalable product, and it's not meant as something with a long lifetime. The idea is to inspire you maybe to build something different, and maybe to break out into the real world working with real physical devices. That's it in a nutshell.

Ben [08:00]

Thanks, Jörg, I like that you thought about just getting something working very quickly. I mean, I like that way of thinking. I think as a dev community, sometimes people can get focused on the technical kind of scalability of the thing and forget, maybe to implement something that changes their behaviour.

Ben [08:26]

The point of this whole thing is to code your own bank experience to change your behaviour. It's like the dev's approach to behavioural banking. So yeah, it's pretty cool. Have you been using this so far, or do you still need to work a little bit more to make it usable?

Jörg [08:47]

I think, Ben, the idea for me was to have fun with it. For me, to have the ability to hack something with a banking infrastructure on the back-end, that to me was quite an exciting thought. The idea wasn't really to create something useful but to see if it's something that could be done. Yeah, so I'll probably take it a little bit further, but not necessarily in the current shape or form.

Jörg [09:14]

I think it would be more valuable and there are many different approaches to get the same thing done, but I think the beauty of it was, within 20 minutes, you could have Siri locking, or unlocking your cards. It was just playing around with and having fun with it, to be honest.

Ben [09:36]

And are there any other kind of use cases that you've got in mind that might take a bit longer than you think you might have thought about?

Jörg [09:46]

Well, not necessarily in this context, and not for this particular application. Where to start – I'm busy planning a small term at the moment, so I'd like to keep that in there in some shape or form, but obviously in a more scalable and a properly structured approach.

Jörg [10:09]

The idea is really to do things like that, and be able to lock my cards down at night, for example, simply because if I'm at the house, and you know, nobody should be able to use that. I'll probably give it a proper real-world use case, but I don't think it's necessarily something that will be extremely valuable. It was just for me to kind of have some fun with it.

Ben [10:33]

Yeah. I wonder if anyone in the audience has questions or ideas that this is sparking? Otherwise, I will get my demo on. I haven't practised my demo yet but thanks, Jörg, that's awesome.

Programmable-Banking-Community--Jo-rg-s-Smart-Home-Device-Extension_Inner-Article-Image

Jörg is currently a Managing Partner at tryfetch, and describes himself as a bit of an entrepreneur, a bit of an artist but most of all, a first-class geek with a passion for technology and innovation. An open-minded German engineer, he is enjoying life in South Africa as a “start-up guy, rapid application development guru, jedi and ninja” ...


Get involved in the Programmable Banking Community

If you’re not part of our community yet, sign up and join the fun. You can also see more of the demos from our meetups on our YouTube channel here.

For those of you in the community, check out our GitLab to see more of the awesome projects members of our community are working on. You can also sign up for challenges, where you can help find solutions for real life problems.

For more information, get in touch!

Recent posts

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.