Bump transmission-rpc to 4.1.5 (#91088)

Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
This commit is contained in:
Jörg Thalheim 2023-04-09 21:51:31 +01:00 committed by GitHub
parent e30c307f9f
commit 7e46d7e808
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 12 deletions

View file

@ -10,9 +10,9 @@ ORDER_WORST_RATIO_FIRST = "worst_ratio_first"
SUPPORTED_ORDER_MODES = {
ORDER_NEWEST_FIRST: lambda torrents: sorted(
torrents, key=lambda t: t.addedDate, reverse=True
torrents, key=lambda t: t.date_added, reverse=True
),
ORDER_OLDEST_FIRST: lambda torrents: sorted(torrents, key=lambda t: t.addedDate),
ORDER_OLDEST_FIRST: lambda torrents: sorted(torrents, key=lambda t: t.date_added),
ORDER_WORST_RATIO_FIRST: lambda torrents: sorted(torrents, key=lambda t: t.ratio),
ORDER_BEST_RATIO_FIRST: lambda torrents: sorted(
torrents, key=lambda t: t.ratio, reverse=True

View file

@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/transmission",
"iot_class": "local_polling",
"loggers": ["transmissionrpc"],
"requirements": ["transmission-rpc==3.4.0"]
"requirements": ["transmission-rpc==4.1.5"]
}

View file

@ -117,9 +117,9 @@ class TransmissionSpeedSensor(TransmissionSensor):
"""Get the latest data from Transmission and updates the state."""
if data := self._tm_client.api.data:
b_spd = (
float(data.downloadSpeed)
float(data.download_speed)
if self._sub_type == "download"
else float(data.uploadSpeed)
else float(data.upload_speed)
)
self._state = b_spd
@ -134,8 +134,8 @@ class TransmissionStatusSensor(TransmissionSensor):
def update(self) -> None:
"""Get the latest data from Transmission and updates the state."""
if data := self._tm_client.api.data:
upload = data.uploadSpeed
download = data.downloadSpeed
upload = data.upload_speed
download = data.download_speed
if upload > 0 and download > 0:
self._state = STATE_UP_DOWN
elif upload > 0 and download == 0:
@ -199,8 +199,8 @@ def _torrents_info(torrents, order, limit, statuses=None):
torrents = SUPPORTED_ORDER_MODES[order](torrents)
for torrent in torrents[:limit]:
info = infos[torrent.name] = {
"added_date": torrent.addedDate,
"percent_done": f"{torrent.percentDone * 100:.2f}",
"added_date": torrent.date_added,
"percent_done": f"{torrent.percent_done * 100:.2f}",
"status": torrent.status,
"id": torrent.id,
}

View file

@ -118,7 +118,7 @@ class TransmissionSwitch(SwitchEntity):
if self.type == "on_off":
self._data = self._tm_client.api.data
if self._data:
active = self._data.activeTorrentCount > 0
active = self._data.active_torrent_count > 0
elif self.type == "turtle_mode":
active = self._tm_client.api.get_alt_speed_enabled()

View file

@ -2521,7 +2521,7 @@ tp-connected==0.0.4
tplink-omada-client==1.1.4
# homeassistant.components.transmission
transmission-rpc==3.4.0
transmission-rpc==4.1.5
# homeassistant.components.twinkly
ttls==1.5.1

View file

@ -1797,7 +1797,7 @@ total_connect_client==2023.2
tplink-omada-client==1.1.4
# homeassistant.components.transmission
transmission-rpc==3.4.0
transmission-rpc==4.1.5
# homeassistant.components.twinkly
ttls==1.5.1