RogerSelwyn / Home_Assistant_SkyQ_MediaPlayer

Home Assistant SkyQ Media player component
MIT License
101 stars 17 forks source link

[BUG] Soap Control URL not available - No Control URL, SOAP call not made #164

Closed sira87 closed 9 months ago

sira87 commented 9 months ago

Describe the bug

Home Assistant shows the device as OFF at any time, even if the device is ON.

To reproduce

Install the component, provide static local IP address of Sky Q, once it's detected configure it as per documentation.

Expected bahavior

HA entity should reproduce the physical state of the device.

What version of SkyQ has the issue?

2.11.6

What was the last working version of Sky Q Integration?

2.11.6

What version of Home Assistant Core has the issue?

2023.10.1

Configuration type

UI

Configuration UI

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.10.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.5",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Rome",
    "os_name": "Linux",
    "os_version": "6.1.21-v8",
    "supervisor": "2023.10.0",
    "host_os": "Home Assistant OS 10.1",
    "docker_version": "23.0.3",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "browser_mod": {
      "version": "2.3.0",
      "requirements": []
    },
    "attributes": {
      "version": "1.2.1",
      "requirements": []
    },
    "hpprinter": {
      "version": "1.0.8",
      "requirements": [
        "xmltodict==0.12.0"
      ]
    },
    "hacs": {
      "version": "1.33.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "ui_lovelace_minimalist": {
      "version": "v1.3.6",
      "requirements": [
        "aiofiles==0.8.0",
        "aiogithubapi>=22.2.4"
      ]
    },
    "alexa_media": {
      "version": "4.6.5",
      "requirements": [
        "alexapy==1.27.4",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "samsungtv_smart": {
      "version": "0.12.0",
      "requirements": [
        "websocket-client!=1.4.0,>=0.58.0",
        "wakeonlan>=2.0.0",
        "aiofiles>=0.8.0",
        "casttube>=0.2.1"
      ]
    },
    "reversotts": {
      "version": "1.0.2",
      "requirements": [
        "pyttsreverso==0.4"
      ]
    },
    "weatherbit": {
      "version": "1.0.20",
      "requirements": [
        "pyweatherbitdata==1.0.15"
      ]
    },
    "skyq": {
      "version": "v2.11.6",
      "requirements": [
        "pyskyqremote==0.3.25"
      ]
    },
    "yahoofinance": {
      "version": "1.2.2",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "skyq",
    "name": "Sky Q",
    "codeowners": [
      "@rogerselwyn"
    ],
    "config_flow": true,
    "dependencies": [
      "ssdp"
    ],
    "documentation": "https://github.com/RogerSelwyn/Home_Assistant_SkyQ_MediaPlayer",
    "integration_type": "device",
    "iot_class": "local_polling",
    "issue_tracker": "https://github.com/RogerSelwyn/Home_Assistant_SkyQ_MediaPlayer/issues",
    "quality_scale": "silver",
    "requirements": [
      "pyskyqremote==0.3.25"
    ],
    "ssdp": [
      {
        "nt": "urn:schemas-nds-com:device:GatewaySkyControl:2"
      },
      {
        "nt": "urn:schemas-nds-com:device:MRSkyControl:2"
      }
    ],
    "version": "v2.11.6",
    "is_built_in": false
  },
  "data": {
    "config_entry_data": {
      "host": "192.168.1.13",
      "name": "Sky Q"
    },
    "config_entry_options": {
      "output_programme_image": true,
      "live_tv": true,
      "get_live_record": true,
      "generate_switches_for_channels": false,
      "advanced_options": true,
      "tv_device_class": true,
      "country": "ITA",
      "epg_cache_len": 20,
      "add_backup": false
    },
    "device_information": {
      "ASVersion": "Q220.000.23.00-AS_28.7.0",
      "IPAddress": "192.168.1.13",
      "countryCode": "ITA",
      "used_country_code": "ITA",
      "hardwareModel": "ESi-160",
      "hardwareName": "Amidala",
      "deviceType": "GATEWAYSTB",
      "gateway": true,
      "gatewayIPAddress": "not MR",
      "manufacturer": "HUMAX",
      "modelNumber": "Q220.000.23.00L (5lrke0s)",
      "serialNumber": "0673586828 0",
      "versionNumber": "6763A3",
      "bouquet": 25175,
      "subbouquet": 7,
      "wakeReason": "POWERON",
      "systemUptime": 74856,
      "hdrCapable": true,
      "uhdCapable": true,
      "presentLocalTimeOffset": 7200,
      "utc": 1696713682,
      "futureLocalTimeOffset": 3600,
      "futureTransitionUtc": 1698541200
    }
  }
}

Configuration YAML

No response

Anything in the logs that might be useful for us?

Logger: pyskyqremote.classes.deviceaccess
Source: /usr/local/lib/python3.11/site-packages/pyskyqremote/classes/deviceaccess.py:239
First occurred: 22:15:25 (5 occurrences)
Last logged: 23:00:58

W0030DA - Soap Control URL not available - 192.168.1.13
Logger: pyskyqremote.classes.deviceaccess
Source: /usr/local/lib/python3.11/site-packages/pyskyqremote/classes/deviceaccess.py:95
First occurred: 22:15:25 (272 occurrences)
Last logged: 23:01:07

W0020DA - No Control URL, SOAP call not made: 192.168.1.13 : GetTransportInfo

Additional information

Issue seems similar to #111.

In Sky Q network settings I've set everything to manual, reserving a static IP address to it, subnet mask is 255.255.255.0, gateway is 192.168.1.1 which is a Sky WIFI router (the only router in the network), DNS is set to 192.168.1.1.

RogerSelwyn commented 9 months ago

Late here now, and I have a full day tomorrow, so it won't get looked at until Monday. I'll the give some guidance on some calls you can make to see if it is the box not responding to the queries I'm making, or whether it is some other problem.

RogerSelwyn commented 9 months ago

You can run some calls against your box, using the below. You need a pc/Mac with curl installed.

curl --location 'http://192.168.1.13:49153/description0.xml' \ --header 'User-Agent: SKYPLUS_skyplus'

Start with description0 and change the number upwards (the code looks at up to description50). You are looking for the word SkyControl in the key "root/device/deviceType".

On the description that you find SkyControl on it needs to find a serviceId key urn:nds-com:serviceId:SkyPlay in key "root/device/serviceList/service" from which it will bring back the controlURL.

If it doesn't find that, the integration doesn't work.

If you find a description with SkyControl in it, post I here. Descriptions do not neccesarily run in sequence, I.e. you may not get a response for each number increment. I think also you may get more than one with a SkyControl. Post whatever you find.

sira87 commented 9 months ago

Here's the PowerShell script I used to check description0-50.xml:

$ipAddress = "192.168.1.13"
$port = "49153"
$userAgent = "SKYPLUS_skyplus"

for ($i = 0; $i -le 50; $i++) {
    $url = "http://${ipAddress}:${port}/description${i}.xml"

    try {
        $response = Invoke-WebRequest -Uri $url -Headers @{ "User-Agent" = $userAgent }

        if ($response.StatusCode -eq 200) {
            [xml]$xmlContent = $response.Content

            if ($xmlContent.root.device.deviceType -match "SkyControl") {
                Write-Host "SkyControl found in $url"
                Write-Host "SkyControl Device Type: $($xmlContent.root.device.deviceType)"

                $skyPlayService = $xmlContent.root.device.serviceList.service |
                                  Where-Object { $_.serviceId -eq "urn:nds-com:serviceId:SkyPlay" }

                if ($skyPlayService) {
                    Write-Host "Service ID: $($skyPlayService.serviceId)"
                    Write-Host "Control URL: $($skyPlayService.controlURL)"
                } else {
                    Write-Host "SkyPlay service not found"
                }
            } else {
                Write-Host "description${i}.xml exists but it does not contain SkyControl"
            }
        }
    } catch {
        if ($_.Exception.Response.StatusCode -eq 404) {
            Write-Host "description${i}.xml is not found (404)"
        } else {
            Write-Host "description${i}.xml returned an error: $($_.Exception.Message)"
        }
    }
}

The output is as follows:

description0.xml is not found (404)

SkyControl found in http://192.168.1.13:49153/description1.xml 
SkyControl Device Type: urn:schemas-nds-com:device:GatewaySkyControl:2
Service ID: urn:nds-com:serviceId:SkyPlay
Control URL: /redacted (ask if needed!)

description2.xml exists but it does not contain SkyControl
description3.xml exists but it does not contain SkyControl
description4.xml is not found (404)
description5.xml exists but it does not contain SkyControl
[...]
description6-50.xml are not found (404)

I also have this new entry with 1022 occurrencies in the logs:

Logger: pyskyqremote.classes.deviceaccess
Source: /usr/local/lib/python3.11/site-packages/pyskyqremote/classes/deviceaccess.py:95
First occurred: 7 ottobre 2023 alle ore 22:15:25 (1022 occurrences)
Last logged: 01:08:28

W0020DA - No Control URL, SOAP call not made: 192.168.1.13 : GetTransportInfo
sira87 commented 9 months ago

UPDATE:

I previously tried to turn off and on the SkyQ decoder via its remote to try to resolve the issue, whilst rebooting HA, with no luck.

Now I tried disconnecting the power cable from the decoder, waited 10 seconds and the plugged the power cable back in. After doing this I reloaded the integration in HA and it started working again, showing SkyQ as ON and displaying correctly the channel it is currently set to, and I'm able to turn it on and off from the HA interface.

I don't know what happened.