TroX-oO / homebridge-freemote

This Homebridge plugin exposes Freebox v6 remote to Apple's Homekit.
3 stars 4 forks source link

Power command issues #1

Closed Erokani closed 5 years ago

Erokani commented 6 years ago

Hi,

First, a big thanks for your plugin! I’m running it every day via some automation rules to power it up & down and via the voice to select channels :)

Among the time I spotted 2 issues that you may be in position to fix:

Thank you in advance Kind regards, Mat

Note: I have an HomePod as HomeKit Hub, and homebridge running on a Synology NAS.

TroX-oO commented 6 years ago

Hi, i'm glad that you enjoy this plugin :)

Unfortunately, I don't have a Freebox anymore so I'm not using it since almost a year. Indeed, there are some power issues cause the Freebox API does not provide a way to know if the Player is powered on or not. There is a trick using wether or not a AirMedia is currently playing or not. (If yes, the player is On, otherwise it's Off). But it is quite buggy.

That is why the power command is weird under certain conditions. I don't know if Free does something to change this behaviour but, at the moment, I didn't find better ways to do it.

For your first problem, if it's need several tries, it is because it didn't get response whether or not the Freebox Player is currently On.

For your second, the plugin is a little "silly". The power command is literally "Press power button, then press Ok after 5 seconds".

I supposed that the freebox would power on into the main menu, not the replay screen. Once again, I don't know if the API provide a way to know in which menu the freebox is. (I don't think there is) So maybe, a trick would be to press the home button in between to be sure that the Freebox is on the main menu.

If you wish to do so, try replacing in FreemoteApi.js line 150

          .then(function() {
            setTimeout(self.remote.bind(self, 'ok'), 5000);
          });

by

          .then(function() {
            setTimeout(self.remote.bind(self, 'home'), 5000);
            setTimeout(self.remote.bind(self, 'ok'), 8000);
          });

as a consequence, your startup time will be a little bit longer (you can try different value to adjust and get the minimum possible)

I hope this helps.