Creative ingenuity and the ability to cram a network stack into the smallest of things have gifted us, over the past few years, some pretty funky home innovations. Legacy (classical?) home dwellers may see little merit in upgrading to a Smart Home, but we have some uniquely Linux ideas that may persuade them.
Having a smart home needn’t mean having Alexa (the voice of Amazon’s Echo) eavesdropping on your every word. Nor does it mean the nameless entity within a Google Assistant reporting back to the mothership whenever you leave the bathroom light on. The Mycroft home assistant can do all the good bits of these voice devices but without the more chilling data-collection aspects. Best of all you can run Mycroft on a Raspberry Pi.
But there’s more to smart homes than shouting at small robots. As autumn makes its way to the UK (and other Northern hemisphere places), good citizens will be collectively donning long johns and firing up their boilers, heat pumps and sacrificial pyres. Some may find themselves having to shoulder the expense of a new boiler, others will want to see if their current one can be hacked and tweaked to make for a more economical winter. Through the magic of OpenHAB, we’ll show you how.
For many of us, the pandemic has seen our homes become unwitting extensions of the workplace and depending on your line of work that may be the case for some months to come. So we’ve got a couple of projects for smartening your home office setup, too. Recuse yourself from Zoom meetings and banish Google’s office suite with the open-source powerhouses Jitsi Meet and Collabora Online. And since Docker is all the rage, we’ll look at how we can harness its power better using the Portainer management engine. This will make it easy for you to add any service you can imagine to your self-hosted smart-home-office, so let’s get started!
A smart home office?
Take a look at some great tools that can make a smart home smart, and a home office, er, official.
To the cynic, all this new smartification of everyday items seems to involve putting networked computers in places where they’re not needed, and needing so many companion apps on one’s smartphone to keep tabs on all these smart things. In so doing, one opens all these devices (and possibly your phone too) up to attack.
Some manufacturers are better than others at keeping their IoT things secured, and many attacks could be prevented by users changing default credentials. Since 2016, Raspberry Pi’s no longer ship with the SSH service enabled because it’s too easy to spot them when they’re exposed to the Internet.
But there’s a lot of smart home projects that are fun, safe, and will bring some degree of joy to your home. Lots of these are variations on standard Pi maker projects, we really liked for example Elio Struyf’s project documented at www.eliostruyf.com/diybuilding-busy-light-show-microsoft-teams-presence. This uses an LED array as a status indicator for outside your home office.
The pandemic has gotten lots of us quite used to videoconferencing, and with that comes the terrible fear of children (or grown-up children) interrupting your work chatter. Perhaps a brightly coloured warning light, that in this case hooks in to your Microsoft Teams account (it could be easily adapted to other services) to see if your status is “busy”.
Home security systems are all the rage too. Again, the Raspberry Pi is excellent at this, you could adapt our Motion tutorial from LXF266 to set this up, rather than going with an off the shelf product. Besides security concerns, such products could at any point stop being supported by the manufacturer, which effectively makes them useless. This very thing happened when Google bought Nest back in 2014. Then last year they announced they were shutting down the Works With Nest program, effectively bricking all the legacy Nest hardware that wasn’t produced by Google.
In theory this could happen with open source projects too, but if it does, then at least the code is all there for someone else to take the reigns.
Hot smart stuff
Utility companies are keen for everyone to have smart meters now, and these go in tandem with smart boilers, smart thermostats, smart fridges. In theory these can save you money, and it’s certainly satisfying being able to pre-warm your house as you travel home.
We’ll show you how you can connect all of these together through openHAB, the open-source Home Automation Bus. No smart home would be complete without a Voice Assistant, so we’ll revisit our old friend Mycroft over the page.
We’re also embracing Docker this issue so we’ll look at using that to smarten up your home office setup, using the Nextcloud cloud productivity suite. Then we’ve got some tips on containing this container overload with Portainer, which is a management engine used to constrain your container overload!
We’ll also show you how to set up your very own video conferencing service with Jitsi Meet. It’s going to be an action-packed few pages, so get yourself a cup of tea and enjoy!
OpenHAB and Mycroft
Use the power of Ubuntu’s openHAB appliance and the Mycroft Voice Assistant to voice-enable your home.
The open Home Automation Bus (openHAB) can connect all the diverse IoT appliances that may or may not be beginning to proliferate around your home. Typically these devices all have their own, often proprietary applications, but often under the bonnet they use open source protocols – and when they don’t, people have figured them out enough to plug them into openHAB. We’ve covered installing it (and indeed Mycroft over the page) back in LXF249, but this time around we’re going to do it a little differently because Canonical recently released the openHAB Ubuntu Appliance for the Raspberry Pi. This means we can write their SD card image, boot it and have a fully functional web-based home automation server.
In order to use these Ubuntu Appliances (there are currently four others besides openHAB, and more are on the way), you’ll need to sign up for Ubuntu SSO (Single Sign-On) at https://login.ubuntu.com. It’s free and you can use it all over the Ubuntu web ecosystem. Once you’ve done this you’ll want to generate an SSH keypair and upload the public key, so that you can use your SSH-reinforced SSO to login to your appliance. You may already have generated an SSH key, in which case you probably don’t want to overwrite it. Check by running
$ ls ~/.ssh/id_rsa.pub
If no such file exists, generate it with
$ ssh-keygen -t rsa
and press Enter to accept the default location. Once the key is generated, run cat ~/.ssh/id_rsa.pub and copy the contents to the clipboard. Log into Ubuntu SSO and go to the SSH keys section. Paste the contents into the Public SSH Key box and hit the import button. You can now SSH into Ubuntu services and appliances (from this machine only) using this key. But we still need to log our appliance into Ubuntu’s cloud to fetch it, so follow the three steps below and do that.
Once setup is complete, take a note of your Pi’s IP address and connect to it from a browser by entering, for example, http://192.168.0.2:8080. The openHAB interface is a little confusing at first, especially given that the first step is ‘choose an interface’. You can always return to this index page to explore the others. Choose PaperUI and peruse what Bindings (in the Addons section) are available, and if any of them match your hardware.
From here, your best friend is the openHAB documentation at www.openhab.org/docs. You can customise your appliance however you like. It’s running Ubuntu Core so you can add Snaps from the repos. Instead of following our later section on Nextcloud, you can get a working install by SSHing into the appliance (the username is the first part of your Ubuntu SSO email) and running:
$ snap install nextcloud
Visit the Snapcraft store (https://snapcraft.io) and let us know how you augmented your appliance. Oh and do check out the others; currently Plex, Nextcloud, Mosquitto and AdGuard have been applianced, and more will surely follow.
You probably already know that Sherlock Holmes had an older brother called Mycroft – and that’s where the Mycroft Home Assistant gets its name. The Mark I device was a friendly, ET-looking voice assistant that was powered by a Raspberry Pi 3. We were big fans, but sadly that device is no longer available, and its successor has not yet been released. But that’s fine, because Mycroft’s brains (I think you mean OS – Ed) are open source, and you can run them right now on a Pi 3 or 4.
Visit http://bit.ly/LXF268openhab and download the image. It’s about 500MB but compressed. You’ll need to decompress it with xz -d openhab-core18pi.img.xz if you’re going to write it out manually with dd in the next step, but the official Raspberry Pi Imager program can do this for you.
2 Write the image to SD card
At least a 4GB card will be required, and possibly more if you go all out with extensions. On a Debian-based distro (including Ubuntu) you can download the Pi Imager from https://downloads. raspberrypi.org/imager and install it with dpkg -i or graphically with Gdebi. Use this to write out the image file.
3 Boot your Pi
Connect a monitor, keyboard and network cable (optional) to your Pi, insert the freshly minted card, and fire it up. You will see some configuration choices and eventually will be asked for your Ubuntu cloud email address (see above) so that the appliance can be authenticated against your SSH keys.
It’s based on the official Raspberry Pi Linux Buster image, and you can download it from https://github. com/MycroftAI/enclosure-picroft . Use the Raspberry Pi Imager again (or use something else if you like) to write the image to an SD card. This time you’ll need at least an 8GB card. When it’s done, put the SD card into the Pi and fire it up. As with the openHAB appliance, you’ll need a display and keyboard connected to the Pi to run the initial setup, but afterwards, these will not be needed unless something goes wrong. On first boot Picroft will resize its partition to use all available space on the SD card. When it finishes booting a second time, it will ask if you would like some help setting up your system, which you may as well accept.
You’ll need a microphone and speakers, and there’s a list of supported hardware at the Mycroft wiki (http:// bit.ly/LXF268picroft). Some of this will work out of the box, but some devices will need manual intervention. We used a Seeed Respeaker 4-microphone array HAT, which was easy to set up. Other devices will follow a similar pattern. Just run
$ git clone https://github.com/respeaker/seeedvoicecard.git
$ cd seeed-voicecard
$ sudo ./install.sh
If your network works (try rebooting if it doesn’t!) you could also SSH into your Pi to do this (the default username is ‘mycroft’ with password ‘pi’, which you should change soon).
Then, if you’re using the 3.5mm jack for audio, you may need to run sudo raspi-config, select ‘7. Advanced Options’, ‘A4 Audio’, and finally ‘1. Force 3.5mm jack’. Now reboot to enact the changes. If you run into difficulties with the Respeaker (or other Seeed models), the driver documentation is at https://github.com/ respeaker/speed-voice card.
You can read up to 3 premium stories before you subscribe to Magzter GOLD
Log in, if you are already a subscriber
Get unlimited access to thousands of curated premium stories, newspapers and 5,000+ magazines
READ THE ENTIRE ISSUE