Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Constants for the FRITZ!Box Tools integration."""
2 
3 from enum import StrEnum
4 from typing import Literal
5 
6 from fritzconnection.core.exceptions import (
7  FritzActionError,
8  FritzActionFailedError,
9  FritzAuthorizationError,
10  FritzConnectionException,
11  FritzInternalError,
12  FritzLookUpError,
13  FritzSecurityError,
14  FritzServiceError,
15 )
16 
17 from homeassistant.const import Platform
18 
19 
20 class MeshRoles(StrEnum):
21  """Available Mesh roles."""
22 
23  NONE = "none"
24  MASTER = "master"
25  SLAVE = "slave"
26 
27 
28 DOMAIN = "fritz"
29 
30 PLATFORMS = [
31  Platform.BINARY_SENSOR,
32  Platform.BUTTON,
33  Platform.DEVICE_TRACKER,
34  Platform.IMAGE,
35  Platform.SENSOR,
36  Platform.SWITCH,
37  Platform.UPDATE,
38 ]
39 
40 CONF_OLD_DISCOVERY = "old_discovery"
41 DEFAULT_CONF_OLD_DISCOVERY = False
42 
43 DATA_FRITZ = "fritz_data"
44 
45 DSL_CONNECTION: Literal["dsl"] = "dsl"
46 
47 DEFAULT_DEVICE_NAME = "Unknown device"
48 DEFAULT_HOST = "192.168.178.1"
49 DEFAULT_HTTP_PORT = 49000
50 DEFAULT_HTTPS_PORT = 49443
51 DEFAULT_USERNAME = ""
52 DEFAULT_SSL = False
53 
54 ERROR_AUTH_INVALID = "invalid_auth"
55 ERROR_CANNOT_CONNECT = "cannot_connect"
56 ERROR_UPNP_NOT_CONFIGURED = "upnp_not_configured"
57 ERROR_UNKNOWN = "unknown_error"
58 
59 FRITZ_SERVICES = "fritz_services"
60 SERVICE_SET_GUEST_WIFI_PW = "set_guest_wifi_password"
61 
62 SWITCH_TYPE_DEFLECTION = "CallDeflection"
63 SWITCH_TYPE_PORTFORWARD = "PortForward"
64 SWITCH_TYPE_PROFILE = "Profile"
65 SWITCH_TYPE_WIFINETWORK = "WiFiNetwork"
66 
67 BUTTON_TYPE_WOL = "WakeOnLan"
68 
69 UPTIME_DEVIATION = 5
70 
71 FRITZ_EXCEPTIONS = (
72  FritzActionError,
73  FritzActionFailedError,
74  FritzConnectionException,
75  FritzInternalError,
76  FritzServiceError,
77  FritzLookUpError,
78 )
79 
80 FRITZ_AUTH_EXCEPTIONS = (FritzAuthorizationError, FritzSecurityError)
81 
82 WIFI_STANDARD = {1: "2.4Ghz", 2: "5Ghz", 3: "5Ghz", 4: "Guest"}
83 
84 CONNECTION_TYPE_LAN = "LAN"