mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Add translated native unit of measurement - QBitTorrent (#131918)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
parent
8d1493036a
commit
66d0d2eb6c
@ -100,13 +100,11 @@ SENSOR_TYPES: tuple[QBittorrentSensorEntityDescription, ...] = (
|
|||||||
QBittorrentSensorEntityDescription(
|
QBittorrentSensorEntityDescription(
|
||||||
key=SENSOR_TYPE_ALL_TORRENTS,
|
key=SENSOR_TYPE_ALL_TORRENTS,
|
||||||
translation_key="all_torrents",
|
translation_key="all_torrents",
|
||||||
native_unit_of_measurement="torrents",
|
|
||||||
value_fn=lambda coordinator: count_torrents_in_states(coordinator, []),
|
value_fn=lambda coordinator: count_torrents_in_states(coordinator, []),
|
||||||
),
|
),
|
||||||
QBittorrentSensorEntityDescription(
|
QBittorrentSensorEntityDescription(
|
||||||
key=SENSOR_TYPE_ACTIVE_TORRENTS,
|
key=SENSOR_TYPE_ACTIVE_TORRENTS,
|
||||||
translation_key="active_torrents",
|
translation_key="active_torrents",
|
||||||
native_unit_of_measurement="torrents",
|
|
||||||
value_fn=lambda coordinator: count_torrents_in_states(
|
value_fn=lambda coordinator: count_torrents_in_states(
|
||||||
coordinator, ["downloading", "uploading"]
|
coordinator, ["downloading", "uploading"]
|
||||||
),
|
),
|
||||||
@ -114,7 +112,6 @@ SENSOR_TYPES: tuple[QBittorrentSensorEntityDescription, ...] = (
|
|||||||
QBittorrentSensorEntityDescription(
|
QBittorrentSensorEntityDescription(
|
||||||
key=SENSOR_TYPE_INACTIVE_TORRENTS,
|
key=SENSOR_TYPE_INACTIVE_TORRENTS,
|
||||||
translation_key="inactive_torrents",
|
translation_key="inactive_torrents",
|
||||||
native_unit_of_measurement="torrents",
|
|
||||||
value_fn=lambda coordinator: count_torrents_in_states(
|
value_fn=lambda coordinator: count_torrents_in_states(
|
||||||
coordinator, ["stalledDL", "stalledUP"]
|
coordinator, ["stalledDL", "stalledUP"]
|
||||||
),
|
),
|
||||||
@ -122,7 +119,6 @@ SENSOR_TYPES: tuple[QBittorrentSensorEntityDescription, ...] = (
|
|||||||
QBittorrentSensorEntityDescription(
|
QBittorrentSensorEntityDescription(
|
||||||
key=SENSOR_TYPE_PAUSED_TORRENTS,
|
key=SENSOR_TYPE_PAUSED_TORRENTS,
|
||||||
translation_key="paused_torrents",
|
translation_key="paused_torrents",
|
||||||
native_unit_of_measurement="torrents",
|
|
||||||
value_fn=lambda coordinator: count_torrents_in_states(
|
value_fn=lambda coordinator: count_torrents_in_states(
|
||||||
coordinator, ["pausedDL", "pausedUP"]
|
coordinator, ["pausedDL", "pausedUP"]
|
||||||
),
|
),
|
||||||
|
@ -36,16 +36,20 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"active_torrents": {
|
"active_torrents": {
|
||||||
"name": "Active torrents"
|
"name": "Active torrents",
|
||||||
|
"unit_of_measurement": "torrents"
|
||||||
},
|
},
|
||||||
"inactive_torrents": {
|
"inactive_torrents": {
|
||||||
"name": "Inactive torrents"
|
"name": "Inactive torrents",
|
||||||
|
"unit_of_measurement": "[%key:component::qbittorrent::entity::sensor::active_torrents::unit_of_measurement%]"
|
||||||
},
|
},
|
||||||
"paused_torrents": {
|
"paused_torrents": {
|
||||||
"name": "Paused torrents"
|
"name": "Paused torrents",
|
||||||
|
"unit_of_measurement": "[%key:component::qbittorrent::entity::sensor::active_torrents::unit_of_measurement%]"
|
||||||
},
|
},
|
||||||
"all_torrents": {
|
"all_torrents": {
|
||||||
"name": "All torrents"
|
"name": "All torrents",
|
||||||
|
"unit_of_measurement": "[%key:component::qbittorrent::entity::sensor::active_torrents::unit_of_measurement%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"switch": {
|
"switch": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user