Skip to content

Telenet Telemeter Home Assistant custom component HACS for Belgian ISP and mobile phone network traffic.

License

Notifications You must be signed in to change notification settings

myTselection/telenet_telemeter

Repository files navigation

HACS Default GitHub release GitHub repo size

GitHub issues GitHub last commit GitHub commit activity

Telenet Telemeter Home Assistant integration

Telenet Telemeter Home Assistant custom component. This custom component has been built from the ground up to bring your Telenet internet and mobile phone usage details into Home Assistant to help you towards a better follow up on your usage information. This integration is built against the public website provided by Telenet Belgium and has not been tested for any other countries.

This integration is in no way affiliated with Telenet Belgium.

⚠️ Please don't report issues with this integration to Telenet, they will not be able to support you.**

Some discussion on this topic can be found within the Home Assistant Forum

Based on python application of Killian Meersman.

Installation

  • HACS: search for Telenet Telemeter in HACS integrations and install

    • Open your Home Assistant instance and open the repository inside the Home Assistant Community Store.
  • Restart Home Assistant

  • Add 'Telenet Telemeter' integration via HA Settings > 'Devices and Services' > 'Integrations'

  • Provide Telenet username and password

  • A sensor sensor.telenet_telemeter_internet_[w123456] should become available with the percentage of data left and extra attributes on usage and period start/end etc.

    • For users having a FUP 'unlimited' data, your actual 'peak' data usage versus the service limit (eg 750GB/3TB) will be used in order to calculate your overal 'usage' status, so you can denote if you are close to be switched into a limited/smallband mode.
    • Unlimited (FUP) users should use peak_usage and offpeak_usage attributes, limited (CAP) users should use includedvolume_usage attribute.
    • Depending of new Telenet backend, the value can be in GB or in bytes, so might be needed to divide or multipled twice by 1024
    • A sensor.telenet_telemeter_peak_[w123456] sensor is available indicating if peak time is currently active or not and if all allowed peaktime data has been used, the calculated spead limits will be shown as an attribute
  • Switch switch.telenet_telemeter_wifi will be added to show the status of the Telenet router wifi. The wifi can be enabled/disabled with this switch.

  • If 'Mobile' has been selected during setup of the integration, a Telenet telemeter mobile sensor will be created for each mobile subscription. For now, the sensor state will show the usage (%) state of the data part of each subscription. But details of data/text/voice volume and usage are added as attributes on the sensor, so this information is available too.

  • Service telenet_telemeter.reboot_internet will become availabe if internet is enabled. When calling this service, the internet modem will be rebooted.

    Example:
    service: telenet_telemeter.reboot_internet
    data: {}
    

Status

Still some optimisations are planned, see Issues section in GitHub.

Technical pointers

The main logic and API connection related code can be found within source code telenet_telemeter/custom_components/telenet_telemeter:

All other files just contain boilerplat code for the integration to work wtihin HA or to have some constants/strings/translations.

If you would encounter some issues with this custom component, you can enable extra debug logging by adding below into your configuration.yaml:

logger:
  default: info
  logs:
     custom_components.telenet_telemeter: debug

Example usage:

Gauge & Markdown using dual gauge card

Show markdown code example
type: vertical-stack
cards:
  - type: markdown
    content: >-
      ## <img
      src="https://raw.githubusercontent.com/myTselection/telenet_telemeter/main/logo.png"
      width="30"/>&nbsp;&nbsp;Telenet Telemeter

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

      #### {{state_attr('sensor.telenet_telemeter_internet_w123456','period_days_left')|int}}
      days remaining
      ({{state_attr('sensor.telenet_telemeter_internet_w123456','total_volume')|int -
      ((((state_attr('sensor.telenet_telemeter_internet_w123456','peak_usage')*1024*1024) or 0)+(state_attr('sensor.telenet_telemeter_internet_w123456','includedvolume_usage') or 0)+(state_attr('sensor.telenet_telemeter_internet_w123456','extendedvolume_usage') or 0))/1024/1024)|int}}GB)


      Period {{state_attr('sensor.telenet_telemeter_internet_w123456','period_start') |
      as_timestamp | timestamp_custom("%d-%m-%Y")}} -
      {{state_attr('sensor.telenet_telemeter_internet_w123456','period_end') | as_timestamp |
      timestamp_custom("%d-%m-%Y")}} 

      {{state_attr('sensor.telenet_telemeter_internet_w123456','product')}}: {{state_attr('sensor.telenet_telemeter_internet_w123456','download_speed')}}/{{state_attr('sensor.telenet_telemeter_internet_w123456','upload_speed')}} (Peak {{states('sensor.telenet_telemeter_peak_w123456')}}, {{state_attr('sensor.telenet_telemeter_peak_w123456','download_speed')}})

      Laatste update:
      *{{state_attr('sensor.telenet_telemeter_internet_w123456','last update') | as_timestamp |
      timestamp_custom("%d-%m-%Y %H:%M")}}*
  - type: custom:dual-gauge-card
    title: false
    min: 0
    max: 100
    shadeInner: true
    cardwidth: 350
    outer:
      entity: sensor.telenet_telemeter_internet_w123456
      attribute: used_percentage
      label: used
      min: 0
      max: 100
      unit: '%'
      colors:
        - color: var(--label-badge-green)
          value: 0
        - color: var(--label-badge-yellow)
          value: 60
        - color: var(--label-badge-red)
          value: 80
    inner:
      entity: sensor.telenet_telemeter_internet_w123456
      label: period
      attribute: period_used_percentage
      min: 0
      max: 100
      unit: '%'
  - type: history-graph
    entities:
      - entity: sensor.telenet_telemeter_internet_w123456
    hours_to_show: 500
    refresh_interval: 60

Show Apex Chart markdown code example
  - type: custom:apexcharts-card
    apex_config:
      chart:
        stacked: true
      xaxis:
        labels:
          format: dd
      legend:
        show: true
    graph_span: 7d1s
    span:
      end: day
    show:
      last_updated: true
    header:
      show: true
      show_states: true
      colorize_states: true
    series:
      - entity: sensor.telenet_telemeter_peak_w123456
        attribute: peak_usage
        name: Peak
        unit: ' GB'
        type: column
        color: darkviolet
        group_by:
          func: max
          duration: 1d
        show:
          datalabels: true
        transform: return x;
      - entity: sensor.telenet_telemeter_peak_w123456
        attribute: offpeak_usage
        name: Offpeak
        unit: ' GB'
        type: column
        group_by:
          func: max
          duration: 1d
        show:
          datalabels: true
        transform: return x;

Show "Flex horseshoe card" code example
type: custom:flex-horseshoe-card
entities:
  - entity: sensor.telenet_telemeter
    attribute: period_used_percentage
    decimals: 1
    unit: "%"
    name: Telemeter
    tap_action:
      action: none
  - entity: sensor.telenet_telemeter
    attribute: period_days_left
    decimals: 0
    unit: d
    name: resterend
    icon: mdi:calendar
  - entity: sensor.telenet_telemeter
    attribute: includedvolume_usage
    decimals: 1
    unit: Gb
    name: verbruikt
show:
  horseshoe_style: colorstop
layout:
  hlines:
    - id: 0
      xpos: 50
      ypos: 40
      length: 50
      styles:
        - stroke-width: 1;
        - opacity: 0.6;
        - stroke-linecap: round;
  vlines:
    - id: 0
      xpos: 50
      ypos: 60
      length: 20
      styles:
        - stroke-width: 1;
        - opacity: 0.6;
        - stroke-linecap: round;
  states:
    - id: 0
      entity_index: 0
      xpos: 50
      ypos: 34
      styles:
        - font-size: 3em;
    - id: 1
      entity_index: 1
      xpos: 46
      ypos: 59
      styles:
        - font-size: 1.2em;
        - text-anchor: end
    - id: 2
      entity_index: 2
      xpos: 53
      ypos: 59
      styles:
        - font-size: 1.2em;
        - text-anchor: start
  names:
    - id: 0
      entity_index: 0
      xpos: 50
      ypos: 95
      styles:
        - font-size: 1.6em;
        - opacty: 1;
    - id: 1
      entity_index: 1
      xpos: 46
      ypos: 66
      styles:
        - font-size: 0.6em;
        - opacity: 0.6;
        - text-anchor: end
    - id: 2
      entity_index: 2
      xpos: 54
      ypos: 66
      styles:
        - font-size: 0.6em;
        - opacity: 0.6;
        - text-anchor: start
  icons:
    - id: 0
      entity_index: 1
      xpos: 31
      ypos: 58
      icon_size: 1.5
      align: end
      styles:
        - opacity: 0.6
horseshoe_scale:
  min: 0
  max: 100
color_stops:
  "90": "#FFC421"
  "95": "#FF0000"

Example conditional card:

A conditional card might be desired to show a warning when high data used and many days are left. For such a conditional card, an extra binary sensor can be defined in configuration.yml If data used_percentage (data used %) is bigger than the period_used_percentage (time % in current period) and data used_percentage is higher than a chosen percentage (eg 70%)

Show code example
binary_sensor:
  - platform: template
    sensors:
      telenet_warning:
        friendly_name: Telenet Warning
        value_template: >
           {{state_attr('sensor.telenet_telemeter_internet_w123456','used_percentage') > state_attr('sensor.telenet_telemeter_internet_w123456','period_used_percentage') and state_attr('sensor.telenet_telemeter_internet_w123456','used_percentage') > 70}}

This binary sensor can than be used in a conditional lovelace card. The info will only be shown in case you risk to be put on small band soon.

Show code example
type: conditional
conditions:
  - entity: binary_sensor.telenet_warning
    state: 'on'
card:
  type: markdown
  content: >-
    Total used:
    **{{state_attr('sensor.telenet_telemeter_internet_w123456','used_percentage')}}%**
    ({{(((state_attr('sensor.telenet_telemeter_internet_w123456','includedvolume_usage') or 0) + (state_attr('sensor.telenet_telemeter_internet_w123456','extendedvolume_usage') or 0) + (state_attr('sensor.telenet_telemeter_internet_w123456','peak_usage') or 0))/1024/1024)|int}}GB
    of {{state_attr('sensor.telenet_telemeter_internet_w123456','total_volume')|int}}GB)
    {{state_attr('sensor.telenet_telemeter_internet_w123456','period_days_left')|int}} days remaining

About

Telenet Telemeter Home Assistant custom component HACS for Belgian ISP and mobile phone network traffic.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages