<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Linux on dotnet.work</title>
        <link>https://dotnet.work/categories/linux/</link>
        <description>Recent content in Linux on dotnet.work</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-US</language>
        <managingEditor>dotnet@oles.cloud (Ole Albers)</managingEditor>
        <webMaster>dotnet@oles.cloud (Ole Albers)</webMaster>
        <copyright>Ole Albers</copyright>
        <lastBuildDate>Wed, 27 May 2020 12:00:00 +0200</lastBuildDate><atom:link href="https://dotnet.work/categories/linux/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>Raspberry Pi 4: usB first!</title>
            <link>https://dotnet.work/blog/raspberry-pi-4-usb-first/</link>
            <pubDate>Wed, 27 May 2020 12:00:00 +0200</pubDate><author>dotnet@oles.cloud (Ole Albers)</author>
            <guid>https://dotnet.work/blog/raspberry-pi-4-usb-first/</guid>
            <description>&lt;p&gt;At the time of this writing the boot-from-usb has just been made available as a Beta feature for the Raspberry Pi 4.&lt;/p&gt;&#xA;&lt;p&gt;There are a few tutorials on how to activate that feature but I had an additional requirement: Boot from USB first, then boot from SD which requires a few additional steps.&lt;/p&gt;&#xA;&lt;p&gt;This document might still be useful if you just want the SD first approach. Just ignore the second last part in that case.&lt;/p&gt;&#xA;&lt;p&gt;But before we begin:&lt;/p&gt;&#xA;&lt;p&gt;Use at your own risk. We are writing data to the EEPROM here using beta contents and even manipulate configs for that. If something fails your pi might be bricked. Not even reinstall Linux will repair that.&lt;/p&gt;&#xA;&lt;p&gt;Additional warning: Don&amp;rsquo;t try this on a N00bs install.&lt;/p&gt;&#xA;&lt;p&gt;Still here? So let&amp;rsquo;s begin. (I will asume you use Raspbian Buster)&lt;/p&gt;&#xA;&lt;h3 id=&#34;updating-the-pi&#34;&gt;&lt;a href=&#34;#updating-the-pi&#34; class=&#34;header-anchor&#34;&gt;&lt;/a&gt;Updating the Pi&#xA;&lt;/h3&gt;&lt;p&gt;Before we start we should always have the most current Linux version installed. So make sure your internet connection works and enter&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo apt-get update&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;followed by&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo apt-get upgrade&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;and in addition&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo rpi-update&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;to update the firmware on the sdcard&lt;/p&gt;&#xA;&lt;h3 id=&#34;switching-to-beta&#34;&gt;&lt;a href=&#34;#switching-to-beta&#34; class=&#34;header-anchor&#34;&gt;&lt;/a&gt;Switching to beta&#xA;&lt;/h3&gt;&lt;p&gt;now change rpi to switch to beta - state. (&lt;em&gt;If you are reading this from the future: Hi there! Cars still a thing? And maybe you don&amp;rsquo;t need to switch to beta anymore&lt;/em&gt;)&lt;/p&gt;&#xA;&lt;p&gt;do this by using your favourite editor like vi or nano to change the rpi-config:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo nano /etc/default/rpi-eeprom-update&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;change the release-status from &lt;code&gt;critical&lt;/code&gt; to &lt;code&gt;beta&lt;/code&gt; and save the file.&lt;/p&gt;&#xA;&lt;h3 id=&#34;flashing-the-eeprom&#34;&gt;&lt;a href=&#34;#flashing-the-eeprom&#34; class=&#34;header-anchor&#34;&gt;&lt;/a&gt;Flashing the EEPROM&#xA;&lt;/h3&gt;&lt;p&gt;Now check the most current version on your pi:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;ls /lib/firmware/raspberrypi/bootloader/beta/pieeprom*.bin&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;At time of this writing the most current version there is 2020-05-15. So flash the eeprom with that version:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo rpi-eeprom-update -d -f /lib/firmware/raspberrypi/bootloader/beta/pieeprom-2020-05-15.bin&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;You will be thrown back to the prompt a while after. Now reboot your pi and hope nothing went wrong:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo shutdown - r now&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;now check if the version has been installed by typing&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo vcgencmd bootloader_version&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;the response should display the date corresponding to your file. So something like &lt;code&gt;May 15&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;changing-the-boot-order&#34;&gt;&lt;a href=&#34;#changing-the-boot-order&#34; class=&#34;header-anchor&#34;&gt;&lt;/a&gt;Changing the boot order&#xA;&lt;/h3&gt;&lt;p&gt;By default now the boot order will be SD first, USB second. So if you just want to throw away your SD and boot grom USB: Ignore this chapter. If you need a &amp;ldquo;hardware multiboot&amp;rdquo; (boot from USB if attached but still have a fallback SD in place if not) follow these instructions:&lt;/p&gt;&#xA;&lt;p&gt;First make sure I did not lie about the default order and display the current config:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo vcgencmd bootloader_config&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;this should display some information about the configuration. Most interesting for us is the last part called &lt;code&gt;BOOT_ORDER&lt;/code&gt;which will contain the entry&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;BOOT_ORDER=0xf41&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;where 4=USB and 1=SD. More details like network bo&lt;strong&gt;ot can be found at the bootloader documentation.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;While this might look like just how we want it you have to read this right to left. So it is SD (1) first and USB (4) second. But we are about to change that.&lt;/p&gt;&#xA;&lt;p&gt;First it is highly recommend to not fiddle with the official ROM files but make a copy of that. Let&amp;rsquo;s do that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo cp /lib/firmware/respberrypi/bootloader/beta/pieeprom-2015-05-15.bin pieeprom.bin&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now create a config from that rom:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo rpi-eeprom-config pieeprom-usbfirst.bin &amp;gt;bootconf.txt&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;You now created a config file containing the config-output which you can edit by nano again:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo nano bootconf.txt&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;and change the last line to:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;BOOT_ORDER=0xf14&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;At the last step we now apply our changed config und update the eeprom again:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;  sudo rpi-eeprom-config --out pieeprom-usbfirst.bin --config bootconf.txt pieeprom.bin   sudo rpi-eeprom-update -d -f ./pieeprom-usbfirst.bin   sudo shutdown -r now  &lt;/code&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;finalizing-the-usb-drive&#34;&gt;&lt;a href=&#34;#finalizing-the-usb-drive&#34; class=&#34;header-anchor&#34;&gt;&lt;/a&gt;Finalizing the USB drive&#xA;&lt;/h3&gt;&lt;p&gt;Now our raspberry can boot from USB (and boot from there first) but the linux on our USB does not really know how to handle that. This part is simple:&lt;/p&gt;&#xA;&lt;p&gt;First you need to flash a Raspbian image onto your USB-drive (just like you would to with an SD-card) . Then attach and mount the usb drive and copy the most current firmware files from the /boot - directory of the sdcard to the Usb drive. Alternatively you can select those files from the &lt;a class=&#34;link&#34; href=&#34;https://github.com/raspberrypi/firmware/tree/master/boot&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;master-branch on github.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Have fun :)&lt;/p&gt;&#xA;</description>
        </item><item>
            <title>Displaying Data from HomeMatic Actors on a WebInterface</title>
            <link>https://dotnet.work/blog/displaying-data-from-homematic-actors-on-a-webinterface/</link>
            <pubDate>Mon, 11 Jul 2016 12:00:00 +0200</pubDate><author>dotnet@oles.cloud (Ole Albers)</author>
            <guid>https://dotnet.work/blog/displaying-data-from-homematic-actors-on-a-webinterface/</guid>
            <description>&lt;p&gt;This tutorial assumes that you already installed and configured FHEM and know how to use AngularJS.&lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;As you might know I use my Raspberry PI to automate tasks at home. I already &lt;a class=&#34;link&#34; href=&#34;https://dotnet.work/blog/detecting-smartphone-via-bluetooth-on-linux-raspberry-pi-2/&#34; &gt;detect my SmartPhone&lt;/a&gt;, and my &lt;a class=&#34;link&#34; href=&#34;https://dotnet.work/blog/tracking-fitbit-presence-under-linux-raspberry-pi-2/&#34; &gt;FitBit&lt;/a&gt; and also &lt;a class=&#34;link&#34; href=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/&#34; &gt;control my Webcam&lt;/a&gt; and &lt;a class=&#34;link&#34; href=&#34;https://dotnet.work/blog/control-your-harmony-hub-with-a-raspberry-pi-linux/&#34; &gt;Harmony remote&lt;/a&gt; using a raspberry and a web interface.&lt;/p&gt;&#xA;&lt;p&gt;Now I also wanted to include actors from HomeMatic thermostats into my configuration and display it in a nice way.&lt;/p&gt;&#xA;&lt;p&gt;Hardware used:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;HomeMatic Wireless Configuration Adapter LAN (HM-CFG-LAN)&lt;/li&gt;&#xA;&lt;li&gt;HomeMatic Thermostate HM-CC-RT-DN&lt;/li&gt;&#xA;&lt;li&gt;Raspberry Pi V2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Software used:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;HTML/CSS&lt;/li&gt;&#xA;&lt;li&gt;JavaScript&lt;/li&gt;&#xA;&lt;li&gt;AngularJS&lt;/li&gt;&#xA;&lt;li&gt;FHEM&lt;/li&gt;&#xA;&lt;li&gt;PHP (optional)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Before we begin make sure you have already installed FHEM and the hardware for it. I will not discuss that here as there are a lot of good tutorials for that. A good (german) tutorial can be found in the &lt;a class=&#34;link&#34; href=&#34;http://www.fhemwiki.de/wiki/HM-CFG-LAN_LAN_Konfigurations-Adapter&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;FHEM Wiki&lt;/a&gt;. (If you got any english documentation, feel free to post it in the comments.)&lt;/p&gt;&#xA;&lt;p&gt;I wrote a &amp;ldquo;general&amp;rdquo; PHP script to send commands and receive commands from FHEM. This can also be done without PHP and pure JavaScript-Code. I chose this solution because my configuration website is accessable through the internet, but my FHEM isn&amp;rsquo;t. So JS-Could (running on the client) would not work, but PHP (running on the server) does.&lt;/p&gt;&#xA;&lt;p&gt;The PHP-Script:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;?php&#xA; $host=&amp;#34;http://192.168.178.36:8083/fhem?&amp;#34;;&#xA;&#xA; $sensor= $\_GET\[&amp;#39;sensor&amp;#39;\];&#xA; $param= $\_GET\[&amp;#39;param&amp;#39;\];&#xA; $action= $\_GET\[&amp;#39;action&amp;#39;\];&#xA;&#xA; if ($action==&amp;#34;get&amp;#34;) {&#xA; $get=&amp;#34;detail=SENSOR&amp;amp;dev.getSENSOR=SENSOR&amp;amp;cmd.getSENSOR=get&amp;amp;arg.getSENSOR=param&amp;amp;val.getSENSOR=PARAM&amp;amp;XHR=1&amp;amp;addLinks=1&amp;#34;;&#xA; } else {&#xA; $get=&amp;#34;cmd=set%20SENSOR%20desired-temp%20PARAM&amp;amp;XHR=1&amp;#34;;&#xA; }&#xA;&#xA; $replaced=str\_replace(&amp;#34;SENSOR&amp;#34;,$sensor,$get);&#xA; $replaced=str\_replace(&amp;#34;PARAM&amp;#34;,$param,$replaced);&#xA; $total=$host.$replaced;&#xA; &#xA; $ch = curl\_init();&#xA; curl\_setopt($ch, CURLOPT\_URL, $total);&#xA; curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);&#xA; $return = curl\_exec($ch);&#xA;&#xA; echo $return;&#xA;&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The only thing you need to modify here is the IP-Adress (or hostname) and maybe the port from the $host - variable. As you can see, this is a simple GET-Request which could easily used through JavaScript (or even just inside a href) also.&lt;/p&gt;&#xA;&lt;p&gt;You can test this script by simply calling it with some parameters:&lt;/p&gt;&#xA;&lt;p&gt;http://yourserver/fhem.php?action=get&amp;amp;sensor={sensorname}_Clima&amp;amp;param=measured-temp&lt;/p&gt;&#xA;&lt;p&gt;Replace &amp;ldquo;Sensorname&amp;rdquo; by the name of your sensor. You should receive the current temperature of the sensor as a result.&lt;/p&gt;&#xA;&lt;p&gt;Now it is time to display this data in a fancy way in html. Create any HTML - Page using AngularJS. To use these nice Gauges you need &lt;a class=&#34;link&#34; href=&#34;https://github.com/angular-google-chart/angular-google-chart&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;ng-Google-Chart&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now lets see the HTML-Part containing the AngularJS-Directives to display and set the thermostate values:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;html&amp;gt;&amp;lt;body ng-app=&amp;#34;piApp&amp;#34;&amp;gt;&#xA;  &amp;lt;div class=&amp;#34;container&amp;#34; ng-Controller=&amp;#34;heatController&amp;#34; ng-init=&amp;#34;getStats()&amp;#34;&amp;gt;&#xA;        &amp;lt;div class=&amp;#34;row&amp;#34;&amp;gt;&#xA;            &amp;lt;div class=&amp;#34;box&amp;#34;&amp;gt;&#xA;                &amp;lt;div class=&amp;#34;col-lg-12&amp;#34;&amp;gt;&#xA;                    &amp;lt;hr&amp;gt;&#xA;                    &amp;lt;h2 class=&amp;#34;intro-text text-center&amp;#34;&amp;gt;Heizungs&#xA;                        &amp;lt;strong&amp;gt;Einstellungen&amp;lt;/strong&amp;gt;&#xA;                    &amp;lt;/h2&amp;gt;&#xA;                    &amp;lt;hr&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;                &amp;lt;div class=&amp;#34;col-md-12&amp;#34;&amp;gt;&#xA;                    &amp;lt;div ng-repeat=&amp;#34;heater in heaterSettings.allHeaters&amp;#34; class=&amp;#34;heater&amp;#34;&amp;gt;&#xA;                        &amp;lt;div class=&amp;#34;battery&amp;#34;&amp;gt;&amp;lt;i class=&amp;#34;fa fa-4x fa-{{heater.battery.icon}} {{heater.battery.color}}&amp;#34;&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;/div&amp;gt;&#xA;                        &amp;lt;div google-chart chart=&amp;#34;heater.gauge&amp;#34;  &amp;gt;&amp;lt;/div&amp;gt;&#xA;                        &amp;lt;div class=&amp;#34;caption&amp;#34;&amp;gt;{{heater.name}}&amp;lt;br/&amp;gt;&#xA;                            &amp;lt;select ng-model=&amp;#34;heater.ui.wish&amp;#34; ng-change=&amp;#34;setTemperature(heater.id,heater.ui.wish)&amp;#34;&amp;gt;&#xA;                                &amp;lt;option ng-repeat=&amp;#34;option in availableTemperatures()&amp;#34; value=&amp;#34;{{option}}&amp;#34;&amp;gt;{{option}}&amp;lt;/option&amp;gt;&#xA;                            &amp;lt;/select&amp;gt;&#xA;                        &amp;lt;/div&amp;gt;&#xA;                    &amp;lt;/div&amp;gt;&#xA;                &amp;lt;/div&amp;gt;&#xA;&#xA;        &amp;lt;/div&amp;gt;&#xA;    &amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Some explanation:&lt;/p&gt;&#xA;&lt;p&gt;piApp is the AngularJS - App for the website, getStats() loads the current Sensors using FHEM.php mentioned above directly from the start. This html uses Bootstrap (for repsonsive design) and Font Awesome to display the Battery indicator. Both use CSS to achieve this. (The Gauge-Display works without these libraries)&lt;/p&gt;&#xA;&lt;p&gt;The Angular-Controller looks like this:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;angular.module(&amp;#39;piApp&amp;#39;, \[&amp;#39;googlechart&amp;#39;\])&#xA;    .controller(&amp;#39;heatController&amp;#39;, function($scope, $http) {&#xA;        $scope.url=&amp;#39;fhem.php?&amp;#39;;&#xA;        $scope.heaterSettings={&#xA;            allHeaters:\[&#xA;                {name:&amp;#39;Wohnzimmer&amp;#39;, id:&amp;#39;Wohnzimmer\_Clima&amp;#39;, ui:{},battery:{},gauge:{}},&#xA;                {name:&amp;#39;Schlafzimmer&amp;#39;,id:&amp;#39;Schlafzimmer\_Clima&amp;#39;,ui:{},battery:{},gauge:{}},&#xA;                {name:&amp;#39;Bad&amp;#39;,id:&amp;#39;Bad\_Clima&amp;#39;,ui:{},battery:{},gauge:{}}&#xA;            \]&#xA;        };&#xA;&#xA;        $scope.getParamUrl=function(sensor,param) {&#xA;            return &amp;#34;action=get&amp;amp;sensor=&amp;#34;+sensor+&amp;#34;&amp;amp;param=&amp;#34;+param;&#xA;        };&#xA;        $scope.setParamUrl=function(sensor,param) {&#xA;            return &amp;#34;action=set&amp;amp;sensor=&amp;#34;+sensor+&amp;#34;&amp;amp;param=&amp;#34;+param;&#xA;        };&#xA;&#xA;        $scope.getBattery=function(sensor, target) {&#xA;            $http.get($scope.url+$scope.getParamUrl(sensor,&amp;#39;batteryLevel&amp;#39;))&#xA;                .success(function(data) {&#xA;                    $scope.setBattery(target,data);&#xA;                });&#xA;        };&#xA;&#xA;        $scope.getStats=function() {&#xA;            $scope.heaterSettings.allHeaters.forEach(function (heater) {&#xA;                // gauge:&#xA;                heater.gauge={};&#xA;                heater.gauge.type=&amp;#34;Gauge&amp;#34;;&#xA;                heater.gauge.options = {&#xA;                    width: 250,&#xA;                    height: 250,&#xA;                    redFrom: 20,&#xA;                    redTo: 30,&#xA;                    greenFrom: 0,&#xA;                    greenTo: 10,&#xA;                    yellowFrom: 10,&#xA;                    yellowTo: 20,&#xA;                    minorTicks: 10,&#xA;                    majorTicks: \[&amp;#39;0&amp;#39;,&amp;#39;5&amp;#39;,&amp;#39;10&amp;#39;,&amp;#39;15&amp;#39;,&amp;#39;20&amp;#39;,&amp;#39;25&amp;#39;,&amp;#39;30&amp;#39;\],&#xA;                    max:30,&#xA;                    animation:{&#xA;                        startup: true,&#xA;                        duration: 1000,&#xA;                        easing: &amp;#39;inAndOut&amp;#39;&#xA;                    }&#xA;                };&#xA;&#xA;                // Gemessene Temperatur:&#xA;                $http.get($scope.url+$scope.getParamUrl(heater.id,&amp;#39;measured-temp&amp;#39;))&#xA;                    .success(function(data) {&#xA;                        $scope.setData(heater.gauge,data);&#xA;                    });&#xA;                $http.get($scope.url+$scope.getParamUrl(heater.id,&amp;#39;desired-temp&amp;#39;))&#xA;                    .success(function(data) {&#xA;                        $scope.setWish(heater.ui,data);&#xA;                    });&#xA;                $scope.getBattery(heater.name,heater);&#xA;            });&#xA;        };&#xA;&#xA;        $scope.setTemperature=function(sensor, temperature) {&#xA;            $http.get($scope.url+$scope.setParamUrl(sensor,temperature))&#xA;                .success(function(data) {&#xA;                    console.log(&amp;#34;Temperatur von &amp;#34;+sensor+&amp;#34; auf &amp;#34;+temperature+&amp;#34; Grad eingestellt&amp;#34;);&#xA;                    //$scope.getStats();&#xA;                })&#xA;                .error(function(data) {&#xA;                    alert(&amp;#34;Fehlgeschlagen&amp;#34;);&#xA;                }&#xA;            );&#xA;        };&#xA;&#xA;        $scope.availableTemperatures=function() {&#xA;            var available=\[\];&#xA;            for(var i=5;i&amp;lt;=30;i=i+0.5)  {&#xA;                var iasString= i.toString();&#xA;                if (Math.round(i)===i) {&#xA;                    iasString+=&amp;#39;.0&amp;#39;&#xA;                }&#xA;                available.push(iasString);&#xA;            }&#xA;            available.push(&amp;#34;on&amp;#34;);&#xA;            available.push(&amp;#34;off&amp;#34;);&#xA;            return available;&#xA;        };&#xA;&#xA;        $scope.setData=function(target,data) {&#xA;            var value=parseFloat(data.replace(/(\\r\\n|\\n|\\r)/gm,&amp;#34;&amp;#34;));&#xA;            target.data=  \[ \[&amp;#39;Label&amp;#39;, &amp;#39;Value&amp;#39;\], \[&amp;#39;&amp;#39;, value\]\];&#xA;        };&#xA;&#xA;        $scope.setWish=function(target,data) {&#xA;            var value=data.replace(/(\\r\\n|\\n|\\r)/gm,&amp;#34;&amp;#34;).trim();&#xA;            target.wish=value;&#xA;        };&#xA;     &#xA;        $scope.setBattery=function(target,value) {&#xA;            var value=parseFloat(value.replace(/(\\r\\n|\\n|\\r)/gm,&amp;#34;&amp;#34;).trim());&#xA;            var color=&amp;#39;green&amp;#39;;&#xA;            var icon=&amp;#39;battery-full&amp;#39;;&#xA;            if (value&amp;lt;2.1) {&#xA;                color=&amp;#34;red&amp;#34;;&#xA;                icon=&amp;#39;battery-empty&amp;#39;;&#xA;            } else if (value&amp;lt;2.3) {&#xA;                color=&amp;#34;red&amp;#34;;&#xA;                icon=&amp;#39;battery-quarter&amp;#39;;&#xA;            } else if (value&amp;lt;2.6) {&#xA;                color=&amp;#34;yellow&amp;#34;;&#xA;                icon=&amp;#39;battery-half&amp;#39;;&#xA;            }&#xA;            target.battery={&#xA;                value:value,&#xA;                color:color,&#xA;                icon:icon&#xA;            }&#xA;        };&#xA;&#xA;    })&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Explanation:&lt;/p&gt;&#xA;&lt;p&gt;&amp;ldquo;googlechart&amp;rdquo; in the module-configuration allows to paint those fancy gauges.&lt;/p&gt;&#xA;&lt;p&gt;in $scope.heaterSettings.allHeaters you have to modify the Names of your Sensors. Enter as many sensors as you want.&lt;/p&gt;&#xA;&lt;p&gt;All other functions communicate with fhem.php or display values.&lt;/p&gt;&#xA;</description>
        </item><item>
            <title>Detecting Smartphone via Bluetooth on Linux (Raspberry Pi 2)</title>
            <link>https://dotnet.work/blog/detecting-smartphone-via-bluetooth-on-linux-raspberry-pi-2/</link>
            <pubDate>Sat, 27 Feb 2016 12:00:00 +0100</pubDate><author>dotnet@oles.cloud (Ole Albers)</author>
            <guid>https://dotnet.work/blog/detecting-smartphone-via-bluetooth-on-linux-raspberry-pi-2/</guid>
            <description>&lt;p&gt;After &lt;a class=&#34;link&#34; href=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/&#34; &gt;detecting my phone using WiFi&lt;/a&gt; (which does only work under Marshmallow while the phone is loading or the display is enabled) and &lt;a class=&#34;link&#34; href=&#34;https://dotnet.work/blog/tracking-fitbit-presence-under-linux-raspberry-pi-2/&#34; &gt;detecting the fitbit device&lt;/a&gt; I came back to my original task to detect my phone using Bluetooth.&lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;While there are many documents out there that describe this on different Linux and even raspberry variants none of those really worked for me. The raspberry 2 (Debian Jessie) seem to be a bit different there.&lt;/p&gt;&#xA;&lt;p&gt;First of all you need a Bluetooth USB dongle. I buyed the Logilink BT00015 (available at &lt;a class=&#34;link&#34; href=&#34;http://www.amazon.com/gp/product/B0096Y2HFW/ref=as_li_tl?ie=UTF8&amp;amp;camp=1638&amp;amp;creative=19454&amp;amp;creativeASIN=B0096Y2HFW&amp;amp;linkCode=as2&amp;amp;tag=derstammti-21&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;amazon.com&lt;/a&gt;, &lt;a class=&#34;link&#34; href=&#34;http://www.amazon.de/gp/product/B0096Y2HFW/ref=as_li_tl?ie=UTF8&amp;amp;camp=1638&amp;amp;creative=19454&amp;amp;creativeASIN=B0096Y2HFW&amp;amp;linkCode=as2&amp;amp;tag=derstammti-21&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;amazon.de&lt;/a&gt; or elsewhere). I would expect that others work, too. But as always: On Linux, drivers can be tricky and it&amp;rsquo;s always good to know working hardware.&lt;/p&gt;&#xA;&lt;p&gt;Before installing drivers it is always a good idea to update everything:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo apt-get update&#xA;sudo apt-get upgrade&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then install the libraries needed for bluetooth&lt;/p&gt;&#xA;&lt;p&gt;sudo apt-get install &amp;ndash;no-install-recommends bluetooth&lt;/p&gt;&#xA;&lt;p&gt;I received an error that some dependencies could not be resolved. I fixed that by entering the following commands:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo dpkg --configure -a&#xA;sudo apt-get install -f&#xA;`Now insert the USB dongle and restart the raspberry`&#xA;sudo shutdown -r now&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To check if the USB-dongle is detected,  enter the following command:&lt;/p&gt;&#xA;&lt;p&gt;lsusb&lt;/p&gt;&#xA;&lt;p&gt;This lists all USB devices. There should be one offering Bluetooth - services&lt;/p&gt;&#xA;&lt;p&gt;Now lets check if the Bluetooth itself works:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;/etc/init.d/bluetooth status&lt;/code&gt;&#xA;The response should now contain the word &amp;ldquo;Running&amp;rdquo;:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;pi@raspberrypi:~ $ /etc/init.d/bluetooth status&#xA;● bluetooth.service - Bluetooth service&#xA; Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled)&#xA; Active: active (running) since Sat 2016-02-27 19:31:45 UTC; 17min ago&#xA; Docs: man:bluetoothd(8)&#xA; Main PID: 7841 (bluetoothd)&#xA; Status: &amp;#34;Running&amp;#34;&#xA; CGroup: /system.slice/bluetooth.service&#xA; └─7841 /usr/lib/bluetooth/bluetoothd&#xA;`Now it&amp;#39;s time to check for devices. Do nothing with your phone right now and enter:`&#xA;hcitool scan&#xA;`This should display all Bluetooth-devices in Range. As you haven&amp;#39;t done anything with your phone yet it should not be displayed there. The output should be something like this:`&#xA;Scanning ...&#xA; 7C:2F:BE:EF:FA:CE Ole&#xA; 00:04:BE:EF:FA:CE SHIELD&#xA; B8:86:BE:EF:FA:CE Fette Glotze&#xA; 88:53:BE:EF:FA:CE TOMATO-PC&#xA; 48:44:BE:EF:FA:CE TVBluetooth&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;(I modified the MAC addresses. I am not absolutely sure if anyone could do evil things using the MACs, but I prefer not to find that out :) )&lt;/p&gt;&#xA;&lt;p&gt;Now put your phone into discovery mode. On Android Marshmallow you just have to enter your Bluetooth-settings for this. Then re-scan your devices. There should be one more, now:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;hcitool scan&#xA;&#xA;7C:2F:BE:EF:FA:CE Ole&#xA;00:04:BE:EF:FA:CE SHIELD&#xA;B8:86:BE:EF:FA:CE Fette Glotze&#xA;88:53:BE:EF:FA:CE TOMATO-PC&#xA;48:44:BE:EF:FA:CE TVBluetooth&#xA;&#xA;F8:95:C7:H0:0H:0H G4&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now just note your Mac-Address. We will &lt;strong&gt;not&lt;/strong&gt; pair our device. That takes a few steps and additional packages and additional problems. Pairing is not needed once we know the mac-address.&lt;/p&gt;&#xA;&lt;p&gt;Now we cam just check the presence by using the info command. Simply leave your Bluetooth-settings on the phone and enter&#xA;&lt;code&gt;sudo hcitool info F8:95:C7:H0:0H:0H&lt;/code&gt;&#xA;Event though your phone isn&amp;rsquo;t in discovery-mode anymore you will get some status information like the device name:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Requesting information ...&#xA; BD Address: F8:95:C7:H0:0H:0H&#xA; Device Name: G4&#xA; LMP Version: 4.1 (0x7) LMP Subversion: 0x6109&#xA; Manufacturer: Broadcom Corporation (15)&#xA;`if you turn off Bluetooth on your phone and re-enter that command you will receive a different response:`&#xA;Requesting information ...&#xA;Can&amp;#39;t create connection: Input/output error&#xA;`So that&amp;#39;s it. Just use the good old grep in your bash-script to check whether the phone is there or not:`&#xA;if hcitool info F8:95:C7:H0:0H:0H | grep -q &amp;#39;Device Name&amp;#39;; then&#xA; // Do whatever you like if you found it&#xA;fi&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Again: Have fun :)&lt;/p&gt;&#xA;</description>
        </item><item>
            <title>Tracking fitbit presence under Linux (Raspberry Pi 2)</title>
            <link>https://dotnet.work/blog/tracking-fitbit-presence-under-linux-raspberry-pi-2/</link>
            <pubDate>Sat, 27 Feb 2016 12:00:00 +0100</pubDate><author>dotnet@oles.cloud (Ole Albers)</author>
            <guid>https://dotnet.work/blog/tracking-fitbit-presence-under-linux-raspberry-pi-2/</guid>
            <description>&lt;p&gt;&lt;a class=&#34;link&#34; href=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/&#34; &gt;As I wrote before&lt;/a&gt; I track the presence of my smartphone using WiFi. Since Android Marshmellow this doesn&amp;rsquo;t work anymore, because when switching to idle mode, the WiFi is disconnected. The easiest way to get around this issue would be to use Bluetooth instead. And in fact: I already decided to go that way. But then my company gave me a nice present: A &amp;ldquo;Fitbit Charge HR&amp;rdquo;. While my company assured, that the HR is not for Human Resource and does not try to track if I am programming enough I decided to give this a try.&lt;/p&gt;&#xA;&lt;p&gt;Being a nerd I am not that much into that &amp;ldquo;fitness&amp;rdquo;-area. But I like the device as a small watch and the vibration alarm is nice too. I will surely sync this with my Appointments lateron. Getting some information about how many steps it takes to get the beer out of the cellar or the chips out of the kitchen is a nice benefit. Not really useful. But at least nerdy :)&lt;/p&gt;&#xA;&lt;p&gt;So I plan to wear this device for a while. So it should be a good idea to use it for tracking my presence. Maybe in combination with a phone-detection as a fall-back. First I tried to use a standard USB-dongle to detect it. But as this device works on Bluetooth Low Energy (BLE) it cannot be detected with normal Bluetooth-Dongles.  So&#xA;&lt;code&gt;hcitool scan&lt;/code&gt;&#xA;or even&#xA;&lt;code&gt;hcitool lescan&lt;/code&gt;&#xA;did not receive any results. Luckily the Fitbit ships with an USB-dongle. And even better, there is a package called &amp;ldquo;&lt;a class=&#34;link&#34; href=&#34;https://bitbucket.org/benallard/galileo&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;galileo&lt;/a&gt;&amp;rdquo; which purpose is to sync the fitbit. Installation is easy:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo apt-get install python-usb python-requests&#xA;sudo pip install galileo&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now install the dongle and restart the raspberry.&lt;/p&gt;&#xA;&lt;p&gt;If you enter the following command&#xA;&lt;code&gt;sudo galileo -v&lt;/code&gt;&#xA;you should see something like&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;2016-02-27 16:28:21,875:INFO: 1 trackers discovered&lt;/code&gt;&#xA;All you have to do now to check if the fitbit is in range automaticly is some bash-magic:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;if galileo -v | grep -q &amp;#39;1 trackers&amp;#39;; then&#xA;  // Do whatever you like if you found it&#xA;fi&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
        </item><item>
            <title>Control your Harmony Hub with a Raspberry Pi (Linux)</title>
            <link>https://dotnet.work/blog/control-your-harmony-hub-with-a-raspberry-pi-linux/</link>
            <pubDate>Fri, 15 Jan 2016 12:00:00 +0100</pubDate><author>dotnet@oles.cloud (Ole Albers)</author>
            <guid>https://dotnet.work/blog/control-your-harmony-hub-with-a-raspberry-pi-linux/</guid>
            <description>&lt;img src=&#34;https://dotnet.work/blog/control-your-harmony-hub-with-a-raspberry-pi-linux/hh1_hu_8bb48e2bca1c02c6.png&#34; alt=&#34;Featured image of post Control your Harmony Hub with a Raspberry Pi (Linux)&#34; /&gt;&lt;p&gt;&lt;a class=&#34;link&#34; href=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/&#34; &gt;So my surveillance cam now only records when I am not at home&lt;/a&gt;. But what if I forget to turn off the TV? That should happen automaticly, too! But fear not: There is a solution - at least if you own a harmony hub. With the help of the &amp;ldquo;HarmonyHubControl&amp;rdquo; - tool (written in c++) this is done quite easily.&lt;/p&gt;&#xA;&lt;p&gt;First of all you need to put the source onto the Raspberry. Don&amp;rsquo;t be afraid. No rocket science here. All needed tools should be already on your Linux distribution. The easiest way would be to clone the source via git:&#xA;&lt;code&gt;git clone git://git.code.sf.net/p/harmonyhubcontrol/code harmonyhubcontrol-code&lt;/code&gt;&#xA;If you prefer you may - of course - also use the long way and download those files in a zip file.&lt;/p&gt;&#xA;&lt;p&gt;Now after you have the source code on your Pi you have to compile it. Done with ease. Just a single&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;make&lt;/code&gt;&#xA;and you created the file &amp;ldquo;HarmonyHubControl&amp;rdquo; in that directory. Now all you need to know is the IP-address from your hub. You usually can find it in your WiFi-Router under the name &amp;ldquo;HarmonyHub&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s try if the connection works:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;./HarmonyHubControl \[Login\] \[Password\] \[Ip\]&lt;/code&gt;&#xA;&lt;strong&gt;Warning!&lt;/strong&gt; Double-check your password. If you enter a wrong one, you can still stert the activities, but on the next login in your &amp;ldquo;MyHarmony&amp;rdquo;-application you will be thrown out for a while. Don&amp;rsquo;t ask why this works this way. Better ask Logitech instead.&lt;/p&gt;&#xA;&lt;p&gt;The Login is your email-address. If username and password are right you should see the following result: &lt;img alt=&#34;hh1&#34; class=&#34;gallery-image&#34; data-flex-basis=&#34;1720px&#34; data-flex-grow=&#34;716&#34; height=&#34;48&#34; loading=&#34;lazy&#34; sizes=&#34;(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px&#34; src=&#34;https://dotnet.work/blog/control-your-harmony-hub-with-a-raspberry-pi-linux/hh1_hu_8bb48e2bca1c02c6.png&#34; width=&#34;344&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;So let&amp;rsquo;s list all activities:&#xA;&lt;code&gt;./HarmonyHubControl \[Login\] \[Password\] \[Ip\] list\_activies&lt;/code&gt;&#xA;&lt;img alt=&#34;HH2&#34; class=&#34;gallery-image&#34; data-flex-basis=&#34;388px&#34; data-flex-grow=&#34;161&#34; height=&#34;213&#34; loading=&#34;lazy&#34; sizes=&#34;(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px&#34; src=&#34;https://dotnet.work/blog/control-your-harmony-hub-with-a-raspberry-pi-linux/HH2_hu_a6c3acb4df58670a.png&#34; width=&#34;345&#34;&gt; As you can see there is an activity with the id &amp;ldquo;-1&amp;rdquo;. This activity shuts down all devices. For testing let&amp;rsquo;s just start an activity:&#xA;&lt;code&gt;./HarmonyHubControl \[Login\] \[Password\] \[Ip\] start\_activity 15231836&lt;/code&gt;&#xA;does start the FireTV in my case,&#xA;&lt;code&gt;./HarmonyHubControl \[Login\] \[Password\] \[Ip\] start\_activity -1&lt;/code&gt;&#xA;does shut em all down.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img alt=&#34;hh3&#34; class=&#34;gallery-image&#34; data-flex-basis=&#34;3015px&#34; data-flex-grow=&#34;1256&#34; height=&#34;85&#34; loading=&#34;lazy&#34; sizes=&#34;(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px&#34; src=&#34;https://dotnet.work/blog/control-your-harmony-hub-with-a-raspberry-pi-linux/hh3-1_hu_a3fe2e1f9d30a0e1.png&#34; srcset=&#34;https://dotnet.work/blog/control-your-harmony-hub-with-a-raspberry-pi-linux/hh3-1_hu_c0131141837dabc1.png 800w, https://dotnet.work/blog/control-your-harmony-hub-with-a-raspberry-pi-linux/hh3-1_hu_a3fe2e1f9d30a0e1.png 1068w&#34; width=&#34;1068&#34;&gt; If you want to, do some fancy stuff with that possibilities. Use your stereo as an alarm clock? Have fun! (your neighbours, too, btw) :)&lt;/p&gt;&#xA;</description>
        </item><item>
            <title>Switching the LED of a surveillance cam on and off using Linux</title>
            <link>https://dotnet.work/blog/switching-the-led-of-a-surveillance-cam-on-and-off-using-linux/</link>
            <pubDate>Fri, 15 Jan 2016 12:00:00 +0100</pubDate><author>dotnet@oles.cloud (Ole Albers)</author>
            <guid>https://dotnet.work/blog/switching-the-led-of-a-surveillance-cam-on-and-off-using-linux/</guid>
            <description>&lt;img src=&#34;https://dotnet.work/blog/switching-the-led-of-a-surveillance-cam-on-and-off-using-linux/konsole_hu_e820623820643dd.png&#34; alt=&#34;Featured image of post Switching the LED of a surveillance cam on and off using Linux&#34; /&gt;&lt;p&gt;I already wrote a script on my Raspberry &lt;a class=&#34;link&#34; href=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/&#34; &gt;that starts and stops the surveillance mode&lt;/a&gt; of my camera using the &amp;ldquo;Surveillance Station&amp;rdquo; on the Synology DiskStation. Now I wanted to extend that tool and light the LEDs of the cam when it is recording and turning them off if it isn&amp;rsquo;t.&lt;/p&gt;&#xA;&lt;p&gt;This has two reasons: First: I do not want to use the cam for &amp;ldquo;secret recordings&amp;rdquo;, damaging the private spheres of my visitors. Second: I can easily see if the cam is working as expected. Now my cam has the option to activate the LEDs or deactivate from a web interface, but it is all-or-nothing. It does not depend if it is recording or not. Which isn&amp;rsquo;t a surprise as the camera does not trigger the recordings itself but this is done by the Surveillance Station.&lt;/p&gt;&#xA;&lt;p&gt;I own (and use) the &amp;ldquo;Robocam 4&amp;rdquo;, sold by 7Links. But this hardware is quite common and used under different names, too.&lt;/p&gt;&#xA;&lt;p&gt;Finding out the right commands is quite straight-forward: Open the webinterface and listen what happens there using the developer console in Chrome:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img alt=&#34;konsole&#34; class=&#34;gallery-image&#34; data-flex-basis=&#34;660px&#34; data-flex-grow=&#34;275&#34; height=&#34;296&#34; loading=&#34;lazy&#34; sizes=&#34;(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px&#34; src=&#34;https://dotnet.work/blog/switching-the-led-of-a-surveillance-cam-on-and-off-using-linux/konsole_hu_e820623820643dd.png&#34; srcset=&#34;https://dotnet.work/blog/switching-the-led-of-a-surveillance-cam-on-and-off-using-linux/konsole_hu_c4fbcf0a1e4c0823.png 800w, https://dotnet.work/blog/switching-the-led-of-a-surveillance-cam-on-and-off-using-linux/konsole_hu_e820623820643dd.png 814w&#34; width=&#34;814&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &amp;ldquo;Request URL&amp;rdquo; and &amp;ldquo;Form Data&amp;rdquo; are the most interesting informations here. Before entering that stuff into the Linux-shell let&amp;rsquo;s test this with a more &amp;ldquo;comfortable&amp;rdquo; interface. The chrome extension &amp;ldquo;&lt;a class=&#34;link&#34; href=&#34;https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;Postman&lt;/a&gt;&amp;rdquo; offers a nice way to play around with POST-Requests. The setting should be &amp;ldquo;x-www-form-urlencoded&amp;rdquo; here:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img alt=&#34;postman&#34; class=&#34;gallery-image&#34; data-flex-basis=&#34;573px&#34; data-flex-grow=&#34;238&#34; height=&#34;232&#34; loading=&#34;lazy&#34; sizes=&#34;(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px&#34; src=&#34;https://dotnet.work/blog/switching-the-led-of-a-surveillance-cam-on-and-off-using-linux/postman_hu_7ecfe6389cbb2caa.png&#34; width=&#34;554&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;If everything works as desired it is time to put that command to Linux using shell commands. Especially easy if the come does not only accept POST-requests, but GET-requests, too.&lt;/p&gt;&#xA;&lt;p&gt;http://192.168.0.88/admin/system.cgi?led=2&lt;/p&gt;&#xA;&lt;p&gt;worked like a charm in my case.&lt;/p&gt;&#xA;&lt;p&gt;The only thing that&amp;rsquo;s left is the authentifivcation. If you receive a classic login-screen like from a .htaccess password-protection it can be easily added to the url. So&#xA;&lt;code&gt;wget http://username:password@192.168.0.88/admin/system.cgi?led=2&lt;/code&gt;&#xA;turns on the LEDs&#xA;&lt;code&gt;wget http://username:password@192.168.0.88/admin/system.cgi?led=0&lt;/code&gt;&#xA;turns them off&lt;/p&gt;&#xA;&lt;p&gt;(0=off, 1=on, 2=blinking)&lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;Just add these lines to your existing script and the LEDs should be work just like needed :)&lt;/p&gt;&#xA;</description>
        </item><item>
            <title>Automate your Synology Surveillancestation with some simple Linux - commands</title>
            <link>https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/</link>
            <pubDate>Thu, 07 Jan 2016 12:00:00 +0100</pubDate><author>dotnet@oles.cloud (Ole Albers)</author>
            <guid>https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/</guid>
            <description>&lt;img src=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/reserveip_hu_ec0476895da7cc0d.png&#34; alt=&#34;Featured image of post Automate your Synology Surveillancestation with some simple Linux - commands&#34; /&gt;&lt;p&gt;I own a Synology diskstation which has the &amp;ldquo;surveillance station&amp;rdquo; on board which records content from any LAN (or WiFi)-enabled webcam and sends an alarm when someone is moving at my home. It is possible to enter time schedules when the camera should be enabled and when it shouldn&amp;rsquo;t. But that does not really work the way I wanted. When I come home earlier or even have a day off I have to disable the camera manually.&lt;/p&gt;&#xA;&lt;p&gt;So I decided that I want to use my smartphone to trigger the surveillance mode. Like most of us I always carry the phone with me. So it should be easy: If the phone is at home, I am, too. So the camera should be off. The same way when I am not at home.&lt;/p&gt;&#xA;&lt;p&gt;The solution for this was surprisingly simple: A small bash-script first checks if the phone is in the network. The Surveillance station cam gets enabled or disabled according to this one condition.&lt;/p&gt;&#xA;&lt;p&gt;But first things first. First of all, you should go to your routers admin interface and make sure, your phone will always have the same IP in your local WiFi. This works different on any reouter. On TP-Link it is called &amp;ldquo;reserve Ip&amp;rdquo;:&lt;img alt=&#34;Reserve IP TPLink&#34; class=&#34;gallery-image&#34; data-flex-basis=&#34;316px&#34; data-flex-grow=&#34;131&#34; height=&#34;420&#34; loading=&#34;lazy&#34; sizes=&#34;(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px&#34; src=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/reserveip_hu_ec0476895da7cc0d.png&#34; width=&#34;553&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;Now all you need is a Linux machine. I took a fresh Raspberry for this goal. Any simple distribution should be fine. We won&amp;rsquo;t need any special libraries.&lt;/p&gt;&#xA;&lt;p&gt;After you connected to your Raspberry (or other Linux) create the following shell script via vi (or any other tool you prefer):&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;user=&amp;#39;pi&amp;#39;&#xA;pass=&amp;#39;circle&amp;#39;&#xA;server=&amp;#39;sauger:5000&amp;#39;&#xA;phone=&amp;#39;192.168.0.7&amp;#39;&#xA;&#xA;dt=$(date &amp;#39;+%d/%m/%Y %H:%M:%S&amp;#39;);&#xA;cd $(dirname $0)&#xA;touch lgstate.txt&#xA;read oldValue &amp;lt; lgstate.txt&#xA;if ping -c 3 ${phone} | grep &amp;#39;bytes from&amp;#39;; then&#xA;  if \[ $oldValue != &amp;#39;isda&amp;#39; \]; then&#xA;    echo \[${dt}\] &amp;#39;stop recording&amp;#39;&#xA;    echo &amp;#39;isda&amp;#39; &amp;gt;lgstate.txt&#xA;    #login&#xA;    wget -q --keep-session-cookies --save-cookies cookies.txt -O- &amp;#34;http://${server}/webapi/auth.cgi?api=SYNO.API.Auth&amp;amp;method=Login&amp;amp;version=3&amp;amp;account=${user}&amp;amp;passwd=${pass}&amp;#34;&#xA;    #disable&#xA;    wget -q --load-cookies cookies.txt -O- &amp;#34;http://${server}/webapi/entry.cgi?api=SYNO.SurveillanceStation.Camera&amp;amp;method=Disable&amp;amp;version=3&amp;amp;cameraIds=1&amp;#34; &amp;gt;dev&amp;gt;null&#xA;    #logout&#xA;    wget -q --load-cookies cookies.txt -O- &amp;#34;http://${server}/webapi/auth.cgi?api=SYNO.API.Auth&amp;amp;method=Logout&amp;amp;version=3&amp;#34; &amp;gt;dev&amp;gt;null&#xA;  else&#xA;    echo \[${dt}\] &amp;#39;still there...&amp;#39;&#xA;  fi&#xA;else&#xA;  if \[ $oldValue != &amp;#39;iswech&amp;#39; \]; then&#xA;    echo \[${dt}\] &amp;#39;start recording&amp;#39;&#xA;    echo &amp;#39;iswech&amp;#39; &amp;gt;lgstate.txt&#xA;    #login&#xA;    wget -q --keep-session-cookies --save-cookies cookies.txt -O- &amp;#34;http://${server}/webapi/auth.cgi?api=SYNO.API.Auth&amp;amp;method=Login&amp;amp;version=3&amp;amp;account=${user}&amp;amp;passwd=${pass}&amp;#34;&#xA;    #enable&#xA;    wget -q --load-cookies cookies.txt -O- &amp;#34;http://${server}/webapi/entry.cgi?api=SYNO.SurveillanceStation.Camera&amp;amp;method=Enable&amp;amp;version=3&amp;amp;cameraIds=1&amp;#34; &amp;gt;dev&amp;gt;null&#xA;    #logout&#xA;    wget -q --load-cookies cookies.txt -O- &amp;#34;http://${server}/webapi/auth.cgi?api=SYNO.API.Auth&amp;amp;method=Logout&amp;amp;version=3&amp;#34; &amp;gt;dev&amp;gt;null&#xA;  else&#xA;    echo \[${dt}\] &amp;#39;still noone at home&amp;#39;&#xA;  fi&#xA;fi&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change &amp;ldquo;user&amp;rdquo; and &amp;ldquo;pass&amp;rdquo; in the beginning of the script with your user credentials. You can create a new user for this or use the &amp;ldquo;admin&amp;rdquo; - user. The user has to have admin rights sadly so don&amp;rsquo;t use this script on any machine that can be accessed by anyone but you.&lt;/p&gt;&#xA;&lt;p&gt;&amp;ldquo;server&amp;rdquo; is your server address enter the hostname (or ip) and port there&lt;/p&gt;&#xA;&lt;p&gt;&amp;ldquo;phone&amp;rdquo; is your phone&amp;rsquo;s IP-address&lt;/p&gt;&#xA;&lt;p&gt;So what does this script do?&lt;/p&gt;&#xA;&lt;p&gt;First it tries to ping your smartphone. If this is successful, it checks if this is the first time that works. If it isn&amp;rsquo;t the first time, nothing has to be done. But if the phone wasn&amp;rsquo;t accessable before it logs onto the synology and disables the camera using the web api.&lt;/p&gt;&#xA;&lt;p&gt;The same way it enables the camera if the phone cannot be contacted anymore.&lt;/p&gt;&#xA;&lt;p&gt;The script does only minimum outputs. If you run into problems, just remove the &amp;ldquo;&amp;gt;dev&amp;gt;null&amp;rdquo;  part on any line to get more information.&lt;/p&gt;&#xA;&lt;p&gt;Before you can start the script you should create an empty file where the state is saved by entereing&#xA;&lt;code&gt;touch lgstate.txt&lt;/code&gt;&#xA;You can run that script by entering &amp;ldquo;./pingPhone.sh&amp;rdquo; on the command line. You can watch the changes live in the Surveillance Station -View of the Synology. Changes are displayed instantly. You do not need to refresh the page.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img alt=&#34;cam1&#34; class=&#34;gallery-image&#34; data-flex-basis=&#34;426px&#34; data-flex-grow=&#34;177&#34; height=&#34;539&#34; loading=&#34;lazy&#34; sizes=&#34;(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px&#34; src=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/cam1_hu_51d66631dbf7787a.png&#34; srcset=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/cam1_hu_c4b0e092f271b69f.png 800w, https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/cam1_hu_51d66631dbf7787a.png 957w&#34; width=&#34;957&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you have more than one camera change the value of &amp;ldquo;cameraIds&amp;rdquo; to another value that is needed. You also can select multiple cameras by using commas: &amp;ldquo;&amp;amp;cameraIds=1,4,5&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;Finally if you want to run this script automaticly you can create a simple cronjob for it&lt;/p&gt;&#xA;&lt;p&gt;open&#xA;&lt;code&gt;crontab -e&lt;/code&gt;&#xA;and enter the following line:&#xA;&lt;code&gt;\*/15 \* \* \* \* /home/pi/pingPhone.sh &amp;gt;&amp;gt;/home/pi/pingPhone.log&lt;/code&gt;&#xA;(of course the path may differ on your system)&lt;/p&gt;&#xA;&lt;p&gt;Now the presence will be checked every 15 minutes and the cameras will enabled or disabled accordingly. Now all you have to do is to modify your time schedule in the surveillance station that the camera is always in detection mode.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img alt=&#34;cam2&#34; class=&#34;gallery-image&#34; data-flex-basis=&#34;443px&#34; data-flex-grow=&#34;184&#34; height=&#34;518&#34; loading=&#34;lazy&#34; sizes=&#34;(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px&#34; src=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/cam2_hu_873d5afd6c8b24c9.png&#34; srcset=&#34;https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/cam2_hu_15b29fbd01379668.png 800w, https://dotnet.work/blog/automate-your-synology-surveillancestation-with-some-simple-linux-commands/cam2_hu_873d5afd6c8b24c9.png 957w&#34; width=&#34;957&#34;&gt;&lt;/p&gt;&#xA;</description>
        </item></channel>
</rss>
