Add translated native unit of measurement - Transmission (#131913)
parent
66d0d2eb6c
commit
79ed6d865f
|
@ -83,7 +83,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
|
||||||
TransmissionSensorEntityDescription(
|
TransmissionSensorEntityDescription(
|
||||||
key="active_torrents",
|
key="active_torrents",
|
||||||
translation_key="active_torrents",
|
translation_key="active_torrents",
|
||||||
native_unit_of_measurement="torrents",
|
|
||||||
val_func=lambda coordinator: coordinator.data.active_torrent_count,
|
val_func=lambda coordinator: coordinator.data.active_torrent_count,
|
||||||
extra_state_attr_func=lambda coordinator: _torrents_info_attr(
|
extra_state_attr_func=lambda coordinator: _torrents_info_attr(
|
||||||
coordinator=coordinator, key="active_torrents"
|
coordinator=coordinator, key="active_torrents"
|
||||||
|
@ -92,7 +91,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
|
||||||
TransmissionSensorEntityDescription(
|
TransmissionSensorEntityDescription(
|
||||||
key="paused_torrents",
|
key="paused_torrents",
|
||||||
translation_key="paused_torrents",
|
translation_key="paused_torrents",
|
||||||
native_unit_of_measurement="torrents",
|
|
||||||
val_func=lambda coordinator: coordinator.data.paused_torrent_count,
|
val_func=lambda coordinator: coordinator.data.paused_torrent_count,
|
||||||
extra_state_attr_func=lambda coordinator: _torrents_info_attr(
|
extra_state_attr_func=lambda coordinator: _torrents_info_attr(
|
||||||
coordinator=coordinator, key="paused_torrents"
|
coordinator=coordinator, key="paused_torrents"
|
||||||
|
@ -101,7 +99,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
|
||||||
TransmissionSensorEntityDescription(
|
TransmissionSensorEntityDescription(
|
||||||
key="total_torrents",
|
key="total_torrents",
|
||||||
translation_key="total_torrents",
|
translation_key="total_torrents",
|
||||||
native_unit_of_measurement="torrents",
|
|
||||||
val_func=lambda coordinator: coordinator.data.torrent_count,
|
val_func=lambda coordinator: coordinator.data.torrent_count,
|
||||||
extra_state_attr_func=lambda coordinator: _torrents_info_attr(
|
extra_state_attr_func=lambda coordinator: _torrents_info_attr(
|
||||||
coordinator=coordinator, key="total_torrents"
|
coordinator=coordinator, key="total_torrents"
|
||||||
|
@ -110,7 +107,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
|
||||||
TransmissionSensorEntityDescription(
|
TransmissionSensorEntityDescription(
|
||||||
key="completed_torrents",
|
key="completed_torrents",
|
||||||
translation_key="completed_torrents",
|
translation_key="completed_torrents",
|
||||||
native_unit_of_measurement="torrents",
|
|
||||||
val_func=lambda coordinator: len(
|
val_func=lambda coordinator: len(
|
||||||
_filter_torrents(coordinator.torrents, MODES["completed_torrents"])
|
_filter_torrents(coordinator.torrents, MODES["completed_torrents"])
|
||||||
),
|
),
|
||||||
|
@ -121,7 +117,6 @@ SENSOR_TYPES: tuple[TransmissionSensorEntityDescription, ...] = (
|
||||||
TransmissionSensorEntityDescription(
|
TransmissionSensorEntityDescription(
|
||||||
key="started_torrents",
|
key="started_torrents",
|
||||||
translation_key="started_torrents",
|
translation_key="started_torrents",
|
||||||
native_unit_of_measurement="torrents",
|
|
||||||
val_func=lambda coordinator: len(
|
val_func=lambda coordinator: len(
|
||||||
_filter_torrents(coordinator.torrents, MODES["started_torrents"])
|
_filter_torrents(coordinator.torrents, MODES["started_torrents"])
|
||||||
),
|
),
|
||||||
|
|
|
@ -60,19 +60,24 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"active_torrents": {
|
"active_torrents": {
|
||||||
"name": "Active torrents"
|
"name": "Active torrents",
|
||||||
|
"unit_of_measurement": "torrents"
|
||||||
},
|
},
|
||||||
"paused_torrents": {
|
"paused_torrents": {
|
||||||
"name": "Paused torrents"
|
"name": "Paused torrents",
|
||||||
|
"unit_of_measurement": "[%key:component::transmission::entity::sensor::active_torrents::unit_of_measurement%]"
|
||||||
},
|
},
|
||||||
"total_torrents": {
|
"total_torrents": {
|
||||||
"name": "Total torrents"
|
"name": "Total torrents",
|
||||||
|
"unit_of_measurement": "[%key:component::transmission::entity::sensor::active_torrents::unit_of_measurement%]"
|
||||||
},
|
},
|
||||||
"completed_torrents": {
|
"completed_torrents": {
|
||||||
"name": "Completed torrents"
|
"name": "Completed torrents",
|
||||||
|
"unit_of_measurement": "[%key:component::transmission::entity::sensor::active_torrents::unit_of_measurement%]"
|
||||||
},
|
},
|
||||||
"started_torrents": {
|
"started_torrents": {
|
||||||
"name": "Started torrents"
|
"name": "Started torrents",
|
||||||
|
"unit_of_measurement": "[%key:component::transmission::entity::sensor::active_torrents::unit_of_measurement%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"switch": {
|
"switch": {
|
||||||
|
|
Loading…
Reference in New Issue