Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Constants for the Deluge integration."""
2 
3 import enum
4 import logging
5 from typing import Final
6 
7 CONF_WEB_PORT = "web_port"
8 DEFAULT_NAME = "Deluge"
9 DEFAULT_RPC_PORT = 58846
10 DEFAULT_WEB_PORT = 8112
11 DOMAIN: Final = "deluge"
12 LOGGER = logging.getLogger(__package__)
13 
14 
15 class DelugeGetSessionStatusKeys(enum.Enum):
16  """Enum representing the keys that get passed into the Deluge RPC `core.get_session_status` xml rpc method.
17 
18  You can call `core.get_session_status` with no keys (so an empty list in deluge-client.DelugeRPCClient.call)
19  to get the full list of possible keys, but it seems to basically be a all of the session statistics
20  listed on this page: https://www.rasterbar.com/products/libtorrent/manual-ref.html#session-statistics
21  and a few others
22 
23  there is also a list of deprecated keys that deluge will translate for you and issue a warning in the log:
24  https://github.com/deluge-torrent/deluge/blob/7f3f7f69ee78610e95bea07d99f699e9310c4e08/deluge/core/core.py#L58
25 
26  """
27 
28  DHT_DOWNLOAD_RATE = "dht_download_rate"
29  DHT_UPLOAD_RATE = "dht_upload_rate"
30  DOWNLOAD_RATE = "download_rate"
31  UPLOAD_RATE = "upload_rate"
32 
33 
34 class DelugeSensorType(enum.StrEnum):
35  """Enum that distinguishes the different sensor types that the Deluge integration has.
36 
37  This is mainly used to avoid passing strings around and to distinguish between similarly
38  named strings in `DelugeGetSessionStatusKeys`.
39  """
40 
41  CURRENT_STATUS_SENSOR = "current_status"
42  DOWNLOAD_SPEED_SENSOR = "download_speed"
43  UPLOAD_SPEED_SENSOR = "upload_speed"
44  PROTOCOL_TRAFFIC_UPLOAD_SPEED_SENSOR = "protocol_traffic_upload_speed"
45  PROTOCOL_TRAFFIC_DOWNLOAD_SPEED_SENSOR = "protocol_traffic_download_speed"