Radu RendecThis is my blog. Use the information and content at your own risk. All opinions are personal. Please see the <a href="/page/disclaimer/">disclaimer</a> for details.http://rrendec.mindbit.ro/feed/2023-08-05T02:18:01+00:00DIY Home Automation focused on privacy<p>I started this project because I wanted to automate my home. But unlike many others, I am deeply concerned about privacy. And besides, I am a software engineer and an electronics enthusiast, and I always enjoy tinkering. So, I decided to take the matter into my own hands.</p>
<p>First and foremost, this is a hobby project. It does not aim to be perfect, easy to deploy and use or fit for every home. But it aims to be fun and respect privacy. And I decided to share it with the world. In fact, all source code and hardware designs are publicly available on GitHub (see below).</p>
<p>The project is in a state of flux. At the time of writing this blog post, I have been working on the project for more than 3 years, and it's nowhere near complete. It probably never will be because I have more ideas than time to implement them. I have a day job and a family, so I work on the project when I can. It is therefore work in progress, and will likely be for a long time.</p>
<h1>Design goals</h1>
<h2>Use only free open-source software (FOSS)</h2>
<p>Twenty or even ten years ago, it may have made sense to explain the power and benefits of FOSS. But today, I think it's very clear, and the internet is a living proof. Whoever doesn't get it is probably still stuck in the 20th century.</p>
<h2>Send absolutely nothing to the cloud (privacy first)</h2>
<p>In other words, what happens in my home stays in my home. This is extremely important in a digital era when everybody is after your data. Unfortunately, most people don't get it, and neither do they care to read the privacy policies for the services they use. Speaking of which, in most cases users waive pretty much all their rights and agree to have their privacy violated for free.</p>
<p>You may wonder why it matters if a random service provider knows when lights turn on and off in your home or what temperature your thermostat is set to, and furthermore if that data is disclosed to other third parties, intentionally or not. That data alone says something about your schedule and habits. But when it is correlated with other personal data, things get much worse.</p>
<p>And last but not least, voice command systems are likely the most dangerous. They <em>must</em> record permanently to be able to respond, because they can't know in advance when you talk to them. And, since most of the processing is done off premises, the recordings are in the hands of your provider, and you have no control over that. It is impossible to tell if they respect the privacy policy (which is way too permissive anyway), let alone fight them in court if there's any suspicion.</p>
<p>And I could go on for pages about why all of this is important, but I will leave that for a separate post.</p>
<h2>Use DIY hardware as much as possible and to a reasonable extent</h2>
<p>Proprietary hardware can be as bad as proprietary software, and pretty much for the same reasons.</p>
<p>Luckily, hardware is easier to confine than software. For example, a Zigbee device cannot leak any data to a third party simply because there is no communication channel to the outside. And that makes it acceptable to use a Zigbee device even if the hardware and firmware are not open.</p>
<p>Along the same lines, most WiFi based home automation devices and smart appliances inherently violate the privacy. Not because of how WiFi works (you can always block the communication in your router), but because they allow no local/direct control and depend on a cloud service and your internet connection to be controlled.</p>
<p>Most manufacturers don't get it, or at least they pretend they don't. We don't need their sketchy mobile app (which often is a privacy hazard just by itself) or their cloud service. The ease of use they offer comes with a very high toll on privacy. Remote control can be done safely and privately with FOSS, but requires extra work, which I am happy to do.</p>
<h1>Architecture</h1>
<p>As mentioned before, the project is in a state of flux. The diagram below shows the <em>current</em> architecture, in terms of both hardware and software.</p>
<p><img class="nb-align-center" src="http://rrendec.mindbit.ro/content/public/upload/home-automation_0_o.png" alt="Home Automation Architecture"></p>
<p>Legend:</p>
<ul>
<li>Yellow boxes represent standalone off-the-shelf hardware.</li>
<li>Gray boxes represent support hardware, either off-the-shelf or DYI.</li>
<li>Blue boxes represent third party FOSS.</li>
<li>Orange boxes represent personal FOSS.</li>
</ul>
<p>The "?" (question mark) box is essentially a home automation controller but it is not yet deployed, and I am still exploring multiple options. I am considering the following FOSS projects, likely in that order:</p>
<ul>
<li><a href="https://nodered.org/">Node-RED</a></li>
<li><a href="https://www.openhab.org/">openHAB</a></li>
<li><a href="https://www.home-assistant.io/">Home Assistant</a></li>
</ul>
<p>Even though it is not included in the architecture diagram, I am also considering voice control but this is particularly sensitive from a privacy perspective, since most solutions send the audio stream to the cloud for voice recognition and semantic interpretation.</p>
<p><a href="https://github.com/rhasspy/rhasspy">Rhasspy Voice Assistant</a> looks extremely promising. However, the project relies on other external projects for each of the main features (wake word, speech to text, intent recognition, text to speech), and with the multitude of choices for each feature, it is harder to make a decision. It will likely also influence the choice of home automation controller, even though all three projects listed above are readily supported.</p>
<p>The table below summarizes the software components and DIY projects that are currently part of the architecture.</p>
<table>
<thead>
<tr>
<th align="left">Project</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><a href="https://www.zigbee2mqtt.io/">Zigbee2MQTT</a></td>
<td align="left">Zigbee to MQTT bridge</td>
</tr>
<tr>
<td align="left"><a href="https://mosquitto.org/">Eclipse Mosquitto</a></td>
<td align="left">Message broker that implements the MQTT protocol</td>
</tr>
<tr>
<td align="left"><a href="https://www.memcached.org/">Memcached</a></td>
<td align="left">A distributed memory object caching system</td>
</tr>
<tr>
<td align="left"><a href="https://graphiteapp.org/">Graphite</a></td>
<td align="left">An enterprise-scale monitoring tool</td>
</tr>
<tr>
<td align="left"><a href="https://github.com/rrendec/yawd">yawd</a></td>
<td align="left">Collect and display local weather data</td>
</tr>
<tr>
<td align="left"><a href="https://github.com/rrendec/hvac-app">hvac-app</a></td>
<td align="left">HVAC controller - application software</td>
</tr>
<tr>
<td align="left"><a href="https://github.com/rrendec/hvac-eda">hvac-eda</a></td>
<td align="left">HVAC controller - hardware design</td>
</tr>
<tr>
<td align="left"><a href="https://github.com/rrendec/aqmon-app">aqmon-app</a></td>
<td align="left">DIY indoor air quality monitor - application software</td>
</tr>
<tr>
<td align="left"><a href="https://github.com/rrendec/aqmon-eda">aqmon-eda</a></td>
<td align="left">DIY indoor air quality monitor - hardware design</td>
</tr>
</tbody>
</table>
http://rrendec.mindbit.ro/post/diy-home-automation-focused-on-privacy/2023-08-05T02:18:01+00:00Custom udisks2 Packages<p>As described in an <a href="/post/udisks2-mount-path/">older post</a>, the mount point for automatically mounted volumes (by udisks2) changed, back in Fedora 17.</p>
<p>Custom udisks2 packages for Fedora that revert to the old mount point (<code>/media</code>) are now available in <a href="https://copr.fedorainfracloud.org/coprs/rrendec/desktop-overrides/">my copr repository</a>.</p>
http://rrendec.mindbit.ro/post/custom-udisks2-packages/2016-07-30T19:58:00+00:00GTK3 Legacy Behaviour<p>Starting with the very decision of discontinuing Gnome 2 and writing Gnome 3 from scratch, the Gnome developers have had a strange way of innovating. The early versions of Gnome 3 were barely customizable, with a lot of features that had matured and stabilized in previous versions being completely gone. Since that moment on, the developers have continued in the same manner, by radically changing or completely removing features, without any way of reverting to the old behaviour. They started making choices for their users, instead of letting the users choose by themselves. And they have been constantly insisting on this policy.</p>
<p>Luckily, users still have the choice of completely switching to a different desktop environment. Just like I did. As I had been using Gnome for a long time (and considered Gnome 2 a mature and robust desktop environment), the natural choice for me was <a href="http://mate-desktop.com/">MATE Desktop Environment</a>, which I have been consistently using ever since.</p>
<p>However, the GTK3 library suffers from the same obtuse policy of limiting users' freedom, and recently many important desktop applications (such as Firefox and LibreOffice) have switched to GTK3. For users like me who don't want their desktop to start behaving differently over the night, perhaps one of the most annoying things in recent GTK3 versions is the default behaviour of the file chooser. This article mentions some popular GTK3 problems and the solutions to fix them.</p>
<h1>Overlay Scroll Bars</h1>
<p>By default, scrollbars are now hidden and appear on-demand, when you hover the mouse over the scrollable area edge. The problem is that they are rendered <em>over</em> the scrollable area content, hiding some of it. If you prefer traditional scrollbars, you can switch back to the old behaviour by adding this to your <code>.bash_profile</code> file:</p>
<pre><code>export GTK_OVERLAY_SCROLLING=0
</code></pre>
<p>References:</p>
<ul>
<li><a href="https://bbs.archlinux.org/viewtopic.php?id=196118">https://bbs.archlinux.org/viewtopic.php?id=196118</a></li>
</ul>
<h1>Show Directories First in File Chooser</h1>
<p>By default, the GTK3 file chooser mixes directories and files in the list. If you're looking for a particular directory in the list, this makes it harder to find it. This can be easily changed by a configuration option:</p>
<pre><code>gsettings set org.gtk.Settings.FileChooser sort-directories-first true
</code></pre>
<p>If you prefer a GUI, there's <code>dconf-editor</code>, which allows you to browse to /org/gtk/Settings/FileChooser, see a list of available settings and their allowed values and change them as you like.</p>
<p>References:</p>
<ul>
<li><a href="https://ubuntuforums.org/showthread.php?t=2271508">https://ubuntuforums.org/showthread.php?t=2271508</a></li>
</ul>
<h1>File Chooser Typeahead Search</h1>
<p>In previous GTK versions, you used to be able to focus on any file/directory in the list, start typing, and this would jump to the matching file/directory in the <em>already loaded</em> list. In newer GTK3 versions this is no longer possible. Starting to type switches the list to recursive search results matching what you typed. If you have a large directory structure, this is not only very slow and resource consuming, but also completely useless - because you end up with a dozen of search results from not only the current directory but also subdirectories at any level, all mixed together in a flat list.</p>
<p>Unfortunately, at the time of writing this there is no setting for changing this behaviour and the only way to fix it is to patch GTK3 and recompile. The patch is available in a <a href="https://aur4.archlinux.org/packages/gtk3-typeahead/">custom ArchLinux package</a>. I also built some custom GTK 3.20.6 packages for Fedora (see below).</p>
<p>References:</p>
<ul>
<li><a href="https://bbs.archlinux.org/viewtopic.php?id=196459">https://bbs.archlinux.org/viewtopic.php?id=196459</a></li>
</ul>
<h1>File Chooser Single Click Selection</h1>
<p>In previous GTK versions, you used to have to double click on a file or directory in order to choose it. By "choose" I mean pick that file for open/save and close the file chooser. This is not to be confused with "select", which means just moving the focus on that file in the list.</p>
<p>In newer GTK3 versions this is no longer the case. The new behaviour is to use single click, but even that is not consistent:</p>
<ul>
<li>If the file/directory is already selected, then a single click will choose it as expected (or recurse into it, if it's a directory). If you double click on it (because you're used to the old behaviour), it will not be handled as a double click event. It will be handled as two single click events. The first one will choose the file/directory. And, mostly annoying, if the first click recursed into a directory, the second click will <em>choose</em> whatever is there (at that mouse pointer position) in the previously chosen directory.</li>
<li>If the file/directory is not already selected, then the first click will not choose it, it will just select it. The second click will choose it. Again, if you double click, it will handle two single clicks (not a double click), but the behaviour will be similar to the old double click.</li>
</ul>
<p>Unfortunately, at the time of writing this there is no setting for changing this behaviour and the only way to fix it is to patch GTK3 and recompile. The change was introduced by a <a href="https://git.gnome.org/browse/gtk%2B/commit/?id=fb0a13b7f070a14312dafa1e4df6ba03cf33be01">single commit</a>, which can be reverted. The reverse commit does not no longer apply cleanly on GTK 3.20.6, but can be easily applied manually. I also built some custom GTK 3.20.6 packages for Fedora (see below) and you can take the patch from there.</p>
<p>References:</p>
<ul>
<li><a href="https://bbs.archlinux.org/viewtopic.php?id=212278">https://bbs.archlinux.org/viewtopic.php?id=212278</a></li>
<li><a href="https://bugzilla.gnome.org/show_bug.cgi?id=766089">https://bugzilla.gnome.org/show_bug.cgi?id=766089</a></li>
</ul>
<h1>Custom Fedora Packages</h1>
<p>Custom Fedora GTK3 packages that contain both the typeahead and the single click fix are available in <a href="https://copr.fedorainfracloud.org/coprs/rrendec/desktop-overrides/">my copr repository</a>.</p>
http://rrendec.mindbit.ro/post/gtk3-legacy-behaviour/2016-07-30T18:27:15+00:00Qt Looks in Fedora 24<p>OK, so I recently upgraded to Fedora 24. Not so many surprises, but one of them was that suddenly the scrollbars in all Qt applications used a different theme. Most probably not only the scrollbars, but those were strikingly different.</p>
<p>As a background, I'm using MATE Desktop on Fedora, with the TraditionalOk theme and Mist icon set. So normally my desktop looks pretty much like the default Gnome 2 desktop before Fedora 15 (when they decided to drop Gnome 2, because it had been discontinued upstream).</p>
<p>To begin with, Fedora 24 is at the transition point between Qt 4 and Qt 5. For this reason, older applications still use Qt 4, while newer have switched to Qt 5 already. And of course there are some legacy applications like Skype for Linux that are stuck on Qt 4. This is not a problem at all, but it may not be obvious to you (as it wasn't to me before I ran into this problem) that <em>Qt 4 and Qt 5 have totally different configuration systems</em>.</p>
<h1>Fixing Qt 4 Appearance</h1>
<ul>
<li>Install the <code>qt4-config</code> package and then run <code>qtconfig-qt4</code>.</li>
<li>In the default <em>Appearance</em> tab, select <em>GTK+</em> for <em>GUI Style</em>.</li>
<li>Click <em>File</em> - <em>Save</em>. That's it, you're done. Now Qt 4 applications are fixed.</li>
</ul>
<h1>Fixing Qt 5 Appearance</h1>
<p>Quoting from the official release notes, <em>Fedora 24 introduces QGnomePlatform, a Qt Platform Theme that aims to take as many of the GNOME settings as possible and apply them directly to Qt applications, thus enabling the Qt applications to fit more consistently into the GNOME Desktop</em>.</p>
<p>So all you have to do is install the <code>qgnomeplatform</code> package and then suddenly all Qt 5 applications will start to look like your GTK theme. They will even use the GTK file dialogs. This is awesome.</p>
<p>References:</p>
<ul>
<li><a href="https://fedoraproject.org/wiki/Test_Day:2016-03-17_Qt_Gtk_Integration">https://fedoraproject.org/wiki/Test_Day:2016-03-17_Qt_Gtk_Integration</a></li>
<li><a href="https://docs.fedoraproject.org/en-US/Fedora/24/html/Release_Notes/sect-Release_Notes-Changes_for_Desktop.html">https://docs.fedoraproject.org/en-US/Fedora/24/html/Release_Notes/sect-Release_Notes-Changes_for_Desktop.html</a></li>
</ul>
http://rrendec.mindbit.ro/post/qt-looks-in-fedora-24/2016-07-15T22:39:41+00:00