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 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).

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 %