lghorizon icon indicating copy to clipboard operation
lghorizon copied to clipboard

Virgin Media (GB) recording capacity

Open callumeveratt opened this issue 2 years ago • 45 comments

I'm not sure this ever worked on the original Arris integration (certainly for me the value was always unavailable for recording_capacity) but the following appears in the log for getting recording capacity in GB:

Logger: lghorizon.lghorizon_api Source: /usr/local/lib/python3.10/site-packages/backoff/_common.py:120 First occurred: 10:39:10 (1 occurrences) Last logged: 10:39:10 Giving up _do_api_call(...) after 3 tries (lghorizon.exceptions.LGHorizonApiConnectionError: Unable to call https://prod.spark.virginmedia.com/eng/web/recording-service/customers/xxx_gb/quota. Error:501 Server Error: Not Implemented for url: https://prod.spark.virginmedia.com/eng/web/recording-service/customers/xxx_gb/quota)

callumeveratt avatar Dec 21 '22 10:12 callumeveratt

@callumeveratt I think this works as intended. For me there's no way to determine if cloud recording is available but to query that url. If it gives me a 501 i know it isn't avaiable. I presume you don't have a sensor at all anymore for recording capacity?

Sholofly avatar Dec 21 '22 11:12 Sholofly

It looks like VM sends this over MQTT as a percentage --

Topic: {household_id}/{box_id}/localRecordings/capacity Payload: {"messageType":"CPE.capacity","version":"1.0.7","used":97}

caraar12345 avatar Dec 21 '22 11:12 caraar12345

Ah m8 thats brilliant information. Until now i was only supporting cloud recordings. In this way I can add a sensor for local recordings. How did you find out?

Sholofly avatar Dec 21 '22 12:12 Sholofly

All the investigation I've been doing has been just by logging into https://virgintvgo.virginmedia.com with the Chrome dev tools open and watching the calls it makes.

In particular, in the call to mqtt, which is the websocket, you can see the MQTT messages either way!

caraar12345 avatar Dec 21 '22 12:12 caraar12345

Cool, I'm going to try to add this to the api. Thanks!

Sholofly avatar Dec 21 '22 12:12 Sholofly

BTW, can you find out of anything in your account data states that recording is enabled and if this is network or local?

Sholofly avatar Dec 21 '22 12:12 Sholofly

Ignore that - I imagine it's not specified anywhere for Virgin GB as channel owners have cold feet over cloud recording - so it's never been enabled in the UK from what I gather

callumeveratt avatar Dec 21 '22 12:12 callumeveratt

Would definitely be cool to use the local recording data where applicable though :-)

callumeveratt avatar Dec 21 '22 12:12 callumeveratt

Will also have a dig around -- but with Virgin, I can confidently say it'll always be local as we don't have Cloud DVR!

@callumeveratt I think remote recording in that context is the ability to remotely instruct your box to record something rather than recording to VM's servers

caraar12345 avatar Dec 21 '22 12:12 caraar12345

@caraar12345 - Yeah you're right, I got ahead of myself for a second. It is the ability to remote record, not cloud record.

callumeveratt avatar Dec 21 '22 12:12 callumeveratt

Ha! Impressive timing from both of us 😁

Does look like there's something about local DVR though -- localDvrAvailable. I believe networkDvrAvailable refers to being able to play back local recordings on a mobile device.

Unrelated tidbit, I do wonder where they get 'gender' from, as I may be somewhat effeminate, but I've definitely never identified myself as female to anyone 😆

{
    "oespToken": "",
    "accessToken": "",
    "householdId": "{customer_id}_gb",
    "username": "{customer_id}",
    "locationId": "18",
    "originalLocationId": "18",
    "timeToIdleSeconds": 7200,
    "customer": {
        "givenName": "Aaron",
        "countryCode": "GB",
        "gender": "female",
        "status": [],
        "smartCardId": "",
        "physicalDeviceId": "{box_id}",
        "stbType": "EOS",
        "networkDvrAvailable": true,
        "replayOTTOnlyAvailable": false,
        "localDvrAvailable": true,
        "householdId": "{customer_id}_gb",
        "sharedProfileId": "",
        "replayTvEntitled": true,
        "replayTvAvailable": true,
        "replayTvMinimumBroadcastTime": 0,
        "replayTvOptedIn": true,
        "offlineViewingEntitled": true,
        "profileIds": [
            ""
        ],
        "oboProvisioned": true,
        "customerId": "{customer_id}",
        "purchaseEntitlementsToken": "",
        "isSkLite": false
    },

caraar12345 avatar Dec 21 '22 12:12 caraar12345

From what call is this data coming from?

Sholofly avatar Dec 21 '22 12:12 Sholofly

Oops - https://prod.oesp.virginmedia.com/oesp/v4/GB/eng/web/session

caraar12345 avatar Dec 21 '22 12:12 caraar12345

Are you guys (or guy and lady) able to update and can you check if every box have an attribute with recording capacity?

Sholofly avatar Dec 21 '22 13:12 Sholofly

Will give it a shot; unfortunately I'm still contending with the config flow issue (hopefully this restart will sort it!?)

caraar12345 avatar Dec 21 '22 14:12 caraar12345

@Sholofly On VirginMedia GB, I have 1 device and 1 entity. No sign of recording capacity anywhere.

ChrisThomas42 avatar Dec 21 '22 14:12 ChrisThomas42

If you click the box entity, does it show in attributes?

caraar12345 avatar Dec 21 '22 14:12 caraar12345

No you should check the developer tools

Sholofly avatar Dec 21 '22 14:12 Sholofly

Yep - there for me. Null though - is that expected at the mo? image

callumeveratt avatar Dec 21 '22 14:12 callumeveratt

Depends, do you have local recordings?

Sholofly avatar Dec 21 '22 14:12 Sholofly

Yep - have recordings on the box and on TVGo I can see the MQTT request @caraar12345 gave

{"messageType":"CPE.capacity","version":"1.0.7","used":72}

callumeveratt avatar Dec 21 '22 14:12 callumeveratt

ok, i that case it doesn't work yet. I have to add more logging to find out where the problem is. Do you have debugging enabled in your component?

Sholofly avatar Dec 21 '22 14:12 Sholofly

Nope - but if you need to add some more logging I can get it turned on in the meantime

callumeveratt avatar Dec 21 '22 14:12 callumeveratt

OK stupid. I didnt't commit the part to subscribe to the actual mqtt topic :( Can you manually update your manifest.json to

"requirements": [
    "lghorizon>=0.5.13"
  ]

And then reboot of course ;)

Sholofly avatar Dec 21 '22 14:12 Sholofly

@Sholofly On VirginMedia GB, I have 1 device and 1 entity. No sign of recording capacity anywhere.

The local recordings are an attribute of the box. It's not an account thing like the cloud recordings.

Sholofly avatar Dec 21 '22 14:12 Sholofly

After changing the entry 0.5.12 to 0.5.13 and restarting, I no longer have an entry for recording capacity listed in states. I can see all my local recodings in the integration.

ChrisThomas42 avatar Dec 21 '22 14:12 ChrisThomas42

Do you see recording capacity of each box in the box attributes?

Sholofly avatar Dec 21 '22 15:12 Sholofly

I updated the manifest also - the recording_capacity did disappear originally but it came back but sadly still null

callumeveratt avatar Dec 21 '22 15:12 callumeveratt

Can you check the logs for mqtt messages if you set it to debug?

Sholofly avatar Dec 21 '22 15:12 Sholofly

Just trawling though, so far found these

2022-12-21 15:05:41.002 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Sending SUBSCRIBE (d0, m7) [(b'201434117_gb/+/localRecordings', 0)]

2022-12-21 15:05:41.003 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Sending SUBSCRIBE (d0, m8) [(b'201434117_gb/+/localRecordings/capacity', 0)]

callumeveratt avatar Dec 21 '22 15:12 callumeveratt