Skip to content

DigitallyRefined/ha-cloudflare-speed-test

Repository files navigation

Cloudflare Speed Test for Home Assistant

Validate with hassfest HACS Validate hacs_badge

downloads downloads

This integration uses the cloudflarepycli Python library to retrieve network performance statistics from https://speed.cloudflare.com including:

  • 90th percentile down/up
  • 25MB down
  • 10MB down/up
  • 1MB down/up
  • 100kB down/up
  • Latency
  • Jitter
  • ISP
  • IP address

It also attaches the test servers city, region and code to each result.

Installation

Using HACS

If you dont' have HACS installed yet, I highly recommend it.

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.
Or search for Cloudflare Speed Test in HACS or copy this GitHub URL and add it as a custom integration repository.

Manual

Download the latest cloudflare_speed_test.zip release and extract it into your <config>/custom_component folder.

Setup

After installation you need to restart Home Assistant before using this integration.

Open your Home Assistant instance and start setting up a new integration.
Or go to Settings -> Devices & Services
Click Add integration and search for Cloudflare Speed Test

Configuration

By default, a speed test will be run every hour or you can set a custom interval.

If you want to select an exact time when the speed test should run (e.g. to be more specific such as once a day over night) you can disable the default polling interval and create your own timed automation.

To disable polling and create your own timed automation:

  1. Go to Settings > Devices & services, and select the Cloudflare Speed Test integration.
  2. On the integration entry, select the hamburger menu icon
    • Then, select System options and toggle the button to disable polling.
  3. To define your custom polling interval, create an automation.
    1. Go to Settings > Automations & scenes and create a new automation.
    2. Define any triggers/conditions you like e.g. a time trigger.
    3. Select Add action, then, select Other actions.
    4. Select Perform action, and from the list, select the homeassistant.update_entity action (note: only select one entity, the other entities will be automatically updated).
  4. Save the automation to automatically trigger based on your own schedule.

Add to dashboard

Graph screenshot

To add graphs to your dashboard, the following YAML can be used:

Expand for dashboard YAML
- chart_type: line
  period: day
  type: statistics-graph
  entities:
    - sensor.cloudflare_speed_test_90th_percentile_down
    - sensor.cloudflare_speed_test_25mb_down
    - sensor.cloudflare_speed_test_10mb_down
    - sensor.cloudflare_speed_test_1mb_down
    - sensor.cloudflare_speed_test_100kb_down
  stat_types:
    - max
  title: Download speed
- chart_type: line
  period: day
  type: statistics-graph
  entities:
    - sensor.cloudflare_speed_test_90th_percentile_up
    - sensor.cloudflare_speed_test_10mb_up
    - sensor.cloudflare_speed_test_1mb_up
    - sensor.cloudflare_speed_test_100kb_up
  stat_types:
    - max
  title: Upload speed
- chart_type: line
  period: day
  type: statistics-graph
  entities:
    - sensor.cloudflare_speed_test_latency
    - sensor.cloudflare_speed_test_jitter
  stat_types:
    - min
  title: Ping

Notes

  • When running on Raspberry Pi the maximum speed is limited by the LAN adapter. The Raspberry Pi 3+ models come with a Gigabit LAN adapter which supports a maximum throughput of 300 Mbit/s.
  • Running this integration can have negative effects on the system’s performance as it requires a fair amount of memory.
  • If run frequently, this integration has the ability to use a considerable amount of data. Frequent updates should be avoided on bandwidth-capped connections.
  • While a speed test is running your network capacity is fully utilized. This may have a negative effect on other devices using the network such as gaming consoles or streaming boxes.
  • This integration and its author are not affiliated or associated with Cloudflare.

Attribution

Original idea from @rohankapoorcom, @engrbm87

About

Cloudflare Speed Test for Home Assistant

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages