Tips Amazing Broadlink Mini R3 with Google Home

I have just configured a Broadlink Mini R3 to be used within Google Home's scenario to control several devices. Works really like a charm !

Click to Read More

It's just amazing that this little device can perfectly remote control my projection screen 7 meters away, the projector 2 meters away on the ceiling and the ampli which is in the room but not in sight.

I bought 3 of them from China for 13€ each.

Quick memo about how to configure them:

  • First step, install the App "ihc for EU" (special version compatible with GDPR for EU) to detect the device, assign it to the right room and add appliances (either from the library available out of the box or custom ones)
    • Attention: if you change later the room assigned to the RM mini 3 in the app, you loose all the appliances configured with it.
  • Next, configure some scenes to be used via Google Home. Their name will be used by Google Assistant.
  • Then, make the mini R3 accessible via your Google Assistant : Go to "Google Home" and "click Add" > "Setup a device" > "Works with Google". There, link your "BroadLink Smart Home for EU" account with Google Home
  • Finally, use 'in french' : "Ok Google, active {le|la|l'} <xxx>" where <xxx> is the name of a scene and "le", "la", .. is optional
Google Home Add Device

Google Home Add Device

Tip:

  • use "Ok Google, synchronise les appareils" to refresh the name of the scene in Google Home if you did rename them in the "ihc" app.
  • use scenario ("routines") in Google Home to combine "IFTTT actions", "scenes of other products like Philips Hue" and scenes from "Broadlink".

Using the "ihc" app, you can update the firmware: click on the RM mini > the three dot in the top-right corner > "Check for firmware updates"

To configure an appliance, don't hesitate to use one which does not work perfectly. At least, you will have all the related icons and be able to reconfigure them. Creating a "UserDefine" appliance, you won't have many different icons available. Also, the configuration of  "UserDefine" appliance can't be "backuped". Not problem however to use "UserDefine" appliances in "scenes" to be called from Google Home.

Once an appliance added, you can reconfigure the buttons: click on the appliance > the three dot in the top-right corner > Learn

Don't forget to backup the settings of your appliances once reconfigured!!! It's the best ways to reuse them on other RM mini later: click on the appliance > the three dot in the top-right corner > Backup IR code sets

Tips Easily connect Ikea Tradfri bulbs on Philips Hue Bridge

I did spent a lot of time trying to connect Smart/Cheap Ikea bulbs on my Philips Hue Bridge.

I finally found an easy way: use the Android App HueDynamic !

Click to Read More

First, you must be sure to have Ikea Tradfri bulbs with a firmware >= 1.2.x

To be sure about the firmware of Ikea bulbs, no choice but buy the Ikea Bridge and at least one Ikea Remote, then connect the bulb to the Android App "Tradfri". If the firmware is obsolete, then the App can be used to trigger an update. But my experience is that even to connect the Ikea bulbs with their App, it's a real pain in t.... Also, before connecting next the bulbs to the Philips Hue Brige, you will have to disconnect them from any Ikea remote and from to the App "Tradfri" (Check here).

An option is however to check the batch id of the production, on the box. It is said that all bulbs produced with a batch id equal or above 1721 should have a firmware compatible with the Philips Hue Bridge.

Here a sample of Ikea bulbs with a batch id 1733. I bought 6 of those and had (nearly) no issue to connect them.

Ikea Tradfri Batch Id

Ikea Tradfri Batch Id

Once you have a bulb with adhoc firmware, turn it on and place it very close to your Philips Hue Bridge (less than 2 cm ;). The easiest for that is to use a cable like this one (I did one myself):

Cable with adapter E14

Cable with adapter E14           

The bulb being on and next to the Hue Bridge, open the App HueDynamic and click on the three horizontal lines in the upper-left corner to open the menu. Then scroll down to the "Settings" section and pick the entry "Lights":

Click on the sign +, in the top-right corner to add the bulb:

And select the option "With TouchLink" (This is the magic trick !!):

Now, press the "TouchLink" button of your Philips Hue Bridge:

The App HueDynamic will search for the bulb during 1 or 2 minutes... Once in touch with the bulb, this one will start to dim and bright several times before finally turning off. The App will continue to search for several minutes (for other bulbs) after that. When it stops to search, you see the bulb found on the screen. Accept it !

Notice that this process failed for one of my bulb (out of 6). I tried twice and got each time the message here under:

But when I came back to the list of bulbs, I saw that the bulb was actually in the list (Maybe I did something wrong without noticing ?!).

Since the bulbs are connected, I have been able to combine them into rooms and control them with Philips Hue Motion Sensors. They work great so far !

NB.: I read that Ikea remotes may not be used as once connected to a bulb, the bulb disappear from the Philips Hue Bridge... I didn't try that yet and won't ;)

Tips Reinstall Apps, Themes and Watch faces purchased on Samsung Galaxy Story

After reinstalling my Gear S2 to connect it with a new Galaxy phone, I couldn't find how to reinstall watch faces bought years ago.

This can be done using the "Galaxy Store" app.

Click to Read More

  1. "Galaxy Store" is an app preinstalled on Galaxy phones. Open it (Configuring your Samsung account if not yet done).
  2. Tap the 3 vertical dots on top right of screen
  3. Select "My page" (previously named "My Apps").
  4. Select "All"
  5. Select the Watch, Apps or Themes
  6. Then re-download what you wish.

To manage your Watch, install the "Galaxy Wearable " App (previously named Galaxy Gear) via the Google App Store.

Tips Tips and tricks in French to use Philips Hue via Google Home

Here is a list of a few tips & tricks to use the Bulbs of Philips Hue with a French Google Assistant.

Click to Read More

Synchronize Google Home and Philips Hue to see new Bubbles

Prerequisite: link Google Home with your Philips Hue account.

Reminder: Open the "Google Home" App. In the top part of the screen, there are various icons under the name of your house: "Eteindre" (Off), "Allumer" (On), "Lire" (Play) , "Ajouter" (Add), "Paramètres" (Settings) .... Click on "Ajouter" (Add) >  "Configurer un appareil" > "Fonctionne avec Google". This is opening a screen to manage the linked accounts. Philips Hue must be added.

Assuming that you have already linked Google Home with your Philips Hue account, when you add bubbles via the Philips Hue App, they don't appear immediately in Google Home. To force Google Home to sync with Philips Hue, say "Ok Google" or "Dis Google". Then "Mets à jour les lumières", "Mets à jour les lampes" or "Synchronise les appareils".

It's quite weird but the following sentences don't work: "Mets à jour les appareils", "Synchronise les lumières", "Synchronise les lampes". Google answer that you have to use Google Home for that...

Turn off and on only some Bubbles in a room

With Google Home, it's currently not possible to create several groups of Bubbles in a room. It's also not possible to include a Bubble within several rooms (if you want to use fake rooms to group your bubbles). But as a trick, you can create a "Scenario" (Scene) to turn off or on any subset of Bubbles.

Open the Philips Hue App and tap the room containing the Bubbles to group. Once the room opened, tap "Nouveau Scénario" (New Scene).

On the color picker (color or white disc), you see your lamps (a bubble or small circles with the amount of bubbles, one bubble or circle per type of lamp - color or white). Tap the circle representing several bubbles to access each bubble individually and define its rightness or its state on/off in the Scene. You can decide to have x lights on, y lights off and z lights dimmed to 50%.

Name that new scene like "les lumières XYZ" (the lights XYZ). Once Google Home and Philips Hue synchronized, you will be able to tell "Ok Google", "Active les lumières XYZ" (Activate the lights XYZ).

Synology Capture a Synology Package during installation

This is an update of a previous post on this topic.

I noticed that since a recent update of DSM, my previous script was not working fine anymore, when trying to capture a spk during installation. So here is an improved version.

Click to Read More


#!/bin/bash
VOLUME=$1
TARGET=$2

#Copy also the expanded package ?
COPYEXPAND=false

if [ -z "$VOLUME" ]; then
echo "usage: capture <source VOLUME> <target dir>"
exit 0
fi

if [ -z "$TARGET" ]; then
echo "usage: capture <source VOLUME> <target dir>"
exit 0
fi

pattern="volume[0-9]+"
if [[ ! $VOLUME =~ $pattern ]]; then
echo "The name of the source volume must be like 'volume<i>' where <i> is numeric"
exit 0
fi

if [ ! -d "/$VOLUME/@tmp" ]; then
echo "Temporary dir not found: /$VOLUME/@tmp"
exit 0
fi

if [ -d "/$VOLUME/@tmp/SynoCapture" ]; then
rm -R "/$VOLUME/@tmp/SynoCapture"
fi

if [ -d "/$VOLUME/@tmp/@synopkg" ]; then
rm -R "/$VOLUME/@tmp/@synopkg"
fi

echo "Press any key to stop the capture"

if [ -t 0 ]; then stty -echo -icanon -icrnl time 0 min 0; fi

count=0
keypress=''
echo "Going to copy the packages into $TARGET/SynoCapture"

if [ ! -d "$TARGET/SynoCapture" ]; then
mkdir "$TARGET/SynoCapture"
fi

while [ "x$keypress" = "x" ]; do
if [ -d "/$VOLUME/@tmp/@synopkg/@download/" ]; then
cp -nlR "/$VOLUME/@tmp/@synopkg/@download/." "/$VOLUME/@tmp/SynoCapture/"
fi

if [ "$COPYEXPAND" = true ]; then
if [ -d "/$VOLUME/@tmp/pkginstall/" ]; then
cp -nlR "/$VOLUME/@tmp/pkginstall/." "/$VOLUME/@tmp/SynoCapture/pkginstall/"
fi
fi
let count+=1
echo -ne $count'\r'
keypress="`cat -v`"
done

if [ -t 0 ]; then stty sane; fi

find "/$VOLUME/@tmp/SynoCapture/" -type f -name '@SYNOPKG_DOWNLOAD_*' -exec sh -c 'x="{}"; mv "$x" "${x}.spk"' \;
if [ "$COPYEXPAND" = true ]; then
if [ -d "$TARGET/SynoCapture/pkginstall" ]; then
rm -R "$TARGET/SynoCapture/pkginstall"
fi
fi
cp -fR "/$VOLUME/@tmp/SynoCapture" "$TARGET/"
rm -R "/$VOLUME/@tmp/SynoCapture"

echo "$count captures done"
exit 0

Now the script will copy only the SPK file into the specified target folder. It's also possible to copy the expanded version by setting the variable COPYEXPAND=true

Also, now, I don't find anymore a folder name "pkglist.tmp" containing files synoserver.enu and otherserver.enu. Those files used to contain the URL's of all SPK available respectively on the official Synology website and on the various SPK servers that you configured in your Package Center > Settings > Package Sources.

To make the capture even easier, I have create a Package named "MODS Package Capture, available on my SPK Server and published on GitHub.

Synology Can't install/uninstall/repair Synology Virtual Machine Manager - Upgrade DSM not possible

I was unable to upgrade my DSM from 6.1.7 to 6.2.1 because it was pretending to be member of a Virtual Machine Manager cluster. Which was not correct as Virtual Machine Manager was not installed 'anymore'.

Click to Read More

I used to test the beta version of Virtual Machine Manager a long time ago. But since a while, Virtual Machine Manager is not installed anymore on my Synology and it was clearly visible neither in the DSM menu nor in the Package Center.

Unfortunately, for some unknown reasons, my DSM thought that it was still part of Virtual Machine Manager cluster. As a consequence I was getting the following warning when upgrading my DSM: "This device is part of a Virtual Machine Manager cluster. Other hosts in the Virtual Machine Manager cluster will also need to be updated".

Trying to upgrade was always failing (without breaking my DSM, fortunately).

I initially thought it could possibly be due to the network Bond I did create. So I tried to remove it via Control Panel > Network. But it failed with the message : "Creating or deleting this bond is prohibited because the operating interfaces includes the cluster interface of Virtualization. Please shutdown these quests and try again: {0}. Creating or deleting the bond is prohibited because of abnormal status of Virtualization cluster, please go to Virtual Machine Manager see the details."

Based on this message, and since it was not installed anymore, I tried to reinstall the Virtual Machine Manager. Unfortunately, the installation was failing and the package was stuck in a "repair" status.

Being unable to 'repair' it by clicking on the "Repair" button, I tried to uninstall it. This was also failing, with the following message: "You cannot remove this package because this Synology NAS is a part of a Virtual Machine Manager Cluster. Please remove the host from the cluster to proceed."

Argh !!!

Bref... I tried to 'erase' the package using my own Package Manager (See my SSPK server). It's doing something similar to the trick explained here to delete all files related to the 'Virtualization' package.

Once the package fully erased, I did reinstall it again but still without any success... And again it was stuck in a "repair" status and I was unable to uninstall it properly.

 

As I couldn't find any config file where I could see that my NAS was a member of a Virtual Machine Manager cluster, I tried to fix myself the installation of the package. I couldn't really fix it (I couldn't see which step of which installation or upgrade script was failing). But I have been able to force the installation to complete by deleting the file '/var/packages/Virtualization/installing'.

Next, the package Virtual Machine Manager appeared in status 'Installed' but 'stopped'. I was however able to "Start" it without any problem !! I could see in this Manager that my NAS indeed used to be configured as a member of cluster.

And, miracle (even without deleting the cluster), running now the upgrade of my DSM finally succeeded !!!

After the upgrade, I did remove my NAS from the cluster.

Et voilà.

[PS] I did use the Virtual Machine Manager a long time ago to test how Windows was running in a VM. It was a bit too slow for me so I did remove the Virtual Machine Manager. Probably that the cluster was not deleted at that time. Hence all the problems here above.

[Edit] Once the DSM upgraded, I did delete the Virtual Machine Manager cluster. But as a consequence, I did lost all connections onto the NAS (ftp, web, plex, ssh, ...). I was only able to see the NAS using the Synology Assistant. TO solve the problem I did shutdown the NAS by pressing the power button for a long period. After the reboot, everything as working fine. No, starting the Virtual Machine Manager, it starts a wizard to create a new cluster.

Synology Search for file on Linux using grep and find

Search for files containing a certain text, on my Synology, ignoring warnings like ' Permission denied'

Click to Read More

Just a note for myself... as I always forgot the syntax :/

Using grep only

grep -rnlw '/path/to/somewhere/' -e 'pattern' 2>/dev/null

grep -rnlw 'text' '/path/to/somewhere/' 2>/dev/null

  • -r or -R is recursive,
  • -n is line number, and
  • -w stands for match the whole word.
  • -l (lower-case L) can be added to just give the file name of matching files.

Using find

find '/path/to/somewhere/' -type f -exec grep "text" '{}' \; -print

Synology Find and kill all tasks running for a service/package on a Synology

I wanted to kill all tasks running on my Synology for a package before uninstalling this one. Here is the how-to:

Click to Read More

The tasks running for a service are all listed in /sys/fs/cgroup/cpuacct/[the service]/tasks

The service can be pgsql, nginx, nmbd, ftpd, sshd, ... or synotifyd, synologd, synobackupd, ... or a package like pkgctl-CloudSync, pkgctl-AudioStation, pkgctl-SurveilanceStation, ...

Ex.:

  • To see all tasks running for Synology's StorageAnalyzer, type something like: cat /sys/fs/cgroup/cpuacct/pkgctl-StorageAnalyzer/tasks
  • To kill all those tasks, type something like: for task in $(cat /sys/fs/cgroup/cpuacct/pkgctl-StorageAnalyzer/tasks); do kill $task; done

Synology License and installation wizard not shown when installing Synology Package

I noticed this morning that my Synology is not showing the License and the Installation Wizard anymore when installing my own Packages (Packages made with my app MODS and hosted on my own SSPK Server).

Click to Read More

I am not yet able to understand why the Installation Wizards and the Licence file of my own packages are not shown anymore, when installing them from my SSPK server via "Package Center" > "Community". But everything works fine when installing them "Manually" via "Package Center" > "Manual Install" (and browsing to pick the spk into the folder of my SSPK server).

The Upgrade Wizards and even the "Confirm settings" screen are also not displayed... While the Uninstallation Wizard works fine in all cases ?!

My DS1815+ is running DSM 6.1.7-15284.

I have compared all the logs created in /var/log/ during the installation and noticed a few differences. First, when installing a package from my SSPK server, there are 'messages' being logged:

2018-11-03T22:26:05+01:00 ... synoscgi_SYNO.Core.Package.Installation_1_install[21663]: resource_api.cpp:163 Acquire service-cfg for [the package I am installing] when 0x0001 (done)

This is logged each time I am installing a package from my SSPK Server but not when install the same package manually.

Next to those messages, the following INFO are also logged in synofeasibilitycheck.log:

2018-11-03T22:25:50+01:00 ... synoscgi_SYNO.Core.Package_1_feasibility_check[21529]: feasibility_check.cpp:87 FeasibilityCheck: [Info] Start feasibility check [package_install] with type [hard].
2018-11-03T22:25:50+01:00 ... synoscgi_SYNO.Core.Package_1_feasibility_check[21529]: feasibility_check.cpp:106 FeasibilityCheck: [Info] [0] of feasibility check [package_install] failed.
2018-11-03T22:25:50+01:00 ... synoscgi_SYNO.Core.Package_1_feasibility_check[21529]: feasibility_check.cpp:79 FeasibilityCheck: [Info] No [package_install] feasibility check config with type [soft].

 

Programming Call a php webpage from a IFTTT applet using Google Assistant

I wanted to be able to wake up PC on my Lan using voice commands. To achieve that, I did implement a solution using Google Assistant, IFTTT and a php web page hosted on my NAS.

Click to Read More

Regarding IFTTT, you must have an account. Then,

  • Create a new applet,
  • Choose the service "Google Assistant"
    • Choose a trigger, ex.: "Say a phrase with a text ingredient"
    • Type a phrase in "What do you want to say?" such as "Wake up my PC $" ($ is the symbol to be used for the "ingredient")
    • Type a phrase in "What do you want the Assistant to say in response?" such as "Ok, I will wake up $"
  • Choose next an action service "Webhooks" (to "make a web request")
    • Type the url of your web page: http://<public Ip of your NAS>/<some path>/action.php?do=wakeup&param={{TextField}} ({{TextField}} will take the value of the ingredient)
    • Chose the "method": GET
    • Chose the "content type": text/plain

Regarding the php web page (action.php), I had to do some fine tuning... So, I started with a page logging all information received from IFTTT:

</pre>
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile
{
public function execute($targetFile)
{
$boby = json_decode(file_get_contents('php://input') , true);

$data = sprintf("<h2><u>IFTTT call at %s on %s</u></h2><h3>Method:</h3>", date('h:i:s') , date('d/m/Y'));
$data .= sprintf("<blockquote>%s (%s): %s </blockquote><h3>HTTP headers:</h3><ul>", $_SERVER['REQUEST_METHOD'], $_SERVER['SERVER_PROTOCOL'], htmlentities($_SERVER['REQUEST_URI']));
foreach ($this->getHeaderList() as $name => $value)
{
$data .= "<li><b>" . $name . '</b>: ' . $value . "</li>";
}

$data .= "</ul><h3>Post:</h3><ul>";
foreach ($_POST as $key => $value) $data .= "<li>" . $key . '=' . $value . '</li>';

$bodyhtml = $this->jsonToTable($boby);
$data .= "</ul><h3>Request body:</h3><blockquote>$bodyhtml</blockquote>";

$action = trim(strtolower($_GET['action']));
$action = preg_replace('/^ *de +/', '', $action);
$action = preg_replace('/^ *d *\' +/', '', $action);

$param = trim(strtolower($_GET['param']));
$param = preg_replace('/^ *de +/', '', $param);
$param = preg_replace('/^ *d *\' +/', '', $param);

$data .= "<h3>Requested Action:</h3><blockquote>$action: $param</blockquote>";

similar_text(strtolower($param) , "zeus", $percent);
$data .= "Zeus: $percent %<br>";

similar_text(strtolower($param) , "chaos", $percent);
$data .= "Chaos: $percent %<br>";

file_put_contents($targetFile, $data . file_get_contents($targetFile) . "\n");

echo (nl2br($data));
}

private function getHeaderList()
{
$headerList = [];
foreach ($_SERVER as $name => $value)
{
if (preg_match('/^HTTP_/', $name))
{
// convert HTTP_HEADER_NAME to Header-Name
$name = strtr(substr($name, 5) , '_', ' ');
$name = ucwords(strtolower($name));
$name = strtr($name, ' ', '-');
// add to list
$headerList[$name] = $value;
}
}
return $headerList;
}

private function jsonToTable($data)
{
$table = "<table class='json-table' width='100%'>";
foreach ($data as $key => $value)
{
$table .= "<tr valign='top'>";
if (!is_numeric($key))
{
$table .= "
<td>
<strong>" . $key . ":</strong>
</td>
<td>
";
}
else
{
$table .= "
<td colspan='2'>
";
}
if (is_object($value) || is_array($value))
{
$table .= jsonToTable($value);
}
else
{
$table .= $value;
}
$table .= "
</td>
</tr>
";
}
$table .= "</table>";
return $table;
}
}

(new DumpHTTPRequestToFile)->execute('./action.html');

?>
<pre>

The log is stored in a html page "log.html".

Notes:

  • I notice that Google was not good at recognizing the name of my PC (IMO because I use French sentences). So I am using a php command "similar_text" to evaluate the "ingredient". But this is really far from effective.
  • I tried to use a "POST" method instead of "Get" and a Content Type "application/json", it works. But when I add a Body like {“token”:”mseries”,”command”: “<<<{{TextField}}>>>”, ”test”: “data”}, I don't see it received by my php page :(
  • If Google Assistant does not call correcly IFTTT, look at you voice command history to be sure it understood you order: https://myactivity.google.com/myactivity?restrict=vaa&utm_source=help
  • If Google Assistant understood correctly your command, but IFTTT didn't call your web page, look at your IFTTT activity: https://ifttt.com/activity

A log for a call using a GET method will look like:

IFTTT call at 11:32:29 on 25/09/2018

Method: GET (HTTP/1.1): /ifttt/action.php?action=wakeup&param=CARROS

HTTP headers:

X-Newrelic-Transaction: PxQGUlECCwFRBVEEVQAAAlQTGlUDChAHHEAJVA1cAgMKA1gEVFNVUVUHFU1EAQACBV1UBlUTag==
X-Newrelic-Id: VwAOU1RRGwAFUFZUAwQE
Content-Type: text/plain
Content-Length: 74
Connection: close
Host: olympe.letroye.be
X-Real-Port: 55748
X-Port: 80
X-Real-Ip: 54.164.110.125
X-Forwarded-By: 192.168.0.200

Post:

Request body:

Requested Action: wakeup: CARROS

Zeus: 20 %
Chaos: 72.727272727273 %

A log for a call using a POST method with application/json content-type will look like:

IFTTT call at 11:41:14 on 25/09/2018

Method: POST (HTTP/1.1): /ifttt/action.php?action=wakeup&param=Kaos

HTTP headers:

X-Newrelic-Id: VwAOU1RRGwAFUFZUAwQE
Content-Type: application/json
Content-Length: 77
Connection: close
Host: olympe.letroye.be
X-Real-Port: 59892
X-Port: 80
X-Real-Ip: 54.211.16.53
X-Forwarded-By: 192.168.0.200

Post:

Request body:

Requested Action: wakeup: kaos

Zeus: 25 %
Chaos: 66.666666666667 %