Add translated native unit of measurement - Transmission (#131913)

pull/132055/head
Andrew Jackson 2024-12-02 09:51:32 +00:00 committed by GitHub
parent 66d0d2eb6c
commit 79ed6d865f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View File

@ -83,7 +83,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
TransmissionSensorEntityDescription(
key="active_torrents",
translation_key="active_torrents",
native_unit_of_measurement="torrents",
val_func=lambda coordinator: coordinator.data.active_torrent_count,
extra_state_attr_func=lambda coordinator: _torrents_info_attr(
coordinator=coordinator, key="active_torrents"
@ -92,7 +91,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
TransmissionSensorEntityDescription(
key="paused_torrents",
translation_key="paused_torrents",
native_unit_of_measurement="torrents",
val_func=lambda coordinator: coordinator.data.paused_torrent_count,
extra_state_attr_func=lambda coordinator: _torrents_info_attr(
coordinator=coordinator, key="paused_torrents"
@ -101,7 +99,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
TransmissionSensorEntityDescription(
key="total_torrents",
translation_key="total_torrents",
native_unit_of_measurement="torrents",
val_func=lambda coordinator: coordinator.data.torrent_count,
extra_state_attr_func=lambda coordinator: _torrents_info_attr(
coordinator=coordinator, key="total_torrents"
@ -110,7 +107,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
TransmissionSensorEntityDescription(
key="completed_torrents",
translation_key="completed_torrents",
native_unit_of_measurement="torrents",
val_func=lambda coordinator: len(
_filter_torrents(coordinator.torrents, MODES["completed_torrents"])
),
@ -121,7 +117,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
TransmissionSensorEntityDescription(
key="started_torrents",
translation_key="started_torrents",
native_unit_of_measurement="torrents",
val_func=lambda coordinator: len(
_filter_torrents(coordinator.torrents, MODES["started_torrents"])
),

View File

@ -60,19 +60,24 @@
}
},
"active_torrents": {
"name": "Active torrents"
"name": "Active torrents",
"unit_of_measurement": "torrents"
},
"paused_torrents": {
"name": "Paused torrents"
"name": "Paused torrents",
"unit_of_measurement": "[%key:component::transmission::entity::sensor::active_torrents::unit_of_measurement%]"
},
"total_torrents": {
"name": "Total torrents"
"name": "Total torrents",
"unit_of_measurement": "[%key:component::transmission::entity::sensor::active_torrents::unit_of_measurement%]"
},
"completed_torrents": {
"name": "Completed torrents"
"name": "Completed torrents",
"unit_of_measurement": "[%key:component::transmission::entity::sensor::active_torrents::unit_of_measurement%]"
},
"started_torrents": {
"name": "Started torrents"
"name": "Started torrents",
"unit_of_measurement": "[%key:component::transmission::entity::sensor::active_torrents::unit_of_measurement%]"
}
},
"switch": {