unfoldedcircle / feature-and-bug-tracker

Feature and bug tracker repository for Unfolded Circle products
21 stars 0 forks source link

[feature request] Paring 2 different RC2 remotes to the same device #362

Closed albaintor closed 2 months ago

albaintor commented 3 months ago

Is there an existing issue for this?

Description

Actually, when we register the remote to a device through IP which requires pairing, the RC2 sends its name "Remote Two" or something like that to the device (Apple TV or Android TV). This name has to be unique from the device point of view, so that if we pair again to the same device, but from a different remote, it will erase the pairing key and the former remote won't be able to access to the device. This situation is not so common but easy to fix : you could concatenate the mac address of the host which host the driver (the remote or the external host for external driver) or another unique identifier (serial number or so) so that the pairing won't be dedicated to only one Remote Two

AFAIK, this concerns only AppleTV and AndroidTV integrations. I'll try to submit a PR

Additional context

No response

albaintor commented 3 months ago

Proposition :

from getmac import get_mac_address as gma
...
mac_address = gma()

Then for Android TV, tv.py :

self._atv: AndroidTVRemote = AndroidTVRemote(
            client_name="Remote Two "+mac_address,
            certfile=self._certfile,
            keyfile=self._keyfile,
            host=host,
            loop=loop or asyncio.get_running_loop(),
        )

And for AppleTV, in tv.py too :

self._pairing_process = await pyatv.pair(self._pairing_atv, protocol, self._loop, name=(name + mac_address))
zehnm commented 3 months ago

Done for Android TV: https://github.com/unfoldedcircle/integration-androidtv/issues/39

zehnm commented 3 months ago

Android TV integration has been fixed in v0.5.0. It can now be controlled simultanously by multiple remotes. Apple TV is already controllable by multiple remotes at the same time. The paired devices list is just a bit confusing :-) atv-pairing

I'll change it to use the same unique hostname identifier (which includes the MAC address) as in the Android TV integration.

zehnm commented 3 months ago

Included in the just released beta firmware 1.7.9 and will be part of the next public release.

albaintor commented 2 months ago

Thank you it works !