2019-05-01_Linux_Format

(singke) #1

38 LXF249May 2019 3334May 20195AP4i15


Open source smart home


esidesbeingabletotellyouyourIPaddress,
MycroftcomeswithadefaultsetofSkills
whichenableittoanswervocalquestionssuch
as:“Whattimeitis?”,“What’smylocation?”“What’s
theweatherlike?”or“WhatisthecapitalofAssyria?”.
Strangely,despitetheAssyriankingdombeingnomore,
thelatterquestionwastheonlyoneitgotrightonour
firstattempt–apparentlyMycroftisnotversedin
MontyPython.ThesefailingswereduetotheWolfram
Alphafallbackskillguessingourlocationandtimezone
fromourIPaddress,specificallyourlocalonebeginning
192,whichbelongstonooneandnowherebutwhich

forsomereasonMycroftresolvestoNewYork.This
convenientlyderivedthetimetobefivehoursinthe
pastforus.Youcanchangeyourlocationbysetting
yourlocationinyourMycroftHomeprofile.Youcan
alsochooseausernamefromhere,tomakeloggingin
tothewebportaleasier.
Mycroft’scoreskillsalsoincludeabasicHelloWorld
example,whichrespondstoitstitle;“howareyou”;
and,rathergraciously,“thankyou”.Thisisintendedto
introducepeopletoprogrammingtheirownskills.For
funandgamestryaskingittosingasongortellajoke.
Youcanalsoaskithowtospellwords,totelljokesorto
checkstockprices.

OneofthemostpopularskillsforMycroftisopenHAB
(HomeAutomationBus),whichisaplatformfortalking
toallkindsofhomeappliancesunderaunifiedweb
interface.Itcancommunicatewithamultitudeof
differentdevices,includingothersmart-homeplatforms
suchasNest.Third-partyadd-onscanbeaddedviathe
EclipseMarketplace,whichaswe’llseelaterenablesus
tocontroltheHivesmartthermostat,asusedbyBritish
GasintheUK.

creaturesofhaBit
You can install the openHAB server on your Picroft
server or on a different machine. There’s a pre-rolled
image called openHABian that you can run on a
different Pi: check it out at http://bit.ly/lxf249hab.
On Ubuntu, or any Debian-like Linux, start by adding
the required GPG key and repo, as follows. To make
things easier, you can copy and paste this text from
http://bit.ly/lxf249hab2:
$ wget -qO - ‘https://bintray.com/user/downloadSu
bjectPublicKey?username=openhab’ | sudo apt-key
add -
$ echo ‘deb https://dl.bintray.com/openhab/apt-
repo2 stable main’ | sudo tee /etc/apt/sources.list.d/
openhab2.list
Next update the package lists and install openHAB:
$ sudo apt update
$ sudo apt install openhab2
You may also wish to install the openhab2-addons
package, but add-ons can always be installed
individually as needed from the openHAB web interface.
Instructions for other distros and unstable releases can
be found at http://bit.ly/lxf249hab2. Start openHAB
and check that it’s alive with
$ sudo systemctl start openhab2
$ systemctl status openhab2

Java is a harsh mistress
If that didn’t work it could be due to your system
missing a Java runtime. This is exactly what happened
to us on our overburdened Picroft host, and we
remedied it with:
$ sudo apt install oracle-java8-jdk
$ sudo systemctl start openhab2
We were then able to connect to the web interface
by pointing our browser to http://192.168.0.23:8080
(admittedly, it took a couple of minutes). You’ll want to
change the part before 8080 to your openHAB host’s
IP address. Some initial configuration is required,
but the wizard will walk you through it. Before you
get really stuck in, do check out the thorough
documentation at http://www.openhab.org to troubleshoot
any niggles or find out more about the project – it’s
well worth a read.

WebrieflyconnectedMycrofttoLXFTowers’notoriouslydecrepit central


heating via openHAB, but facilities manager Dave took a dim view of that...


ensmartening your home


B


Mycroft knows its
onions, as well as
its capital cities of
fallen kingdoms.

controlYour home devices


“One of the most popular skills for


Mycroft is openHAB, a platform for


talking to all kinds of home appliances


under a unified web interface”

Free download pdf