Add entity translations to Speedtest.net (#96168)

* Add entity translations to Speedtest.net

* Fix tests
This commit is contained in:
Joost Lekkerkerker 2023-07-09 20:20:39 +02:00 committed by GitHub
parent 0735b39fbb
commit 8bbb395bec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 13 deletions

View file

@ -44,20 +44,20 @@ class SpeedtestSensorEntityDescription(SensorEntityDescription):
SENSOR_TYPES: tuple[SpeedtestSensorEntityDescription, ...] = (
SpeedtestSensorEntityDescription(
key="ping",
name="Ping",
translation_key="ping",
native_unit_of_measurement=UnitOfTime.MILLISECONDS,
state_class=SensorStateClass.MEASUREMENT,
),
SpeedtestSensorEntityDescription(
key="download",
name="Download",
translation_key="download",
native_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND,
state_class=SensorStateClass.MEASUREMENT,
value=lambda value: round(value / 10**6, 2),
),
SpeedtestSensorEntityDescription(
key="upload",
name="Upload",
translation_key="upload",
native_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND,
state_class=SensorStateClass.MEASUREMENT,
value=lambda value: round(value / 10**6, 2),