Speedtest.net - how to show when broadband down?

I’ve been running speedtest.net in my HA for ages and the graphs have been great to show my ISP when complaining about speed issues! I’d like it to handle an actual broadband outage better though. What the graph currently shows is just the last successful result as a flat line until the service is resumed. Is there a way I can force it to show 0 for download / upload when it is unable to connect? If not, is there some other sort of coarse internet up/down sensor I could use in conjunction with it?

I use DNS IP integration. Shows unknown when Internet is down, your public IP when UP

1 Like

Alternatively the Ping integration https://www.home-assistant.io/integrations/ping/

When I was temporarily using a 4G router for internet, it used to lose connection. Using the ping integration (to google DNS 8.8.8.8) it would pick up the loss of connection, and I could restart the router with a smart power switch.

1 Like

I have a threshold binary sensor and an alert setup to notify me when the speed drops below a set value:

- platform: threshold
  name: "Broadband Speed Low"
  entity_id: sensor.speedtest_download
  lower: 100.0
  hysteresis: 5.0
  device_class: problem
broadband_low_speed:
  name: "Broadband Low Speed"
  title: "Warning - Broadband low speed detected"
  message: "Check router for possible problem"
  entity_id: binary_sensor.broadband_speed_low
  state: 'on'
  repeat: 1440
  can_acknowledge: true
  skip_first: false
  notifiers:
    - mobile_app_sm_g970f
    - mobile_app_sm_t580

This also appears on my home dashboard “alarm list”:

image

1 Like

Thanks. What would this do if on one poll the speed was above your lower limit, and then from the following poll onwards there was no internet at all? Wouldn’t this by like my problem with the graph, where it just continually shows the last good value?

You could create a template sensor that copies the up/download values but returns 0 when they are unavailable or unknown.

1 Like

Perfect, that’s exactly what I was after, thanks!

Let us know if you need help with it.

1 Like

As @tom_I says … if you replace the threshold binary sensor with a template binary sensor then you can make it do what you want.

Actually rather than a template binary sensor I was taking about a template sensor for graphing and use with numeric triggers.

Thanks everyone. When I realised you could set a default value for float, it all became very simple:

sensor:
  - platform: template
    sensors:
      speedtest_down_special:
        friendly_name: Download Speed (0 = no service)
        value_template: >
          {{ states('sensor.speedtest_download') | float(default=0) }}
        unit_of_measurement: 'Mbit/s'

1 Like