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 = { SUPPORTED_ORDER_MODES = {
ORDER_NEWEST_FIRST: lambda torrents: sorted( 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_WORST_RATIO_FIRST: lambda torrents: sorted(torrents, key=lambda t: t.ratio),
ORDER_BEST_RATIO_FIRST: lambda torrents: sorted( ORDER_BEST_RATIO_FIRST: lambda torrents: sorted(
torrents, key=lambda t: t.ratio, reverse=True torrents, key=lambda t: t.ratio, reverse=True

View file

@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/transmission", "documentation": "https://www.home-assistant.io/integrations/transmission",
"iot_class": "local_polling", "iot_class": "local_polling",
"loggers": ["transmissionrpc"], "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.""" """Get the latest data from Transmission and updates the state."""
if data := self._tm_client.api.data: if data := self._tm_client.api.data:
b_spd = ( b_spd = (
float(data.downloadSpeed) float(data.download_speed)
if self._sub_type == "download" if self._sub_type == "download"
else float(data.uploadSpeed) else float(data.upload_speed)
) )
self._state = b_spd self._state = b_spd
@ -134,8 +134,8 @@ class TransmissionStatusSensor(TransmissionSensor):
def update(self) -> None: def update(self) -> None:
"""Get the latest data from Transmission and updates the state.""" """Get the latest data from Transmission and updates the state."""
if data := self._tm_client.api.data: if data := self._tm_client.api.data:
upload = data.uploadSpeed upload = data.upload_speed
download = data.downloadSpeed download = data.download_speed
if upload > 0 and download > 0: if upload > 0 and download > 0:
self._state = STATE_UP_DOWN self._state = STATE_UP_DOWN
elif upload > 0 and download == 0: elif upload > 0 and download == 0:
@ -199,8 +199,8 @@ def _torrents_info(torrents, order, limit, statuses=None):
torrents = SUPPORTED_ORDER_MODES[order](torrents) torrents = SUPPORTED_ORDER_MODES[order](torrents)
for torrent in torrents[:limit]: for torrent in torrents[:limit]:
info = infos[torrent.name] = { info = infos[torrent.name] = {
"added_date": torrent.addedDate, "added_date": torrent.date_added,
"percent_done": f"{torrent.percentDone * 100:.2f}", "percent_done": f"{torrent.percent_done * 100:.2f}",
"status": torrent.status, "status": torrent.status,
"id": torrent.id, "id": torrent.id,
} }

View file

@ -118,7 +118,7 @@ class TransmissionSwitch(SwitchEntity):
if self.type == "on_off": if self.type == "on_off":
self._data = self._tm_client.api.data self._data = self._tm_client.api.data
if self._data: if self._data:
active = self._data.activeTorrentCount > 0 active = self._data.active_torrent_count > 0
elif self.type == "turtle_mode": elif self.type == "turtle_mode":
active = self._tm_client.api.get_alt_speed_enabled() 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 tplink-omada-client==1.1.4
# homeassistant.components.transmission # homeassistant.components.transmission
transmission-rpc==3.4.0 transmission-rpc==4.1.5
# homeassistant.components.twinkly # homeassistant.components.twinkly
ttls==1.5.1 ttls==1.5.1

View file

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