Sync 2 remote 2/3 or even more

someone asks here or on discord if it is possible to sync 2 R2 because he and his wife wanted to use each their own remote. I can now give the answer YES :rofl:

Because I do not have HA I try to explain it in general as I have implemented it in my home automation IP Symcon in PHP.

Requirements: 2 R2 of course, home automation running 24/7 and the integration HTTP-Post.

Add the entity HTTP-Post to each activity in the remote.

I use HTTP-Post to tell my home automation what to do in the form:§cmd=R1-R2-Start,UID=aefacc2e-6f9a-43a4-b2f3-d5df5a4c39a2
where cmd means R1 wants to start activity with the uid on remote 2. This command must be added to the start sequence of the activity in the first remote. And the same with command R1-R2-End to the end sequence of the activity. The uid must be the uid of the current activity in case you are using several activities…

After this was done in all activities make a backup and restore this backup in remote 2. In remote 2 you might have to repair all paired devices like Android TV. Change all HTTP-Post commands from R1-R2 to R2-R1 so that the home automation now take the UID and starts/end the activity on remote 1.

In my home automation I get the parameter from HTTP-Post in an array. If your home automation has no automatic function which does it then you have to decode the json string from the HTTP-Post in your script. My PHP script looks like this:

// 16532 Boolean Variable as Flag
if (GetValue(16532)){
    SetValue(16532, false);
// IP and Pin of the  Web-Configurator of both remotes
$IP1 = '';
$PIN1 = '5312'; 
$IP2 = '';
$PIN2 = '2044'; 

$kommando = $_POST['cmd'];
switch ($kommando){
    case "R1-R2-Start":
        $UID = $_POST['UID'];
        send_remote($UID, 'Start', $IP2, $PIN2);
    case "R1-R2-End":    
        $UID = $_POST['UID'];
        send_remote($UID, 'End', $IP2, $PIN2);
    case "R2-R1-Start":
        $UID = $_POST['UID'];
        send_remote($UID, 'Start', $IP1, $PIN1);
    case "R2-R1-End":
        $UID = $_POST['UID'];
        send_remote($UID, 'End', $IP1, $PIN1);

function send_remote($UID, $Start, $IP, $PIN) {
// Flag to true to avoid endless loop
    SetValue(16532, true);
    $ch = curl_init('http://' . $IP . '/api/entities/uc.main.'.$UID.'/command');
    $data['entity_id'] = 'uc.main.'.$UID;
    if ($Start == 'Start') $data['cmd_id'] = 'activity.on';
    else $data['cmd_id'] = '';
    $data_string = json_encode($data);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data_string))
    curl_setopt($ch, CURLOPT_USERPWD, 'web-configurator:' . $PIN);
    $result = curl_exec($ch);

Depending on cmd and UID you must now start/end an activity on remote 1 or 2 with an API call.

This would result in and endless loop because remote 1 will start remote 2 which then will start remote 1 again and then will start remote 2 again and so on. To prevent this behavior set a boolean flag to true if you call the API and at the beginning of the script check if flag is true and in case of true set flag to false and exit the script.

I hope it was understandable as I am not native english speaking. An explanation in German for IP Symcom can be found at YIO Remote Two auf Kickstarter - #46 von HarmonyFan - Projekt Showcase - IP-Symcon Community


1 Like

when upload of integration it will be a bit simpler as the IP of the remote could be extracted and a backup could be used without changes.

btw. When I had the idea with sync start worked the same day but end failed. It took me 3-4 days to find out why. I tested with my Phlips AndroidTV TV which has separate switch_on/_off which are (almost) working as expected. Pressing switch_off twice with only a short pause will cancel switch_off and the device stays powered on. It might be a “feature” of my Philips Ambilight TV but it can be also a feature of AndroidTV.