Speedtest Ping replacement sensor

I have found the Speedtest ping sensor to be very unreliable, reporting round trip times of 400ms or more when any other ping tester on my network reports a more reasonable ~25ms (to google.com).

There is a note on the github page that this won’t be fixed: https://github.com/sivel/speedtest-cli#inconsistency

The up and download speed tests seem to be fine.

So I’ve created a replacement for the ping sensor using the ping binary sensor and a template sensor to get the average round trip time attribute:

binary sensor (not used in the front end)

- platform: ping
  name: Google DNS Ping
  count: 5
  scan_interval: 600

sensor (used to display ping information)

- platform: template
      friendly_name: 'Ping'
        - binary_sensor.google_dns_ping
      value_template: "{{ state_attr('binary_sensor.google_dns_ping', 'round_trip_time_avg') | round(2) }}"
      unit_of_measurement: "ms"


  icon: mdi:speedometer

Thanks for the share :wink: For speedtest it’s too short tests in all matters to be really efficient !
For ping be careful to use some reliable servers for ping (DNS servers are not done for ping answers so answer time might be moving a lot due to server charges, all the more the google ones that are using a worldwide system with bunch of servers behind a unique public IP). I have setup mine to use some main websites in my country to get a better image :wink:

I had a brain aneurysm trying to read and understand that.

Sorry for the technical explanation but to make it short and easier, just use some physical IP (less and less easy to find but it means an IP that points to a single physical server :wink: to get a real accurate measure (well at best :wink:

Technical is not the problem. Still I suppose your English is better than my French.

I think what you are trying to say is, dont rely on pinging a domain that has multiple servers.

Sorry but you never ping a domain but a host :wink: and right don’t ping Host IP that are multi-hosts (not always easy to guess but most big services like google, facebook are always multi-hosts unless only public IP adress :wink:

google.com is a domain name that has many hosts. I’m pinging a domain name.

you are pinging which is a multi-host, not a domain

nope, domain name or FQDN (Fully Qualified Domain Name) you specify is resolved to one or more IPs and your ping program uses one of these IPs for doing the ping !

If you look at my config I’m pinging the domain name which resolves to a mulit-host

Shit. No I’m not.

Either way, it’s completely beside the point.

Find a single IP if you need that much accuracy. I’m not going to bother.

Most ISP have an IP you can use for this purpose TPG have a test site for speedtest for example.

Is that published by Ookla? ABB has their own ookla site too but you can only access that through the portal on ABB - there’s no ID you can use in the speedtest.net sensor for it.

ABB is my RSP. I’ve changed over to pinging their primary DNS server as I was still seeing the occasional +300ms result form pinging So maybe the speedtest sensor was correct after all. Or maybe I was seeing multi-host issues. Or maybe ABB has a problem.

If this runs well on AAB’s DNS IP for a few days I’ll look at finding a single IP outside ABB’s network.

Have you seen my ABB usage script and Lovelace card?

I had not. Very nice. Thanks, I’ll give it a go.

1 Like

Excellent. Everything seems to be working.

I just have to work out how to add another bar graph for % data used this month as I’m not on an unlimited plan and would like to compare this to the month used graph. I managed to change the total text from Unlimited to 500GB easy enough.

It should have read the limit automagically… did it not? Oh shit it doesn’t… I wonder why.

(vars[4] =! 'null' ? vars[4] : 'Unlimited' + '\xa0' + 'GB')

if the limit is null it switches to unlimited and it it’s anything else it should use that…

          - type: 'custom:bar-card'
            title: Month Used
            entity: sensor.abb_usage
            attribute: usedMb
            min: 1
            max: sensor.abb_usage.attributes.remainingMb
            height: 20px
            direction: right
            unit_of_measurement: MB

something like that? I might have screwed up the variable name… hmmmm

Actually not screwed up, just need to add used and remaining to get the limit. doh.

No, I got ‘Unlimited’. I’m definitely on a 500GB plan:

I’ve changed the text back.

Also it does not seem to be updating.

I’ve tried the shell command with and without quotes. Calling the service from the dev tools does nothing. I did change it to executable. The path is correct.

shell command:

abbusage: /bin/bash /config/abbusage/abbusage_ha.sh

automation (note: the action is also included in my start up automation).

- id: updateabbusage
  alias: Update ABB Usage
  initial_state: true
    platform: time_pattern
    minutes: '/15'
    service: shell_command.abbusage