neilpatel121 / homebridge-skyq-tvremote

Apache License 2.0
10 stars 3 forks source link

Switch channels via Siri #20

Closed michel0271 closed 3 years ago

michel0271 commented 3 years ago

Hello, will it be possible to switch channels via Siri in a future version? I already have such a plug-in for my Sony TV and it is then implemented using scenes. Greetings Michel

neilpatel121 commented 3 years ago

Can you please let us know the plugin name so we can see their source code as a reference implementation

michel0271 commented 3 years ago

@neilpatel121 Thank you for your prompt reply!

With pleasure, Homebridge Bravia Tvos - https://github.com/SeydX/homebridge-bravia-tvos#readme

greetings michel

P.S: skyq-tvremote - great job !!!

neilpatel121 commented 3 years ago

Thanks, what Siri command do you use to change the channel, can you type the command pls

michel0271 commented 3 years ago

@neilpatel121 I've set up a scene for each channel. And then I say over my homepod, Hey Siri activate RTL as an example. Everyone can determine that themselves when setting up the scene :-)

michel0271 commented 3 years ago

@neilpatel121 In my case, of course, in German. But the Sony plug-in works in all languages, as I understand it.

neilpatel121 commented 3 years ago

Ok I think I understand how you got it work, there is an alternative way you can do this, which I use all ready, I expose channels as switches in the home app, then you can use Siri to control the switch,

neilpatel121 commented 3 years ago

Take a look at this https://github.com/AdamSwinden/homebridge-sky-q#readme

neilpatel121 commented 3 years ago

This is what I use to use Siri to change sky channels

michel0271 commented 3 years ago

@neilpatel121 I don't understand that again now. After adding them to the home app, no channels can be seen in your plug-in at all. The Sony plug-in pulls the channels out of the TV and I can then use them for scenes.

Ah okay ... have only now received your link ... so that will also work with your plug-in. I'll try it out tomorrow, hopefully I'll make it. The Sony is so beautifully simple :-)

SmolSoftBoi commented 3 years ago

I've added the feature to switch channels.

Could you test v1.2.0-beta.1 please?

michel0271 commented 3 years ago

@EpicKris Very happy but how do I find the beta and how do I install it?

SmolSoftBoi commented 3 years ago

@EpicKris Very happy but how do I find the beta and how do I install it?

Are you using Hombridge Config UI X?

michel0271 commented 3 years ago

@EpicKris Very happy but how do I find the beta and how do I install it?

Are you using Hombridge Config UI X?

yes, v4.41.0

SmolSoftBoi commented 3 years ago

yes, v4.41.0

Go to the Plugins tab, select the tool (right of Settings), select Install Previous Version, select the latest beta, then select select Install.

You'll need to revert to the latest version manually after testing.

SmolSoftBoi commented 3 years ago

Could you test 1.2.0-beta.3?

michel0271 commented 3 years ago

@EpicKris Hi, I installed the last beta and I can now turn Sky Q on and off again. So the connection is there. But there are no channels to be seen. greetings michel

SmolSoftBoi commented 3 years ago

Could you test 1.2.0-beta.5 please?

SmolSoftBoi commented 3 years ago

Could you include your Homebridge logs please?

SmolSoftBoi commented 3 years ago

Have you tried removing and re-adding the TV since using the latest beta?

michel0271 commented 3 years ago

Have you tried removing and re-adding the TV since using the latest beta?

the TV? no why? It has nothing to do with the Sky Q Box, does it? But I deleted the Sky Q Box and added it again to test it. The Sky Q receiver is connected via HDMI 3 and the type of reception is cable

SmolSoftBoi commented 3 years ago

Could you include your Homebridge config.json please?

SmolSoftBoi commented 3 years ago

The logging is a lot less chatty now thanks.

The issue with the inputs not appearing after a restart and requiring the home app to be killed and reopened persists. There is also an error thrown if you select the input:

[25/04/2021, 12:20:22] [skyq-tvremote] [Sky Q Mini] Set Input: 101
[25/04/2021, 12:20:22] [homebridge-skyq-tvremote] This plugin threw an error from the characteristic 'Active Identifier': Unhandled error thrown inside write handler for characteristic: input.split is not a function or its return value is not iterable. See https://git.io/JtMGR for more info.

Originally posted by @benfysh in https://github.com/neilpatel121/homebridge-skyq-tvremote/issues/19#issuecomment-826308203

michel0271 commented 3 years ago

The logging is a lot less chatty now thanks.

The issue with the inputs not appearing after a restart and requiring the home app to be killed and reopened persists. There is also an error thrown if you select the input:

[25/04/2021, 12:20:22] [skyq-tvremote] [Sky Q Mini] Set Input: 101
[25/04/2021, 12:20:22] [homebridge-skyq-tvremote] This plugin threw an error from the characteristic 'Active Identifier': Unhandled error thrown inside write handler for characteristic: input.split is not a function or its return value is not iterable. See https://git.io/JtMGR for more info.

Originally posted by @benfysh in #19 (comment)

okay and that means what now? Can the problem be solved?

SmolSoftBoi commented 3 years ago

@michel0271 Could you visit http://192.168.178.40:9006/as/services and include the data here please?

SmolSoftBoi commented 3 years ago

@benfysh Could you test 1.2.0-beta.6 please?

michel0271 commented 3 years ago

@benfysh Could you test 1.2.0-beta.6 please?

testet... the same... no Channels, on/ off Works

SmolSoftBoi commented 3 years ago

Could you test 1.2.0-beta.7 please?

michel0271 commented 3 years ago

Could you test 1.2.0-beta.7 please?

tested, now we can no longer find the Sky Q Box on Homebridge and in the HomeApp

SmolSoftBoi commented 3 years ago

Could you include your Homebridge logs please? Please truncate them to only the latest run.

SmolSoftBoi commented 3 years ago

I'm not seeing any errors.

@benfysh Could you confirm this please?

michel0271 commented 3 years ago

I installed Beta 7 again. Sky Q can now be seen in HomeBridge, but it does not appear in the HomeApp

michel0271 commented 3 years ago

I'm not seeing any errors.

@benfysh Could you confirm this please?

Now I have installed the normal version again and I can no longer add this to the Home App either. IP address has stayed the same from Sky Q. Could it be that Apple blocks it after too many attempts? Or that there are problems at Apple?

SmolSoftBoi commented 3 years ago

Now I have installed the normal version again and I can no longer add this to the Home App either. IP address has stayed the same from Sky Q. Could it be that Apple blocks it after too many attempts? Or that there are problems at Apple?

Remember that TVs are external accessories, you may need to re-add it.

michel0271 commented 3 years ago

Remember that TVs are external accessories, you may need to re-add it.

nothing to be done, I installed the normal version 1.2.0 now. Sky Q Box can also be seen in Homebridge. But I can no longer add the box to the Home app.

SmolSoftBoi commented 3 years ago

Try Homebridge Settings > Remove Single Cached Accessory.

benfysh commented 3 years ago

Basic plugin functionality is working as expected (Beta 7). This issue still persists https://github.com/neilpatel121/homebridge-skyq-tvremote/issues/19#issuecomment-826276471

With regards to the channels as input. When you select ''BBC One Yorks' it seems to send 101 twice and sometimes ends up on 110 as opposed to 101. The input then gets stuck on ''BBC One Yorks' and requires a restart in order to reset.

Logs shown when selecting input are displayed below:

[25/04/2021, 14:15:16] [skyq-tvremote] [Sky Q Mini] Set Input: 101
[25/04/2021, 14:15:16] [skyq-tvremote] [Sky Q Mini] Set Input: 101
[25/04/2021, 14:15:16] [skyq-tvremote] Error: This callback function has already been called by someone else; it can only be called one time.
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:6:13
    at /usr/local/lib/node_modules/homebridge-skyq-tvremote/src/platform.ts:146:95
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:4069) UnhandledPromiseRejectionWarning: Error: This callback function has already been called by someone else; it can only be called one time.
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:6:13
    at /usr/local/lib/node_modules/homebridge-skyq-tvremote/src/platform.ts:148:17
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:4069) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
michel0271 commented 3 years ago

@EpicKris At least the channel is switched even if it is wrong. However, switching only worked once.

SmolSoftBoi commented 3 years ago

Could you test 1.2.0-beta.8 please?

michel0271 commented 3 years ago

Could you test 1.2.0-beta.8 please?

Tested, unfortunately the same again. When setting up in the Home App, Sky One HD was suggested which I left that way. This time the one-time switching does not work either. On / off works. I have a real guilty conscience, you are trying so hard for me ... sorry. You're great!

SmolSoftBoi commented 3 years ago

Please, don't apologise, it would be a great feature for this plugin.

Could you include your logs please?

benfysh commented 3 years ago

Beta 8 working here will change to 101 reliably now with no error in the logs. However it is still getting 'stuck' on ''BBC One Yorks' as the selected input showing on the tile after changing channels / power cycling the box and this remains even if you kill and reopen the home app requiring a homebridge restart in order to reset to blank.

I am not sure what the expected behaviour is or if you can get the currently tuned channel in order to correctly set the input if the channel is changed? Some way to reset the input selector after choosing a channel may work?

michel0271 commented 3 years ago

Somehow we have to manage that the channel list can be read out by the plug-in of the Sky Q receiver. At least that's how it works with the Sony TV OS plug-in. But maybe that's not even possible with the Sky Q Receiver?

SmolSoftBoi commented 3 years ago

Somehow we have to manage that the channel list can be read out by the plug-in of the Sky Q receiver. At least that's how it works with the Sony TV OS plug-in. But maybe that's not even possible with the Sky Q Receiver?

I've grabbed the channel list from the Sky Q receiver, which is why you're seeing Sky One HD which s channel 100 for you.

Could you test 1.2.0-beta.9 please?

michel0271 commented 3 years ago

Somehow we have to manage that the channel list can be read out by the plug-in of the Sky Q receiver. At least that's how it works with the Sony TV OS plug-in. But maybe that's not even possible with the Sky Q Receiver?

I've grabbed the channel list from the Sky Q receiver, which is why you're seeing Sky One HD which s channel 100 for you.

Could you test 1.2.0-beta.9 please?

Tested, Sky One HD set up as relaxed as suggested. It was switched once and even on the correct channel! :-) The whole thing did not work once, then unfortunately no longer. However, the other channels are not displayed. On / off works.

benfysh commented 3 years ago

@EpicKris is the intention to show all the channels from /as/services as inputs? (I am only seeing the first currently) I think there is a limit to the number of inputs to be displayed

From https://github.com/jsiegenthaler/homebridge-eosstb#readme

Input service. The input (TV channels) utilises one service per input. 
The maximum possible channels (inputs) are thus 100 - 3 = 97

An option may be to grab the favourites from a box via /as/services/favourites if they exist and use those?

SmolSoftBoi commented 3 years ago

@EpicKris is the intention to show all the channels from /as/services as inputs? (I am only seeing the first currently) I think there is a limit to the number of inputs to be displayed

Yes, this exactly what we're trying to achieve, thank you for pointing out the limit as I'd forgotten about that.

An option may be to grab the favourites from a box via /as/services/favourites if they exist and use those?

Could you provide me with data for the /as/services/favourites please?

SmolSoftBoi commented 3 years ago

Could you also test 1.2.0-beta.10 please?

benfysh commented 3 years ago

Could you provide me with data for the /as/services/favourites please?

This is from the one box I have them set on:

{
   "favourites" : [
      {
         "lcn" : 1,
         "sid" : "1044"
      },
      {
         "lcn" : 2,
         "sid" : "4081"
      },
      {
         "lcn" : 3,
         "sid" : "2076"
      },
      {
         "lcn" : 4,
         "sid" : "4075"
      },
      {
         "lcn" : 5,
         "sid" : "4010"
      },
      {
         "lcn" : 6,
         "sid" : "2075"
      },
      {
         "lcn" : 7,
         "sid" : "4002"
      },
      {
         "lcn" : 8,
         "sid" : "2104"
      },
      {
         "lcn" : 9,
         "sid" : "4077"
      }
   ]
}
benfysh commented 3 years ago

1.2.0-beta.10 is now showing the first 97 channels as inputs on all boxes (after killing and opening the home app after restarting homebridge) and you can change channels by selecting the inputs.

It still has the same behaviour in that the previously selected input persists even if the channel is changed or the box is power cycled.

michel0271 commented 3 years ago

Good job! Many Thanks! I am very happy! I would like to continue to support you with the beta. Maybe we will get it to switch faster. The on-off function is also fast?