myTselection / telenet_telemeter

Telenet Telemeter Home Assistant custom component HACS for Belgian ISP and mobile phone network traffic.
MIT License
30 stars 6 forks source link

Issue with counter #16

Closed wimpie3 closed 1 year ago

wimpie3 commented 1 year ago

Counter not working:, stays at 0 all the time Total used: 0.0% (0GB of 750GB)

Period, days remaining, product type: all ok.

myTselection commented 1 year ago

hi, is this for internet or mobile? could you share your (annonimized) json attribute of the sensor?

wimpie3 commented 1 year ago

What I can see is that from the 19th of January, all counters are returned as 0 (see data below). I suppose I was switched to the "new" IT system on that date. On mijn.telenet.be I can still see my usage, so you'll probably have to poll the data in a new way.

date: '2023-01-18T00:00:00.0+01:00' wifree: 0 peak: 0 offpeak: 1244153

geertmeersman commented 1 year ago

@myTselection , seems they indeed are changing the API system.

Authentication and user detail flow is still valid, data usage flow:

  1. https://api.prd.telenet.be/ocapi/public/api/product-service/v1/product-subscriptions?producttypes=PLAN, resulting in my case in the following:
    [ {
    "activationDate" : "2017-02-15T00:00",
    "addressId" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "identifier" : "09999999999999",
    "label" : "Usage Based Pricing / 09999999999999",
    "locationId" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "status" : "Active",
    "productType" : "mobile",
    "isDataOnlyPlan" : false,
    "specurl" : "https://api.prd.telenet.be/omapi/public/product/PVVV0000",
    "id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "useSpecurl" : false,
    "hasVoiceMail" : false,
    "hasActiveMyBill" : false
    }, {
    "activationDate" : "2023-01-19T00:00",
    "addressId" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "identifier" : "x000000",
    "label" : "All-Internet / x000000",
    "locationId" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "status" : "Active",
    "productType" : "internet",
    "isDataOnlyPlan" : false,
    "specurl" : "https://api.prd.telenet.be/omapi/public/product/INTF0200",
    "id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "useSpecurl" : false,
    "hasVoiceMail" : false,
    "hasActiveMyBill" : false
    } ]
  2. You can also, per type call these type of endpoints: https://api.prd.telenet.be/ocapi/public/api/product-service/v1/product-subscriptions?producttypes=INTERNET, resulting in
    [ {
    "activationDate" : "2023-01-19T00:00",
    "addressId" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "identifier" : "x000000",
    "label" : "All-Internet / x000000",
    "locationId" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "status" : "Active",
    "productType" : "internet",
    "internetType" : "FUP",
    "specurl" : "https://api.prd.telenet.be/omapi/public/product/INTF0200",
    "id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "useSpecurl" : true,
    "hasVoiceMail" : false
    } ]

    And https://api.prd.telenet.be/ocapi/public/api/product-service/v1/product-subscriptions?producttypes=MOBILE, resulting in

    [ {
    "activationDate" : "2017-02-15T00:00",
    "addressId" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "identifier" : "09999999999999",
    "label" : "Usage Based Pricing / 09999999999999",
    "locationId" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "status" : "Active",
    "productType" : "mobile",
    "userPIDLinked" : false,
    "isDataOnlyPlan" : false,
    "specurl" : "https://api.prd.telenet.be/omapi/public/product/PVVV0000",
    "id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "useSpecurl" : true,
    "hasVoiceMail" : true,
    "options" : [ ]
    } ]
  3. To get the billcycles: https://api.prd.telenet.be/ocapi/public/api/billing-service/v1/account/products/< THE IDENTIFIER type x000000 >/billcycle-details?producttype=internet&count=3, resulting in
    {
    "billCycles" : [ {
    "startDate" : "2023-02-18",
    "endDate" : "2023-03-17",
    "billCycle" : "CURRENT"
    }, {
    "startDate" : "2023-01-18",
    "endDate" : "2023-02-17",
    "billCycle" : "PREVIOUS"
    } ]
    }
  4. And then you can get the usage per product: https://api.prd.telenet.be/ocapi/public/api/product-service/v1/products/internet/< THE IDENTIFIER type x000000 >/usage?fromDate=2023-02-18&toDate=2023-03-17, resulting in
    {
    "internet" : {
    "category" : "FUP",
    "specurl" : "https://api.prd.telenet.be/omapi/public/product/INTF0200",
    "daysUntil" : "0",
    "validity" : "2023-03-18T12:00:00.000Z",
    "allocatedUsage" : {
      "units" : 3072.00,
      "usedUnits" : 0.00,
      "unitType" : "GB",
      "lastUsageDate" : "2023-03-17T17:16:00"
    },
    "extendedUsage" : {
      "eligibleToBuy" : false,
      "volumeBlocks" : "0",
      "volume" : 0,
      "unit" : "GB",
      "price" : "0.00",
      "currency" : "EUR"
    },
    "wifreeUsage" : {
      "usedUnits" : 0.00,
      "unitType" : "GB"
    },
    "totalUsage" : {
      "units" : 466.49,
      "unitType" : "GB",
      "lastUsageDate" : "2023-03-17T17:16:00"
    },
    "peakUsage" : {
      "usedUnits" : 466.49
    }
    }
    }
myTselection commented 1 year ago

thanks for the analysis Geert! Much appreciated! I'll try to deep dive into it this weekend.

carloalbrile commented 1 year ago

I have a similar issue. Use%=0.2 I looked in Developer tools/STATES/Telenet Telemeter and used_percentage: 0.2. Other information like address, country and so on are correct. I have deleted and added again the integration. When you have time could you please advise?

attribution: Telenet Telemeter last update: 2023-03-20T17:11:32.1+01:00 used_percentage: 0.2 included_volume: 157286400 extended_volume: 26214400 total_volume: 175 wifree_usage: 141869 includedvolume_usage: 141869 extendedvolume_usage: 0 peak_usage: 0 offpeak_usage: 0 sequeezed: false period_start: 2023-03-08T00:00:00+01:00 period_end: 2023-04-07T00:00:00+02:00 period_days_left: 17.2 period_used_percentage: 42.6 product: BI download_speed: 100 Mbps upload_speed: 10 Mbps telemeter_json:

myTselection commented 1 year ago

@geertmeersman thanks again Geert for the detailed analysis! Based on this feedback, I've made a first draft update in R0.9.0 to become compatible with the new Telenet backend. As I'm still on the old backend, I have no option to validate any of it myself. But at least, it's still backwards compatible with old backend for me. Let's see how far we get for now...

myTselection commented 1 year ago

@carloalbrile I don't really see the issue in your data. Could you share the details in the telemeter_json attribute? (please sanitize)

sammyke007 commented 1 year ago

0.9.0 still not ok with new backend. Anything I can share? I have a WIGO35 with 5 mobile phone numbers linked.

myTselection commented 1 year ago

0.9.0 still not ok with new backend. Anything I can share? I have a WIGO35 with 5 mobile phone numbers linked.

Thx for quick reply. Any details on exception you get?

sammyke007 commented 1 year ago

My specurl is different. It's https://api.prd.telenet.be/omapi/public/product/627

geertmeersman commented 1 year ago

@geertmeersman thanks again Geert for the detailed analysis! Based on this feedback, I've made a first draft update in R0.9.0 to become compatible with the new Telenet backend. As I'm still on the old backend, I have no option to validate any of it myself. But at least, it's still backwards compatible with old backend for me. Let's see how far we get for now...

I tried it out, but the problem is you don't enter in the V2 part 😄

self._telemeter = await self._hass.async_add_executor_job(lambda: self._session.telemeter())
if not self._telemeter:

The telemeter() function returns a result (even in the V2), so the condition is not met. I'll fork it and will see how I can help

sammyke007 commented 1 year ago

WIGO35 data:

https://api.prd.telenet.be/ocapi/public/api/product-service/v1/product-subscriptions?producttypes=PLAN

[ { "activationDate" : "2020-08-04T00:00", "addressId" : "xxxxxx", "identifier" : "WIGO10_43669014", "label" : "WIGO 35GB / WIGO10_43669014", "locationId" : "xxxxxx", "status" : "Active", "productType" : "bundle", "isDataOnlyPlan" : false, "products" : [ { "identifier" : "0477xxxxxx", "productType" : "mobile", "isDataOnlyLine" : false }, { "identifier" : "03336xxxxxx", "productType" : "telephone", "isDataOnlyLine" : false }, { "identifier" : "0486xxxxxx", "productType" : "mobile", "isDataOnlyLine" : false }, { "identifier" : "0485xxxxxx", "productType" : "mobile", "isDataOnlyLine" : false }, { "identifier" : "0478xxxxxx", "productType" : "mobile", "isDataOnlyLine" : false }, { "identifier" : "DTVxxxxxx", "productType" : "dtv", "isDataOnlyLine" : false }, { "identifier" : "0486xxxxxx", "productType" : "mobile", "isDataOnlyLine" : false }, { "identifier" : "v574xxx", "productType" : "internet", "isDataOnlyLine" : false } ], "specurl" : "https://api.prd.telenet.be/omapi/public/product/WIGO0025", "bundleFamily" : "WIGO", "id" : "916569135491xxxxxx", "useSpecurl" : false, "hasVoiceMail" : false, "hasActiveMyBill" : false } ]

https://api.prd.telenet.be/ocapi/public/api/product-service/v1/product-subscriptions?producttypes=INTERNET

[ { "activationDate" : "2020-08-04T00:00", "addressId" : "xxxxxx", "identifier" : "v574xxx", "label" : "WIGO 35GB / WIGO10_43669014", "locationId" : "xxxxxx", "status" : "Active", "productType" : "bundle", "internetType" : "FUP", "bundleIdentifier" : "WIGO10_xxxxxx", "specurl" : "https://api.prd.telenet.be/omapi/public/product/WIGO0025", "id" : "xxxxxx", "useSpecurl" : true, "hasVoiceMail" : false, "bundleType" : "WIGO" } ]

https://api.prd.telenet.be/ocapi/public/api/mobile-service/v3/mobilesubscriptions/WIGO10_43669014/usages?type=bundle&lineIdentifier=0485xxxxxx

{ "productCode" : "WIGO0025", "specurl" : "https://api.prd.base.be/omapi/public/product/WIGO0025", "nextBillingDate" : "2023-04-14T00:00:00+02:00", "category" : "CAP", "outOfBundle" : { "usedUnits" : "0", "unitType" : "EUR" }, "options" : [ ], "proratable" : false, "shared" : { "data" : [ { "name" : "DATA", "usedUnits" : "1,73", "usedEuUnits" : "0", "unitType" : "GB" } ], "text" : [ { "name" : "TEXT", "usedUnits" : "3", "unitType" : "NUMBER" } ], "voice" : [ { "name" : "VOICE", "usedUnits" : "100,07", "unitType" : "MINUTES" } ], "ZBR" : [ ] } }

If you need any data, just tell me

geertmeersman commented 1 year ago

I almost have a working beta version :-)

geertmeersman commented 1 year ago

@sammyke007 , feel free to test my forked version. For me it seems to work for the Internet Sensor (I don't have mobile).

image

The markdown changed for the Total used also, since it's expressed in Gb now:

### Total used: {{state_attr('sensor.telenet_telemeter','used_percentage')}}% ({{(((state_attr('sensor.telenet_telemeter','peak_usage') or 0) +(state_attr('sensor.telenet_telemeter','includedvolume_usage') or 0)+(state_attr('sensor.telenet_telemeter','extendedvolume_usage') or 0)+(state_attr('sensor.telenet_telemeter','wifree_usage') or 0)))|int}}GB of {{state_attr('sensor.telenet_telemeter','total_volume')|int}}GB)
geertmeersman commented 1 year ago

@myTselection as you will see in my commit comments, I have added 2 definitions to make the coding a little bit easier and understandable

sammyke007 commented 1 year ago

@sammyke007 , feel free to test my forked version. For me it seems to work for the Internet Sensor (I don't have mobile).

image

The markdown changed for the Total used also, since it's expressed in Gb now:

### Total used: {{state_attr('sensor.telenet_telemeter','used_percentage')}}% ({{(((state_attr('sensor.telenet_telemeter','peak_usage') or 0) +(state_attr('sensor.telenet_telemeter','includedvolume_usage') or 0)+(state_attr('sensor.telenet_telemeter','extendedvolume_usage') or 0)+(state_attr('sensor.telenet_telemeter','wifree_usage') or 0)))|int}}GB of {{state_attr('sensor.telenet_telemeter','total_volume')|int}}GB)

I've updated sensor.py, and a lot of data get's loaded correctly (period, plan type, ...) except the data parts, both for internet and mobile.

image

This is my JSON data:

internetusage:

geertmeersman commented 1 year ago

@sammyke007 can you put on the debug? In the logger:

logs:
  custom_components.telenet_telemeter: debug

And send me the output of the line containing "ComponentData init telemeter data" in your home assistant logfile (no need to sanitize as no personal data in it)

sammyke007 commented 1 year ago

I've restarted HASS and now received in log:

Error while setting up telenet_telemeter platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 114, in async_setup_entry
    await dry_setup(hass, config, async_add_devices)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 53, in dry_setup
    await data_internet._forced_update()
  File "/config/custom_components/telenet_telemeter/sensor.py", line 161, in _forced_update
    billcycles = await self._hass.async_add_executor_job(lambda: self._session.billCycles("internet",productIdentifier))
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 161, in <lambda>
    billcycles = await self._hass.async_add_executor_job(lambda: self._session.billCycles("internet",productIdentifier))
  File "/config/custom_components/telenet_telemeter/utils.py", line 158, in billCycles
    assert response.status_code == 200
AssertionError

Added debug log and rebooting right now... EDIT: Same error (above)

geertmeersman commented 1 year ago

I've restarted HASS and now received in log:

Error while setting up telenet_telemeter platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 114, in async_setup_entry
    await dry_setup(hass, config, async_add_devices)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 53, in dry_setup
    await data_internet._forced_update()
  File "/config/custom_components/telenet_telemeter/sensor.py", line 161, in _forced_update
    billcycles = await self._hass.async_add_executor_job(lambda: self._session.billCycles("internet",productIdentifier))
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/telenet_telemeter/sensor.py", line 161, in <lambda>
    billcycles = await self._hass.async_add_executor_job(lambda: self._session.billCycles("internet",productIdentifier))
  File "/config/custom_components/telenet_telemeter/utils.py", line 158, in billCycles
    assert response.status_code == 200
AssertionError

Added debug log and rebooting right now... EDIT: Same error (above)

can you add this in the utils.py on line 156:

_LOGGER.debug("billCycles url: " + str(response.url))

and restart, and check in your "mijn.telenet.be" network debug in your browser if you also have this kind of requests going out

sammyke007 commented 1 year ago

I'll add it in a moment. In my Debug Console I get a succesfull answer on https://api.prd.telenet.be/ocapi/public/api/billing-service/v1/account/products/v5*****/billcycle-details?producttype=internet&count=3

The response is:

{ "billCycles" : [ { "startDate" : "2023-03-14", "endDate" : "2023-04-13", "billCycle" : "CURRENT" }, { "startDate" : "2023-02-14", "endDate" : "2023-03-13", "billCycle" : "PREVIOUS" }, { "startDate" : "2023-01-14", "endDate" : "2023-02-13", "billCycle" : "OLD" } ] }

sammyke007 commented 1 year ago

Same error:

` Logger: homeassistant.components.sensor Source: custom_components/telenet_telemeter/utils.py:159 Integration: Sensor (documentation, issues) First occurred: 10:44:24 (1 occurrences) Last logged: 10:44:24

Error while setting up telenet_telemeter platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/telenet_telemeter/sensor.py", line 114, in async_setup_entry await dry_setup(hass, config, async_add_devices) File "/config/custom_components/telenet_telemeter/sensor.py", line 53, in dry_setup await data_internet._forced_update() File "/config/custom_components/telenet_telemeter/sensor.py", line 161, in _forced_update billcycles = await self._hass.async_add_executor_job(lambda: self._session.billCycles("internet",productIdentifier)) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/telenet_telemeter/sensor.py", line 161, in billcycles = await self._hass.async_add_executor_job(lambda: self._session.billCycles("internet",productIdentifier)) File "/config/custom_components/telenet_telemeter/utils.py", line 159, in billCycles assert response.status_code == 200 AssertionError

`

geertmeersman commented 1 year ago

And your logger is active? do you see something like this in your logs?

2023-03-21 10:39:03.457 DEBUG (MainThread) [custom_components.telenet_telemeter.sensor]
sammyke007 commented 1 year ago

This needs to be in my configuration.yaml, correct? image

sammyke007 commented 1 year ago

If I restart the Telenet integration and follow the logs:

image

geertmeersman commented 1 year ago

If I restart the Telenet integration and follow the logs:

image

I think you have hit the rate limit of Telenet ... Just wait for e.g. 15mins and reboot again, but good news you see the logs now!

sammyke007 commented 1 year ago

image

The url seems wrong. It states .......products//billcycle-details? with a double "/". Is that correct?

EDIT: {productIdentifier} seems missing

geertmeersman commented 1 year ago

Seems your identifier is not passed through... hence the //

geertmeersman commented 1 year ago

Can you paste me the output of this part: image

sammyke007 commented 1 year ago

Output of https://api.prd.telenet.be/omapi/public/product/WIGO0025:

{ "product" : { "productid" : "WIGO0025", "externalProductCode" : "WIGO0025", "labelkey" : "WIGO 35GB", "producttype" : "BUNDLE", "weight" : 260, "apps" : [ ], "customercategories" : [ "Residential", "Event/Demo", "Production Test" ], "category" : [ "For Rules - Offerings for (120531)", "For Rules - (9) Personeelskorting Telenet", "For Rules - Partner Discount", "For Sponsor Discount - All TLO Products", "For Rules - (453) Externe medewerkers korting", "For Rules - TLOs for WIGO Service Policies", "For Rules - Price reduction during 3 months", "For Rules - WIGO 4P High Tier Bundles", "For Rules - Bundle TLOs", "For Rules - Plans for Freeride", "For Rules - TLOs with Speedboost", "For Rules - Fixed and Bundles Category", "For Discount - offerings for Free Activation discount", "4P Bundle", "For Rules - WIGO Bundles", "For Rules - WIGO 4P Bundles", "For Rules - RES Digital TV and Bundles with Digital TV", "For Rules - Multi DTV Promo", "For Discount - 4P/3P Bundles", "For Rules - All-Internet + TV, WIGO", "For Rules - All-Internet + TV, WIGO for (100650)", "For Rules - WIGO for (126941)", "For Rules - For (112721) discount", "For Rules - For (124951) discount", "For Rules - For (114321) discount", "For Rules - RES Bundles", "For Rules - Available for eSIM", "Post-Paid Mobile", "For Rules - WIGOs for (102600)", "For Discounts - (26) promo", "For Discounts - (159) promo", "For Discounts - (116XXX) promo", "For Discounts - (117200) promo", "For Discounts - (782) promo", "For Discounts - (109085) promo", "For Discounts - (105600) promo", "For Discounts - (133331) promo", "For Rules - 3P/4P Bundles and Internet TLOs for Internet Service Policies", "For Rules - Partner Discount (except ONEup)" ], "visible" : true, "localizedcontent" : [ { "locale" : "en", "name" : "WIGO 35GB", "logo" : "https://customerzone.prd.base.be/content/dam/www-base-be/img/self-service/products/wigo-35gb.png" }, { "locale" : "nl", "name" : "WIGO 35GB", "logo" : "https://customerzone.prd.base.be/content/dam/www-base-be/img/self-service/products/wigo-35gb.png" }, { "locale" : "fr", "name" : "WIGO 35GB", "logo" : "https://customerzone.prd.base.be/content/dam/www-base-be/img/self-service/products/wigo-35gb.png" } ], "shortdescription" : { "localizedcontent" : [ { "locale" : "en", "name" : "WIGO 25GB" }, { "locale" : "nl", "name" : "WIGO 35GB" }, { "locale" : "fr", "name" : "WIGO 35GB" } ] }, "services" : [ { "servicetype" : "GENERAL", "experience" : { "experiencetype" : "GENERAL" }, "specifications" : [ { "labelkey" : "spec.bundle.mobile.maxlines", "value" : "5", "visible" : true, "weight" : "1", "localizedcontent" : [ { "locale" : "en", "name" : "Max. simkaarten(en)" }, { "locale" : "nl", "name" : "Max. simkaarten" }, { "locale" : "fr", "name" : "Max. cartes SIM" } ] } ] }, { "servicetype" : "MOBILE_CALLING", "experience" : { "experiencetype" : "CALL" }, "specifications" : [ { "labelkey" : "VOICE", "grouping" : "MOBILE", "value" : "unlimited", "unit" : "minutes", "visible" : true, "weight" : "10", "localizedcontent" : [ { "locale" : "en", "name" : "Onbeperkt bellen(en)" }, { "locale" : "nl", "name" : "Onbeperkt bellen" }, { "locale" : "fr", "name" : "Appels illimités" } ] }, { "labelkey" : "TEXT", "grouping" : "MOBILE", "value" : "unlimited", "unit" : "number", "visible" : true, "weight" : "30", "localizedcontent" : [ { "locale" : "en", "name" : "Onbeperkt sms'en(en)" }, { "locale" : "nl", "name" : "Onbeperkt sms'en" }, { "locale" : "fr", "name" : "SMS illimités" } ] } ] }, { "servicetype" : "MOBILE_INTERNET", "experience" : { "experiencetype" : "SURF" }, "specifications" : [ { "labelkey" : "WIGO 35GB monthly allowance", "grouping" : "MOBILE", "value" : "35", "unit" : "GB", "visible" : true, "weight" : "20", "localizedcontent" : [ { "locale" : "en", "name" : "data te delen(en)" }, { "locale" : "nl", "name" : "data te delen" }, { "locale" : "fr", "name" : "de données mobiles à partager" } ] }, { "labelkey" : "FreeG", "grouping" : "MOBILE", "value" : "100", "unit" : "GB", "visible" : true, "weight" : "70", "localizedcontent" : [ { "locale" : "en", "name" : "mobile data in Belgium" }, { "locale" : "nl", "name" : "mobiele data in België" }, { "locale" : "fr", "name" : "données mobiles en Belgique" } ] }, { "labelkey" : "FREE EU", "grouping" : "MOBILE", "value" : "38", "unit" : "GB", "visible" : true, "weight" : "80", "localizedcontent" : [ { "locale" : "en", "name" : "mobile data in EU" }, { "locale" : "nl", "name" : "mobiele data in EU" }, { "locale" : "fr", "name" : "données mobiles dans l’UE" } ] } ] }, { "servicetype" : "FIXED_INTERNET", "experience" : { "experiencetype" : "SURF" }, "specifications" : [ { "labelkey" : "spec.fixedinternet.volume.download.fup", "grouping" : "MOBILE", "value" : "unlimited", "unit" : "GB", "visible" : true, "weight" : "60", "localizedcontent" : [ { "locale" : "en", "name" : "Onbeperkt surfen(en)" }, { "locale" : "nl", "name" : "Onbeperkt surfen" }, { "locale" : "fr", "name" : "Surfer sans limites" } ] }, { "labelkey" : "spec.fixedinternet.speed.download", "grouping" : "INTERNET", "value" : "300", "unit" : "Mbps", "visible" : true, "weight" : "40", "localizedcontent" : [ { "locale" : "en", "name" : "Downloadsnelheid: tot(en)" }, { "locale" : "nl", "name" : "Downloadsnelheid: tot" }, { "locale" : "fr", "name" : "Vitesse de téléchargement : jusqu'à" } ] }, { "labelkey" : "spec.fixedinternet.mailbox.volume", "grouping" : "INTERNET", "value" : "5", "unit" : "GB", "visible" : true, "weight" : "20", "localizedcontent" : [ { "locale" : "en", "name" : "per mailbox(en)" }, { "locale" : "nl", "name" : "per mailbox" }, { "locale" : "fr", "name" : "par boîte e-mail" } ] }, { "labelkey" : "spec.fixedinternet.speed.upload", "grouping" : "INTERNET", "value" : "20", "unit" : "Mbps", "visible" : true, "weight" : "50", "localizedcontent" : [ { "locale" : "en", "name" : "Uploadsnelheid: tot(en)" }, { "locale" : "nl", "name" : "Uploadsnelheid: tot" }, { "locale" : "fr", "name" : "Vitesse d'envoi: jusqu'à" } ] }, { "labelkey" : "spec.fixedinternet.mailbox.included", "grouping" : "INTERNET", "value" : "10", "visible" : true, "weight" : "60", "localizedcontent" : [ { "locale" : "en", "name" : "mailboxen(en)" }, { "locale" : "nl", "name" : "mailboxen" }, { "locale" : "fr", "name" : "boîtes e-mail" } ] } ] }, { "servicetype" : "DTV", "experience" : { "experiencetype" : "ENTERTAINMENT" }, "specifications" : [ { "labelkey" : "DTV", "grouping" : "DTV", "visible" : true, "weight" : "40", "localizedcontent" : [ { "locale" : "en", "name" : "Access possible to our entertainment offer: Streamz, Streamz+ and Play Sports\nExtensive range of films and series in your TV library\nExtensive range of films and series in your TV library\nWatch TV on all your screens via the Telenet TV or Telenet TV yelo app if you also have Telenet internet or if your decoder is interactive." }, { "locale" : "nl", "name" : "Toegang mogelijk tot ons entertainment aanbod: o.a. Streamz, Streamz+ en Play Sports\nUitgebreid aanbod aan films en series in je TV-theek\nTot 7 dagen terugkijk tv\nKijk tv op al je schermen via de Telenet TV- of Telenet TV yelo-app als je ook Telenet-internet hebt of als je decoder interactief is." }, { "locale" : "fr", "name" : "Accès possible à notre offre de divertissement : Streamz, Streamz+ et Play Sports\nVaste gamme de films et de séries dans votre bibliothèque TV\nJusqu'à 7 jours pour regarder la télévision\nRegardez la TV sur tous vos écrans via l'application Telenet TV ou Telenet TV yelo si vous avez également Internet Telenet ou si votre décodeur est interactif." } ] } ] }, { "servicetype" : "FIXED_CALLING", "experience" : { "experiencetype" : "CALL" }, "specifications" : [ { "labelkey" : "VOICE", "grouping" : "TELEPHONE", "value" : "unlimited", "unit" : "minutes", "visible" : true, "weight" : "50", "localizedcontent" : [ { "locale" : "en", "name" : "Altijd gratis bellen naar alle nummers in België(en)" }, { "locale" : "nl", "name" : "Altijd gratis bellen naar alle nummers in België" }, { "locale" : "fr", "name" : "Toujours téléphoner gratuitement vers tous les numéros en Belgique" } ] } ] } ], "characteristics" : { "salespricevatincl" : { "value" : "134,9", "unit" : "EUR" }, "productsegment" : "RMD", "productgroup" : "FMC", "esimAvailable" : true, "elementarycharacteristics" : [ { "key" : "internet_usage_limit", "value" : "750", "unit" : "GB" }, { "key" : "internet_usage_initial_threshold", "value" : "600", "unit" : "GB" }, { "key" : "internet_usage_alert_threshold", "value" : "675", "unit" : "GB" } ], "productsubgroup" : "WIGO", "service_category" : "FUP" }, "visibilityrules" : { "conditionalvisibility" : false }, "unlimited" : false, "priceType" : "Recurrent Charge", "constituents" : [ { "type" : "internet_line", "minCount" : "1", "maxCount" : "1" }, { "type" : "mobile_line", "minCount" : "0", "maxCount" : "5" }, { "type" : "dtv[EOS]", "minCount" : "0", "maxCount" : "1" }, { "type" : "dtv[SIPADAN]", "minCount" : "0", "maxCount" : "1" }, { "type" : "fixed_telephone", "minCount" : "0", "maxCount" : "1" } ], "usagenotifications" : { "mobile" : [ { "category" : "shared", "preferenceGroup" : "BundleMobileDataIncluded", "threshold" : [ { "communicationPreferenceType" : "InBundleData80", "communicationPreferenceTypeValue" : "80", "isEditable" : true, "values" : [ ] }, { "communicationPreferenceType" : "InBundleData95", "communicationPreferenceTypeValue" : "95", "isEditable" : true, "values" : [ ] }, { "communicationPreferenceType" : "InBundleData100", "communicationPreferenceTypeValue" : "100", "isEditable" : false, "values" : [ ] } ] }, { "category" : "personalOutOfBundle", "preferenceGroup" : "BundleMobileOutbundleRMD", "threshold" : [ { "communicationPreferenceType" : "OutBundleRMD", "communicationPreferenceTypeValue" : "NA", "isEditable" : true, "values" : [ "0 Euro", "5 Euro", "10 Euro", "15 Euro", "25 Euro", "30 Euro", "50 Euro", "75 Euro", "100 Euro" ] } ] }, { "category" : "personalMobileData", "preferenceGroup" : "BundleMobileDataLine", "threshold" : [ { "communicationPreferenceType" : "BundleDataLineLevel", "communicationPreferenceTypeValue" : "NA", "isEditable" : true, "values" : [ "2 GB", "4 GB", "6 GB", "8 GB", "10 GB", "20 GB" ] } ] } ], "internet" : [ { "category" : "FUP", "preferenceGroup" : "InternetFUP", "threshold" : [ { "communicationPreferenceType" : "Internet90", "communicationPreferenceTypeValue" : "90", "isEditable" : false, "values" : [ ] }, { "communicationPreferenceType" : "Internet100", "communicationPreferenceTypeValue" : "100", "isEditable" : false, "values" : [ ] } ] } ] }, "usageLimits" : { "premiumService" : { "preferenceGroup" : "PremiumServices", "limits" : [ { "communicationPreferenceType" : "OutBundleFraud", "communicationPreferenceTypeValue" : "NA", "isEditable" : false, "values" : [ ] }, { "communicationPreferenceType" : "OutBundlePremiumSpendingLimit", "communicationPreferenceTypeValue" : "NA", "isEditable" : false, "values" : [ ] } ] } }, "requiresInstallation" : true, "isYupProduct" : false, "isEligibleForPauseProfile" : true, "isEligibleForAutoPause" : true, "isEligibleForSettinglimits" : false, "languageSpecifications" : [ ], "usageBasedRatePlan" : false } }

geertmeersman commented 1 year ago

Sure: geertmeersman@gmail.com and perhaps push me your mobile number, whatsapp can then be faster

carloalbrile commented 1 year ago

there was some spelling mistakes. delete previous message.

@carloalbrile I don't really see the issue in your data. Could you share the details in the telemeter_json attribute? (please sanitize) the issue is the "used_percentage: 0.2" I have a total of 175 Gb and now with 16 days left I still have 112Gb that is not 0.2 used %. Do you know if used_percentage refers to free wifi or 5 of the total volume available? thanks attribution: Telenet Telemeter last update: '2023-03-21T06:57:04.2+01:00' used_percentage: 0.2 included_volume: 157286400 extended_volume: 26214400 total_volume: 175 wifree_usage: 142718 includedvolume_usage: 142718 extendedvolume_usage: 0 peak_usage: 0 offpeak_usage: 0 sequeezed: false period_start: '2023-03-08T00:00:00+01:00' period_end: '2023-04-07T00:00:00+02:00' period_days_left: 16.61 period_used_percentage: 44.6 product: BI download_speed: 100 Mbps upload_speed: 10 Mbps telemeter_json: internetusage:

geertmeersman commented 1 year ago

@carloalbrile can you check if my code works for you? Verified and working for me and for @sammyke007

myTselection commented 1 year ago

@geertmeersman can you send a pull request? So I can integrate it for everyone.

geertmeersman commented 1 year ago

@myTselection I'm still working on the mobile part, once ok I'll create a pull request

geertmeersman commented 1 year ago

Current status, mobile sensors also working, but I am waiting for @sammyke007 in order to get some "bundle" examples, so the shared usage can be added

krisconinx commented 1 year ago

Great integration. However, with version 0.9.0 I still have 0 values. I'm already migrated to the their new IT system with new version of My Telenet.

geertmeersman commented 1 year ago

@krisconinx can you try with my forked version?

@myTselection I think I have a working version now, I can create a pull request, but in fact I would like to be able to define by pulling some data if someone is using the V1 or the V2... Any idea? Example: do you have data returning on your side for the billingcycles?

krisconinx commented 1 year ago

@geertmeersman fairly new into GitHub so took me a while to find your forked version, but succeeded. For fixed internet and our two mobile lines I have usage data now instead of 0 values. However the sensor sensor.telenet_telemeter_mobile_shared has become unavailable.

geertmeersman commented 1 year ago

@krisconinx I decided to remove the sensor itself as I have added all data now in each mobile sensor at the bottom. And if a mobile number doesn't have an assigned data budget, the sensor value taken is the % of the shared data

Is the shared sensor required?

sammyke007 commented 1 year ago

@geertmeersman , legend of the day!

krisconinx commented 1 year ago

@geertmeersman then there is no need for the shared sensor indeed!

geertmeersman commented 1 year ago

This is what it looks like for @sammyke007 image

sammyke007 commented 1 year ago

Already edited!

image
carloalbrile commented 1 year ago

After upgrading via HACS to version 0.9.0, unfortunately I have to report that it did not solve my issue. I am not familiar with Github to be able to use the fork version. Need more time to figure it out. Thank you for your support with getting this addressed.

image attribution: Telenet Telemeter last update: '2023-03-21T21:25:48.6+01:00' used_percentage: 0.1 included_volume: 157286400 extended_volume: 26214400 total_volume: 175 wifree_usage: 142792 includedvolume_usage: 142792 extendedvolume_usage: 0 peak_usage: 0 offpeak_usage: 0 sequeezed: false period_start: '2023-03-08T00:00:00+01:00' period_end: '2023-04-07T00:00:00+02:00' period_days_left: 16.01 period_used_percentage: 46.6 product: BI download_speed: 100 Mbps upload_speed: 10 Mbps

myTselection commented 1 year ago

@krisconinx can you try with my forked version?

@myTselection I think I have a working version now, I can create a pull request, but in fact I would like to be able to define by pulling some data if someone is using the V1 or the V2... Any idea? Example: do you have data returning on your side for the billingcycles?

New code looks good :) nice cleanup Geert!

A way to check in between old an new backend might be on the planInfo. I get an HTTP 500 on "https://api.prd.telenet.be/ocapi/public/api/product-service/v1/product-subscriptions?producttypes=PLAN"

geertmeersman commented 1 year ago

@myTselection Pull request created, please test it if all still works for you.

22

myTselection commented 1 year ago

should be fixed since R0.9.3, thank you all for your support!!