ndg63276 / alexa-sky-hd

A smart home skill for Alexa to control a Sky+HD or SkyQ box
34 stars 15 forks source link

Can't discover my SkyQ box #15

Closed paulfromskegness closed 4 years ago

paulfromskegness commented 4 years ago

Hi, I have installed the app and enabled the port forwarding correctly on my router but when I try and discover devices I do not find any new devices.

Annotation 2020-04-30 205053

When connecting via the public IP or via the internal IP I get the message shown above, so I can definitely see the sky box from the internet.

Do you have any other suggestions as to how I can get my alexa app to discover my SKYQ box?

Thanks

ndg63276 commented 4 years ago

Does it work from my tester? Go to https://repl.it/@ndg63276/PortForwardingTester and press Run, then answer the questions on the right.

paulfromskegness commented 4 years ago

Yes it does....

On 30 Apr 2020, at 20:58, ndg63276 notifications@github.com wrote:



Does it work from my tester? Go to https://repl.it/@ndg63276/PortForwardingTesterhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Frepl.it%2F%40ndg63276%2FPortForwardingTester&data=02%7C01%7C%7Ce3fd5e5f8b0d47cdfa4e08d7ed40ce95%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637238734901210048&sdata=LAEWFTBPU9H1wDChOdPRlmibIOLhqElNqmY%2BIOpB5dc%3D&reserved=0 and press Run, then answer the questions on the right.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fndg63276%2Falexa-sky-hd%2Fissues%2F15%23issuecomment-622075707&data=02%7C01%7C%7Ce3fd5e5f8b0d47cdfa4e08d7ed40ce95%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637238734901220046&sdata=t%2BnCC0I0uugDDbWO6Hr3vHLzl%2B%2FrgeY44dyCd5mSyiM%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPBBJ5K7PKZQHFWDY2JXH5DRPHJ5DANCNFSM4MWQTZUQ&data=02%7C01%7C%7Ce3fd5e5f8b0d47cdfa4e08d7ed40ce95%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637238734901220046&sdata=59%2Fc7q%2BpBlu1BOUVNiTJE9bZZsXj3Bn6LichPJzEcA8%3D&reserved=0.

ndg63276 commented 4 years ago

Hmmm... you might have to change line 193 to: if request["header"]["name"] == "DiscoverAppliancesRequest": Sorry I haven't had to discover new devices in a while.

paulfromskegness commented 4 years ago

Thanks I will give that a try and will let you know how it goes...

Once making this change, do I just need to republish the app for it to be live?

paulfromskegness commented 4 years ago

thanks I have tried that and it still does not seem to discover my skyq box.... :(

ndg63276 commented 4 years ago

Ok, undo that change, that wasn't right. I just tested mine, and it worked with the old code, line 193 should be if request["directive"]["header"]["name"] == "Discover": How are you doing the discovery? Through the app? Also, make sure you don't have http:// in your HOST environment variable.

ndg63276 commented 4 years ago

Also, if you go to Lambda, click on your Skybox function, and click "Configure Test Events" in the top right. Make a new test event with this code:

{
    "directive": {
        "header": {
            "messageId": "",
            "name": "Discover",
            "namespace": "Alexa.Discovery",
            "payloadVersion": "3"
        },
        "payload": {
            "scope": {
                "token": "",
                "type": "BearerToken"
            }
        }
    }
}

Save that, then press Test. See if you get an error.

paulfromskegness commented 4 years ago

Hi, this resulted in an error on line 193... the logs are as follows...

**START RequestId: 27b732cd-7240-43e0-b1c6-6f2af3d1724e Version: $LATEST
[INFO]  2020-05-01T08:16:25.851Z    27b732cd-7240-43e0-b1c6-6f2af3d1724e    Directive:
[INFO]  2020-05-01T08:16:25.851Z    27b732cd-7240-43e0-b1c6-6f2af3d1724e    {
    "directive": {
        "header": {
            "messageId": "", 
            "name": "Discover", 
            "namespace": "Alexa.Discovery", 
            "payloadVersion": "3"
        }, 
        "payload": {
            "scope": {
                "token": "", 
                "type": "BearerToken"
            }
        }
    }
}
'header': KeyError
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 193, in lambda_handler
    if request["header"]["name"] == "DiscoverAppliancesRequest":
KeyError: 'header'

END RequestId: 27b732cd-7240-43e0-b1c6-6f2af3d1724e
REPORT RequestId: 27b732cd-7240-43e0-b1c6-6f2af3d1724e  Duration: 17.45 ms  Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 40 MB  Init Duration: 65.51 ms**   
ndg63276 commented 4 years ago

Sorry, you need to undo the change I got you to make, so that line 193 is back to: if request["directive"]["header"]["name"] == "Discover": Then click Save, and then Test again.

paulfromskegness commented 4 years ago

I had just spotted that... sorry... I had already just done this and have the following execution results...

Response:
{
  "event": {
    "header": {
      "payloadVersion": "3",
      "namespace": "Alexa.Discovery",
      "name": "Discover.Response",
      "messageId": "97b53923-88bd-4890-afba-e34ddee788ef"
    },
    "payload": {
      "endpoints": [
        {
          "endpointId": "skybox-001",
          "capabilities": [
            {
              "interface": "Alexa.PowerController",
              "version": "3",
              "type": "AlexaInterface",
              "properties": {
                "retrievable": false,
                "supported": [
                  {
                    "name": "powerState"
                  }
                ],
                "proactivelyReported": false
              }
            },
            {
              "interface": "Alexa.ChannelController",
              "version": "1.0",
              "type": "AlexaInterface",
              "properties": {
                "supported": [
                  {
                    "name": "channel"
                  }
                ]
              }
            },
            {
              "interface": "Alexa.PlaybackController",
              "supportedOperations": [
                "Play",
                "Pause",
                "Rewind",
                "FastForward",
                "Stop"
              ],
              "version": "1.0",
              "type": "AlexaInterface",
              "properties": {}
            },
            {
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "type": "AlexaInterface",
              "properties": {
                "retrievable": false,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": false
              }
            },
            {
              "interface": "Alexa",
              "version": "3",
              "type": "AlexaInterface"
            }
          ],
          "cookie": {},
          "manufacturerName": "Sky",
          "friendlyName": "Sky Q",
          "displayCategories": [
            "TV"
          ],
          "description": "Sky Digibox"
        },
        {
          "endpointId": "skybox-tvguide",
          "capabilities": [
            {
              "interface": "Alexa.SceneController",
              "supportsDeactivation": true,
              "version": "3",
              "type": "AlexaInterface",
              "proactivelyReported": false
            },
            {
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "type": "AlexaInterface",
              "properties": {
                "retrievable": false,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": false
              }
            },
            {
              "interface": "Alexa",
              "version": "3",
              "type": "AlexaInterface"
            }
          ],
          "cookie": {},
          "manufacturerName": "Sky",
          "friendlyName": "TV Guide",
          "displayCategories": [
            "SCENE_TRIGGER"
          ],
          "description": "Sky TV Guide scene via Sky Digibox"
        },
        {
          "endpointId": "skyq-netflix",
          "capabilities": [
            {
              "interface": "Alexa.SceneController",
              "supportsDeactivation": true,
              "version": "3",
              "type": "AlexaInterface",
              "proactivelyReported": false
            },
            {
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "type": "AlexaInterface",
              "properties": {
                "retrievable": false,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": false
              }
            },
            {
              "interface": "Alexa",
              "version": "3",
              "type": "AlexaInterface"
            }
          ],
          "cookie": {},
          "manufacturerName": "Sky",
          "friendlyName": "Netflix",
          "displayCategories": [
            "SCENE_TRIGGER"
          ],
          "description": "Netflix scene via Sky Q"
        },
        {
          "endpointId": "skyq-youtube",
          "capabilities": [
            {
              "interface": "Alexa.SceneController",
              "supportsDeactivation": true,
              "version": "3",
              "type": "AlexaInterface",
              "proactivelyReported": false
            },
            {
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "type": "AlexaInterface",
              "properties": {
                "retrievable": false,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": false
              }
            },
            {
              "interface": "Alexa",
              "version": "3",
              "type": "AlexaInterface"
            }
          ],
          "cookie": {},
          "manufacturerName": "Sky",
          "friendlyName": "YouTube",
          "displayCategories": [
            "SCENE_TRIGGER"
          ],
          "description": "YouTube scene via Sky Q"
        },
        {
          "endpointId": "skyq-spotify",
          "capabilities": [
            {
              "interface": "Alexa.SceneController",
              "supportsDeactivation": true,
              "version": "3",
              "type": "AlexaInterface",
              "proactivelyReported": false
            },
            {
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "type": "AlexaInterface",
              "properties": {
                "retrievable": false,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": false
              }
            },
            {
              "interface": "Alexa",
              "version": "3",
              "type": "AlexaInterface"
            }
          ],
          "cookie": {},
          "manufacturerName": "Sky",
          "friendlyName": "Spotify",
          "displayCategories": [
            "SCENE_TRIGGER"
          ],
          "description": "Spotify scene via Sky Q"
        },
        {
          "endpointId": "skybox-subtitles",
          "capabilities": [
            {
              "interface": "Alexa.SceneController",
              "supportsDeactivation": true,
              "version": "3",
              "type": "AlexaInterface",
              "proactivelyReported": false
            },
            {
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "type": "AlexaInterface",
              "properties": {
                "retrievable": false,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": false
              }
            },
            {
              "interface": "Alexa",
              "version": "3",
              "type": "AlexaInterface"
            }
          ],
          "cookie": {},
          "manufacturerName": "Sky",
          "friendlyName": "Subtitles",
          "displayCategories": [
            "SCENE_TRIGGER"
          ],
          "description": "Sky Subtitles scene via Sky Digibox"
        },
        {
          "endpointId": "skybox-audio-description",
          "capabilities": [
            {
              "interface": "Alexa.SceneController",
              "supportsDeactivation": true,
              "version": "3",
              "type": "AlexaInterface",
              "proactivelyReported": false
            },
            {
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "type": "AlexaInterface",
              "properties": {
                "retrievable": false,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": false
              }
            },
            {
              "interface": "Alexa",
              "version": "3",
              "type": "AlexaInterface"
            }
          ],
          "cookie": {},
          "manufacturerName": "Sky",
          "friendlyName": "Audio Description",
          "displayCategories": [
            "SCENE_TRIGGER"
          ],
          "description": "Sky Audio Description scene via Sky Digibox"
        },
        {
          "endpointId": "skybox-info",
          "capabilities": [
            {
              "interface": "Alexa.SceneController",
              "supportsDeactivation": true,
              "version": "3",
              "type": "AlexaInterface",
              "proactivelyReported": false
            },
            {
              "interface": "Alexa.EndpointHealth",
              "version": "3",
              "type": "AlexaInterface",
              "properties": {
                "retrievable": false,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ],
                "proactivelyReported": false
              }
            },
            {
              "interface": "Alexa",
              "version": "3",
              "type": "AlexaInterface"
            }
          ],
          "cookie": {},
          "manufacturerName": "Sky",
          "friendlyName": "Info",
          "displayCategories": [
            "SCENE_TRIGGER"
          ],
          "description": "Sky Info scene via Sky Digibox"
        }
      ]
    }
  }
}

Request ID:
"13754c57-007e-4375-b1e6-bcf631f588d1"

Function Logs:
     "interface": "Alexa", 
                            "type": "AlexaInterface", 
                            "version": "3"
                        }
                    ], 
                    "cookie": {}, 
                    "description": "Sky Subtitles scene via Sky Digibox", 
                    "displayCategories": [
                        "SCENE_TRIGGER"
                    ], 
                    "endpointId": "skybox-subtitles", 
                    "friendlyName": "Subtitles", 
                    "manufacturerName": "Sky"
                }, 
                {
                    "capabilities": [
                        {
                            "interface": "Alexa.SceneController", 
                            "proactivelyReported": false, 
                            "supportsDeactivation": true, 
                            "type": "AlexaInterface", 
                            "version": "3"
                        }, 
                        {
                            "interface": "Alexa.EndpointHealth", 
                            "properties": {
                                "proactivelyReported": false, 
                                "retrievable": false, 
                                "supported": [
                                    {
                                        "name": "connectivity"
                                    }
                                ]
                            }, 
                            "type": "AlexaInterface", 
                            "version": "3"
                        }, 
                        {
                            "interface": "Alexa", 
                            "type": "AlexaInterface", 
                            "version": "3"
                        }
                    ], 
                    "cookie": {}, 
                    "description": "Sky Audio Description scene via Sky Digibox", 
                    "displayCategories": [
                        "SCENE_TRIGGER"
                    ], 
                    "endpointId": "skybox-audio-description", 
                    "friendlyName": "Audio Description", 
                    "manufacturerName": "Sky"
                }, 
                {
                    "capabilities": [
                        {
                            "interface": "Alexa.SceneController", 
                            "proactivelyReported": false, 
                            "supportsDeactivation": true, 
                            "type": "AlexaInterface", 
                            "version": "3"
                        }, 
                        {
                            "interface": "Alexa.EndpointHealth", 
                            "properties": {
                                "proactivelyReported": false, 
                                "retrievable": false, 
                                "supported": [
                                    {
                                        "name": "connectivity"
                                    }
                                ]
                            }, 
                            "type": "AlexaInterface", 
                            "version": "3"
                        }, 
                        {
                            "interface": "Alexa", 
                            "type": "AlexaInterface", 
                            "version": "3"
                        }
                    ], 
                    "cookie": {}, 
                    "description": "Sky Info scene via Sky Digibox", 
                    "displayCategories": [
                        "SCENE_TRIGGER"
                    ], 
                    "endpointId": "skybox-info", 
                    "friendlyName": "Info", 
                    "manufacturerName": "Sky"
                }
            ]
        }
    }
}
END RequestId: 13754c57-007e-4375-b1e6-bcf631f588d1
REPORT RequestId: 13754c57-007e-4375-b1e6-bcf631f588d1  Duration: 8.26 ms   Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 40 MB  Init Duration: 63.50 ms 
ndg63276 commented 4 years ago

Ok, that looks like it is working fine. If you go into the app, click Devices, scroll right and click on All Devices, and make sure Sky Q is not listed.

Then click the + sign in the top corner, click Add Device, and choose Other at the bottom, then Discover Devices.

paulfromskegness commented 4 years ago

I have done this, and unfortunately this is still not discovering the device. Thanks for all of your help though... 👍

ndg63276 commented 4 years ago

OK, now go to https://developer.amazon.com/alexa/console/ask#/skills and click on your Sky box skill. Make sure your payload version is v3, and your Default Endpoint is something like: arn:aws:lambda:eu-west-1:175548712345:function:SkyBox - this should match what it says in the top right of your lambda function.

paulfromskegness commented 4 years ago

Thanks, this is now working. I guess that the Endpoint did not save properly when setting this app up... Sorry for all the questions, I have never used AWS or had anything to do with Alexa Skills before, but this has sparked my interest. Thanks again for all of your help... 👍

ndg63276 commented 4 years ago

No problem, happy to help!

paulfromskegness commented 4 years ago

One thing that I have noticed though, The EPG services file referenced in your code (http://epgservices.sky.com/5.1.1/api/2.1/region/json/4101/1/) has some errors in it (e.g. ITV HD is listed as being on channel 103 , but ITV HD is actually channel 176). Is there any way of getting the code to refer to your JSON file that is in the zip file, so I could modify my channel numbers myself to correct this error?) If not, don't worry about it as you have been a great help already...

ndg63276 commented 4 years ago

Yeah, it should be possible, I'll have a look later.

ndg63276 commented 4 years ago

Ok, first, download the latest zip file (https://github.com/ndg63276/alexa-sky-hd/raw/master/Alexa-Skybox.zip), and then upload it to Lambda.

Then, add an environment variable with the key "CHANNELS_FILE", and the value "channels-hd.json". There should be a file called channels-hd.json in your lambda function, which you can double click to open, edit, and Save. This file will then be used to find the channels, hopefully you can understand the format.

Let me know how you get on.

paulfromskegness commented 4 years ago

Thanks that seems to have worked. If I only I could disable the "TV Guide" skill, as about half the time I am giving a command to my sky box using your skill I get asked if I want to enable the "TV Guide Skill" as I have it disabled as I never use it. I wish I could completely block that skill, but that is something out our our control.

paulfromskegness commented 4 years ago

Thanks again for all of your help