Speedtest - Ping unit

Hello everyone,

I have encountered an issue with how the Speedtest integration data are displayed in my dashboard, specifically the ping value. Instead of showing the ping in milliseconds (ms), it is converted to seconds without any accompanying unit. For instance : “0.018” instead of “18 ms” :


The sensor is configured by default by the integration and I didn’t modify anything:

  • device_class: duration
  • unit_of_measurement: ms

So, when I check the history value (graph), I do see the values in ms:

I’ve used this integration for several years, and having ping displayed without its unit just looks weird to me now. I’m not entirely certain, but it seems like this might be tied to a recent update.

Could someone enlighten me?

Thank you!

I’m having the same issue too. I believe it’s an issue with 2023.11, since I just noticed it for the first time after updating today.

Please post a screenshot from Dev tools - Set state for this “ping” sensor created by Speedtest integration.

The state is clearly 19 - But it shows as 0.019 (no unit) when displayed as an entity in the dashboard

Not using the Speedtest integration myself, just a guess:
probably it happens because the sensor has a “device_class: duration”.
Usually a duration is displayed as hh:mm:ss, and probably it is displayed as “0.019” if it is less than 1second. And seems that in both cases the UoM is not displayed.
This guess could be confirmed by creating a test template sensor with “device_class: duration”; set different values to this sensor and check how it is displayed.
Cannot test it myself, please do it.
As for the defined UoM - now I wonder what is a meaning to define it then.

Thanks, I will do the test tonight.
This is a sensor created directly from the SpeedTest integration, I didn’t set the device_class and unit of measurement, and I’m pretty sure it was displayed with its unit prior to 2023.11.0. I agree that a duration can be displayed as HH:MM:SS, but there is nothing wrong with 1.25min or 25ms if it makes sense in a specific context

same issue here!

I did some tests:

  • If the unit of measurement is ‘d’, ‘h’, ‘min’, ‘s’, ‘ms’ the unit will not be displayed, and the frontend will try to display it in the ‘hh:mm:ss’ format whenever possible. i.e., the value 100 will be displayed as 1:40 if the UoM is seconds, 1:40:00 if the UoM is min, etc. 150000 with UoM = ‘ms’ will be displayed as 2:30 (2 min 30s), but 100 ms only shows 0.1 without unit…
  • If the UoM is a random string of characters, the unit is displayed right after the numeric value. For instance the value 101.15 with UoM = “XXX” is displayed as 101.15 XXX.
    It means that some UoM are understood natively by the device class (‘d’, ‘h’, ‘min’, ‘s’,‘ms’) and the frontend converts the duration to hh:mm:ss. It confirms your assumption, but it’s clearly not ideal for very small values and clearly different from the behavior of the previous HA versions.
1 Like

Do you see any warnings/errors in log like “sensor has device_class duration but has UoM xxxxxx”?

IMHO for values < 1 sec it should definitely show UoM.
0.000056 hour
0.0000456 min
0.33 sec
123 ms

I flashed a backup with core version 2023.9.x and the ping sensor is properly displayed (with ms units). It confirms something changed in version 2023.10 or 2023.11

How it was displayed in 2023.9.X:

Vs how it’s displayed now in 2023.11.2: